From: Denis Vlasenko Date: Sun, 18 Feb 2007 13:00:19 +0000 (-0000) Subject: ash: convert #ifdef CONFIG_ to #if ENABLE_ X-Git-Tag: 1_5_1~160 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=131ae177a71c7f5d9de596d9a83c76bd08579380;p=oweals%2Fbusybox.git ash: convert #ifdef CONFIG_ to #if ENABLE_ --- diff --git a/shell/ash.c b/shell/ash.c index a4ce3ffcd..981532120 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -82,13 +82,13 @@ #include #include -#ifdef CONFIG_ASH_JOB_CONTROL +#if ENABLE_ASH_JOB_CONTROL #define JOBS 1 #else #define JOBS 0 #endif -#if JOBS || defined(CONFIG_ASH_READ_NCHARS) +#if JOBS || ENABLE_ASH_READ_NCHARS #include #endif @@ -111,7 +111,7 @@ static int *dash_errno; #endif -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS /* alias.h */ #define ALIASINUSE 1 @@ -225,7 +225,7 @@ static void exerror(int, const char *, ...) ATTRIBUTE_NORETURN; static void sh_warnx(const char *, ...); -#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE +#if ENABLE_ASH_OPTIMIZE_FOR_SIZE static void inton(void) { if (--suppressint == 0 && intpending) { @@ -254,7 +254,7 @@ static void forceinton(void) if (intpending) onint(); \ 0; \ }) -#endif /* CONFIG_ASH_OPTIMIZE_FOR_SIZE */ +#endif /* ASH_OPTIMIZE_FOR_SIZE */ /* expand.h */ @@ -289,7 +289,7 @@ static void expandarg(union node *, struct arglist *, int); static char *_rmescapes(char *, int); static int casematch(union node *, char *); -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT static void expari(int); #endif @@ -340,7 +340,6 @@ struct backcmd { /* result of evalbackcmd */ #define NNOT 25 - struct ncmd { int type; union node *assign; @@ -348,28 +347,24 @@ struct ncmd { union node *redirect; }; - struct npipe { int type; int backgnd; struct nodelist *cmdlist; }; - struct nredir { int type; union node *n; union node *redirect; }; - struct nbinary { int type; union node *ch1; union node *ch2; }; - struct nif { int type; union node *test; @@ -377,7 +372,6 @@ struct nif { union node *elsepart; }; - struct nfor { int type; union node *args; @@ -385,14 +379,12 @@ struct nfor { char *var; }; - struct ncase { int type; union node *expr; union node *cases; }; - struct nclist { int type; union node *next; @@ -400,7 +392,6 @@ struct nclist { union node *body; }; - struct narg { int type; union node *next; @@ -408,7 +399,6 @@ struct narg { struct nodelist *backquote; }; - struct nfile { int type; union node *next; @@ -417,7 +407,6 @@ struct nfile { char *expfname; }; - struct ndup { int type; union node *next; @@ -426,7 +415,6 @@ struct ndup { union node *vname; }; - struct nhere { int type; union node *next; @@ -434,13 +422,11 @@ struct nhere { union node *doc; }; - struct nnot { int type; union node *com; }; - union node { int type; struct ncmd ncmd; @@ -458,13 +444,11 @@ union node { struct nnot nnot; }; - struct nodelist { struct nodelist *next; union node *n; }; - struct funcnode { int count; union node n; @@ -529,7 +513,7 @@ struct strpush { struct strpush *prev; /* preceding string on stack */ char *prevstring; int prevnleft; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS struct alias *ap; /* if push was associated with an alias */ #endif char *string; /* remember the string since it may change */ @@ -709,7 +693,7 @@ static const char *tokname(int tok) #define CSPCL 13 /* these terminate a word */ #define CIGN 14 /* character should be ignored */ -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS #define SYNBASE 130 #define PEOF -130 #define PEOA -129 @@ -741,7 +725,7 @@ static const char *tokname(int tok) * This file was generated by the mksyntax program. */ -#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE +#if ENABLE_ASH_OPTIMIZE_FOR_SIZE #define USE_SIT_FUNCTION #endif @@ -751,9 +735,9 @@ static const char *tokname(int tok) #define SQSYNTAX 2 /* in single quotes */ #define ARISYNTAX 3 /* in arithmetic */ -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT static const char S_I_T[][4] = { -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS {CSPCL, CIGN, CIGN, CIGN}, /* 0, PEOA */ #endif {CSPCL, CWORD, CWORD, CWORD}, /* 1, ' ' */ @@ -775,7 +759,7 @@ static const char S_I_T[][4] = { }; #else static const char S_I_T[][3] = { -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS {CSPCL, CIGN, CIGN}, /* 0, PEOA */ #endif {CSPCL, CWORD, CWORD}, /* 1, ' ' */ @@ -795,7 +779,7 @@ static const char S_I_T[][3] = { {CCTL, CCTL, CCTL} /* 14, CTLESC ... */ #endif }; -#endif /* CONFIG_ASH_MATH_SUPPORT */ +#endif /* ASH_MATH_SUPPORT */ #ifdef USE_SIT_FUNCTION @@ -804,7 +788,7 @@ static const char S_I_T[][3] = { static int SIT(int c, int syntax) { static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS static const char syntax_index_table[] = { 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ @@ -824,7 +808,7 @@ static int SIT(int c, int syntax) if (c == PEOF) /* 2^8+2 */ return CENDFILE; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS if (c == PEOA) /* 2^8+1 */ indx = 0; else @@ -844,7 +828,7 @@ static int SIT(int c, int syntax) #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS #define CSPCL_CIGN_CIGN_CIGN 0 #define CSPCL_CWORD_CWORD_CWORD 1 #define CNL_CNL_CNL_CNL 2 @@ -880,7 +864,7 @@ static int SIT(int c, int syntax) static const char syntax_index_table[258] = { /* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */ /* 0 PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE, -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS /* 1 PEOA */ CSPCL_CIGN_CIGN_CIGN, #endif /* 2 -128 0x80 */ CWORD_CWORD_CWORD_CWORD, @@ -1215,15 +1199,15 @@ static int bgcmd(int, char **); #endif static int breakcmd(int, char **); static int cdcmd(int, char **); -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD static int commandcmd(int, char **); #endif static int dotcmd(int, char **); static int evalcmd(int, char **); -#ifdef CONFIG_ASH_BUILTIN_ECHO +#if ENABLE_ASH_BUILTIN_ECHO static int echocmd(int, char **); #endif -#ifdef CONFIG_ASH_BUILTIN_TEST +#if ENABLE_ASH_BUILTIN_TEST static int testcmd(int, char **); #endif static int execcmd(int, char **); @@ -1233,7 +1217,7 @@ static int falsecmd(int, char **); #if JOBS static int fgcmd(int, char **); #endif -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS static int getoptscmd(int, char **); #endif static int hashcmd(int, char **); @@ -1243,7 +1227,7 @@ static int helpcmd(int argc, char **argv); #if JOBS static int jobscmd(int, char **); #endif -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT static int letcmd(int, char **); #endif static int localcmd(int, char **); @@ -1266,7 +1250,7 @@ static int killcmd(int, char **); /* mail.h */ -#ifdef CONFIG_ASH_MAIL +#if ENABLE_ASH_MAIL static void chkmail(void); static void changemail(const char *); #endif @@ -1314,11 +1298,11 @@ struct builtincmd { static const struct builtincmd builtincmd[] = { { BUILTIN_SPEC_REG ".", dotcmd }, { BUILTIN_SPEC_REG ":", truecmd }, -#ifdef CONFIG_ASH_BUILTIN_TEST +#if ENABLE_ASH_BUILTIN_TEST { BUILTIN_REGULAR "[", testcmd }, { BUILTIN_REGULAR "[[", testcmd }, #endif -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS { BUILTIN_REG_ASSG "alias", aliascmd }, #endif #if JOBS @@ -1327,11 +1311,11 @@ static const struct builtincmd builtincmd[] = { { BUILTIN_SPEC_REG "break", breakcmd }, { BUILTIN_REGULAR "cd", cdcmd }, { BUILTIN_NOSPEC "chdir", cdcmd }, -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD { BUILTIN_REGULAR "command", commandcmd }, #endif { BUILTIN_SPEC_REG "continue", breakcmd }, -#ifdef CONFIG_ASH_BUILTIN_ECHO +#if ENABLE_ASH_BUILTIN_ECHO { BUILTIN_REGULAR "echo", echocmd }, #endif { BUILTIN_SPEC_REG "eval", evalcmd }, @@ -1342,7 +1326,7 @@ static const struct builtincmd builtincmd[] = { #if JOBS { BUILTIN_REGULAR "fg", fgcmd }, #endif -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS { BUILTIN_REGULAR "getopts", getoptscmd }, #endif { BUILTIN_NOSPEC "hash", hashcmd }, @@ -1353,7 +1337,7 @@ static const struct builtincmd builtincmd[] = { { BUILTIN_REGULAR "jobs", jobscmd }, { BUILTIN_REGULAR "kill", killcmd }, #endif -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT { BUILTIN_NOSPEC "let", letcmd }, #endif { BUILTIN_ASSIGN "local", localcmd }, @@ -1364,7 +1348,7 @@ static const struct builtincmd builtincmd[] = { { BUILTIN_SPEC_REG "set", setcmd }, { BUILTIN_SPEC_REG "shift", shiftcmd }, { BUILTIN_SPEC_REG "source", dotcmd }, -#ifdef CONFIG_ASH_BUILTIN_TEST +#if ENABLE_ASH_BUILTIN_TEST { BUILTIN_REGULAR "test", testcmd }, #endif { BUILTIN_SPEC_REG "times", timescmd }, @@ -1373,7 +1357,7 @@ static const struct builtincmd builtincmd[] = { { BUILTIN_NOSPEC "type", typecmd }, { BUILTIN_NOSPEC "ulimit", ulimitcmd }, { BUILTIN_REGULAR "umask", umaskcmd }, -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS { BUILTIN_REGULAR "unalias", unaliascmd }, #endif { BUILTIN_SPEC_REG "unset", unsetcmd }, @@ -1411,7 +1395,7 @@ static void changepath(const char *); static void defun(char *, union node *); static void unsetfunc(const char *); -#ifdef CONFIG_ASH_MATH_SUPPORT_64 +#if ENABLE_ASH_MATH_SUPPORT_64 typedef int64_t arith_t; #define arith_t_type (long long) #else @@ -1419,12 +1403,12 @@ typedef long arith_t; #define arith_t_type (long) #endif -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT static arith_t dash_arith(const char *); static arith_t arith(const char *expr, int *perrcode); #endif -#ifdef CONFIG_ASH_RANDOM_SUPPORT +#if ENABLE_ASH_RANDOM_SUPPORT static unsigned long rseed; static void change_random(const char *); # ifndef DYNAMIC_VAR @@ -1480,11 +1464,11 @@ static struct localvar *localvars; * Shell variables. */ -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS static void getoptsreset(const char *); #endif -#ifdef CONFIG_LOCALE_SUPPORT +#if ENABLE_LOCALE_SUPPORT static void change_lc_all(const char *value); static void change_lc_ctype(const char *value); #endif @@ -1508,7 +1492,7 @@ static struct var varinit[] = { { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "IFS\0", 0 }, #endif -#ifdef CONFIG_ASH_MAIL +#if ENABLE_ASH_MAIL { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL\0", changemail }, { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail }, #endif @@ -1517,13 +1501,13 @@ static struct var varinit[] = { { 0, VSTRFIXED|VTEXTFIXED, "PS1=$ ", 0 }, { 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 }, { 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 }, -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS { 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset }, #endif -#ifdef CONFIG_ASH_RANDOM_SUPPORT +#if ENABLE_ASH_RANDOM_SUPPORT {0, VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM\0", change_random }, #endif -#ifdef CONFIG_LOCALE_SUPPORT +#if ENABLE_LOCALE_SUPPORT {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all }, {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype }, #endif @@ -1533,7 +1517,7 @@ static struct var varinit[] = { }; #define vifs varinit[0] -#ifdef CONFIG_ASH_MAIL +#if ENABLE_ASH_MAIL #define vmail (&vifs)[1] #define vmpath (&vmail)[1] #else @@ -1544,7 +1528,7 @@ static struct var varinit[] = { #define vps2 (&vps1)[1] #define vps4 (&vps2)[1] #define voptind (&vps4)[1] -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS #define vrandom (&voptind)[1] #else #define vrandom (&vps4)[1] @@ -1579,7 +1563,7 @@ static char **listvars(int, int, char ***); static int showvars(const char *, int, int); static void poplocalvars(void); static int unsetvar(const char *); -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS static int setvarsafe(const char *, const char *, int); #endif static int varcmp(const char *, const char *); @@ -1905,7 +1889,7 @@ struct shparam { int nparam; /* # of positional parameters (without $0) */ unsigned char malloc; /* if parameter list dynamically allocated */ char **p; /* parameter list */ -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS int optind; /* next parameter to be processed by getopts */ int optoff; /* used by getopts */ #endif @@ -2093,7 +2077,7 @@ reset(void) } } -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS static struct alias *atab[ATABSIZE]; static void setalias(const char *, const char *); @@ -2274,7 +2258,7 @@ __lookupalias(const char *name) { return app; } -#endif /* CONFIG_ASH_ALIAS */ +#endif /* ASH_ALIAS */ /* cd.c */ @@ -2531,7 +2515,6 @@ setpwd(const char *val, int setold) */ - static void exverror(int, const char *, va_list) ATTRIBUTE_NORETURN; /* @@ -2668,7 +2651,6 @@ static const char * errmsg(int e, const char *em) { if (e == ENOENT || e == ENOTDIR) { - return em; } return strerror(e); @@ -2771,7 +2753,6 @@ evalstring(char *s, int mask) } - /* * Evaluate a parse tree. The value is left in the global variable * exitstatus. @@ -2933,7 +2914,6 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) { } - static void evalfor(union node *n, int flags) { @@ -3002,7 +2982,6 @@ out: } - /* * Kick off a subshell to evaluate a tree. */ @@ -3037,7 +3016,6 @@ nofork: } - /* * Compute the names of the files in a redirection list. */ @@ -3075,7 +3053,6 @@ expredir(union node *n) } - /* * Evaluate a pipeline. All the processes in the pipeline are children * of the process creating the pipeline. (This differs from some versions @@ -3138,7 +3115,6 @@ evalpipe(union node *n, int flags) } - /* * Execute a command inside back quotes. If it's a builtin command, we * want to save its output in a block obtained from malloc. Otherwise @@ -3191,7 +3167,7 @@ out: result->fd, result->buf, result->nleft, result->jp)); } -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD static char ** parse_command_args(char **argv, const char **path) { char *cp, c; @@ -3231,7 +3207,7 @@ static int isassignment(const char *p) return *q == '='; } -#ifdef CONFIG_ASH_EXPAND_PRMT +#if ENABLE_ASH_EXPAND_PRMT static const char *expandstr(const char *ps); #else #define expandstr(s) s @@ -3373,7 +3349,7 @@ evalcommand(union node *cmd, int flags) spclbltin = IS_BUILTIN_SPECIAL(cmdentry.u.cmd); if (cmdentry.u.cmd == EXECCMD) cmd_is_exec++; -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD if (cmdentry.u.cmd == COMMANDCMD) { path = oldpath; @@ -3523,7 +3499,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) INTON; shellparam.nparam = argc - 1; shellparam.p = argv + 1; -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS shellparam.optind = 1; shellparam.optoff = -1; #endif @@ -3768,7 +3744,7 @@ tryexec(char *cmd, char **argv, char **envp) #if ENABLE_FEATURE_SH_STANDALONE_SHELL if (find_applet_by_name(cmd) != NULL) { /* re-exec ourselves with the new arguments */ - execve(CONFIG_BUSYBOX_EXEC_PATH,argv,envp); + execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp); /* If they called chroot or otherwise made the binary no longer * executable, fall through */ } @@ -4115,7 +4091,6 @@ find_builtin(const char *name) } - /* * Called when a cd is done. Marks all commands so the next time they * are executed they will be rehashed. @@ -4140,7 +4115,6 @@ hashcd(void) } - /* * Fix command hash table when PATH changed. * Called before PATH is changed. The argument is the new value of PATH; @@ -4357,7 +4331,7 @@ unsetfunc(const char *name) */ -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD static int describe_command(char *command, int describe_command_verbose) #else @@ -4368,7 +4342,7 @@ describe_command(char *command) { struct cmdentry entry; struct tblentry *cmdp; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS const struct alias *ap; #endif const char *path = pathval(); @@ -4383,7 +4357,7 @@ describe_command(char *command) goto out; } -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS /* Then look at the aliases */ if ((ap = lookupalias(command, 0)) != NULL) { if (describe_command_verbose) { @@ -4465,7 +4439,7 @@ typecmd(int argc, char **argv) int err = 0; for (i = 1; i < argc; i++) { -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD err |= describe_command(argv[i], 1); #else err |= describe_command(argv[i]); @@ -4474,7 +4448,7 @@ typecmd(int argc, char **argv) return err; } -#ifdef CONFIG_ASH_CMDCMD +#if ENABLE_ASH_CMDCMD static int commandcmd(int argc, char **argv) { @@ -4670,7 +4644,7 @@ argstr(char *p, int flag) CTLVAR, CTLBACKQ, CTLBACKQ | CTLQUOTE, -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT CTLENDARI, #endif 0 @@ -4707,7 +4681,7 @@ start: length += strcspn(p + length, reject); c = p[length]; if (c && (!(c & 0x80) -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT || c == CTLENDARI #endif )) { @@ -4785,7 +4759,7 @@ addquote: expbackq(argbackq->n, c, quotes); argbackq = argbackq->next; goto start; -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT case CTLENDARI: p--; expari(quotes); @@ -4886,7 +4860,7 @@ removerecordregions(int endoff) } -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT /* * Expand arithmetic expression. Backup to start of expression, * evaluate, place result in (backed up) result, adjust string position. @@ -5474,7 +5448,6 @@ ifsbreakup(char *string, struct arglist *arglist) int ifsspc; int nulonly; - start = string; if (ifslastp != NULL) { ifsspc = 0; @@ -5790,7 +5763,7 @@ msort(struct strlist *list, int len) p = msort(p, len - half); /* sort second half */ lpp = &list; for (;;) { -#ifdef CONFIG_LOCALE_SUPPORT +#if ENABLE_LOCALE_SUPPORT if (strcoll(p->text, q->text) < 0) #else if (strcmp(p->text, q->text) < 0) @@ -5925,7 +5898,7 @@ cvtnum(arith_t num) int len; expdest = makestrspace(32, expdest); -#ifdef CONFIG_ASH_MATH_SUPPORT_64 +#if ENABLE_ASH_MATH_SUPPORT_64 len = fmtstr(expdest, 32, "%lld", (long long) num); #else len = fmtstr(expdest, 32, "%ld", num); @@ -5971,7 +5944,7 @@ static void pushfile(void); #define pgetc_as_macro() (--parsenleft >= 0? SC2INT(*parsenextc++) : preadbuffer()) -#ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE +#if ENABLE_ASH_OPTIMIZE_FOR_SIZE #define pgetc_macro() pgetc() static int pgetc(void) @@ -5991,7 +5964,7 @@ pgetc(void) /* * Same as pgetc(), but ignores PEOA. */ -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS static int pgetc2(void) { int c; @@ -6131,7 +6104,7 @@ preadbuffer(void) char savec; while (parsefile->strpush) { -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS if (parsenleft == -1 && parsefile->strpush->ap && parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { return PEOA; @@ -6227,7 +6200,7 @@ pushstring(char *s, void *ap) sp = parsefile->strpush = &(parsefile->basestrpush); sp->prevstring = parsenextc; sp->prevnleft = parsenleft; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS sp->ap = (struct alias *)ap; if (ap) { ((struct alias *)ap)->flag |= ALIASINUSE; @@ -6245,7 +6218,7 @@ popstring(void) struct strpush *sp = parsefile->strpush; INTOFF; -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS if (sp->ap) { if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') { checkkwd |= CHKALIAS; @@ -7705,7 +7678,7 @@ cmdputs(const char *s) case CTLBACKQ+CTLQUOTE: str = "\"$(...)\""; goto dostr; -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT case CTLARI: str = "$(("; goto dostr; @@ -7805,7 +7778,7 @@ getstatus(struct job *job) { return retval; } -#ifdef CONFIG_ASH_MAIL +#if ENABLE_ASH_MAIL /* mail.c */ /* @@ -7875,7 +7848,7 @@ changemail(const char *val) mail_var_path_changed++; } -#endif /* CONFIG_ASH_MAIL */ +#endif /* ASH_MAIL */ /* main.c */ @@ -7951,7 +7924,7 @@ int ash_main(int argc, char **argv) #endif rootpid = getpid(); -#ifdef CONFIG_ASH_RANDOM_SUPPORT +#if ENABLE_ASH_RANDOM_SUPPORT rseed = rootpid + ((time_t)time((time_t *)0)); #endif init(); @@ -8048,7 +8021,7 @@ cmdloop(int top) inter = 0; if (iflag && top) { inter++; -#ifdef CONFIG_ASH_MAIL +#if ENABLE_ASH_MAIL chkmail(); #endif } @@ -8192,7 +8165,7 @@ exitcmd(int argc, char **argv) /* NOTREACHED */ } -#ifdef CONFIG_ASH_BUILTIN_ECHO +#if ENABLE_ASH_BUILTIN_ECHO static int echocmd(int argc, char **argv) { @@ -8200,7 +8173,7 @@ echocmd(int argc, char **argv) } #endif -#ifdef CONFIG_ASH_BUILTIN_TEST +#if ENABLE_ASH_BUILTIN_TEST static int testcmd(int argc, char **argv) { @@ -8853,7 +8826,7 @@ setarg0: } shellparam.p = xargv; -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS shellparam.optind = 1; shellparam.optoff = -1; #endif @@ -8965,7 +8938,6 @@ setoption(int flag, int val) } - /* * Set the shell parameters. */ @@ -8987,7 +8959,7 @@ setparam(char **argv) shellparam.malloc = 1; shellparam.nparam = nparam; shellparam.p = newparam; -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS shellparam.optind = 1; shellparam.optoff = -1; #endif @@ -9011,7 +8983,6 @@ freeparam(volatile struct shparam *param) } - /* * The shift builtin command. */ @@ -9035,7 +9006,7 @@ shiftcmd(int argc, char **argv) } ap2 = shellparam.p; while ((*ap2++ = *ap1++) != NULL); -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS shellparam.optind = 1; shellparam.optoff = -1; #endif @@ -9044,7 +9015,6 @@ shiftcmd(int argc, char **argv) } - /* * The set command builtin. */ @@ -9065,7 +9035,7 @@ setcmd(int argc, char **argv) } -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS static void getoptsreset(const char *value) { @@ -9074,7 +9044,7 @@ getoptsreset(const char *value) } #endif -#ifdef CONFIG_LOCALE_SUPPORT +#if ENABLE_LOCALE_SUPPORT static void change_lc_all(const char *value) { if (value != 0 && *value != 0) @@ -9089,7 +9059,7 @@ static void change_lc_ctype(const char *value) #endif -#ifdef CONFIG_ASH_RANDOM_SUPPORT +#if ENABLE_ASH_RANDOM_SUPPORT /* Roughly copied from bash.. */ static void change_random(const char *value) { @@ -9110,7 +9080,7 @@ static void change_random(const char *value) #endif -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS static int getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *optoff) { @@ -9232,7 +9202,7 @@ getoptscmd(int argc, char **argv) return getopts(argv[1], argv[2], optbase, &shellparam.optind, &shellparam.optoff); } -#endif /* CONFIG_ASH_GETOPTS */ +#endif /* ASH_GETOPTS */ /* * XXX - should get rid of. have all builtins use getopt(3). the @@ -9345,7 +9315,6 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...) } - /* parser.c */ @@ -9386,8 +9355,6 @@ static void synerror(const char *) ATTRIBUTE_NORETURN; static void setprompt(int); - - /* * Read and parse a command. Returns NEOF on end of file. (NULL is a * valid parse tree indicating a blank line.) @@ -9482,7 +9449,6 @@ list(int nlflag) } - static union node * andor(void) { @@ -9510,7 +9476,6 @@ andor(void) } - static union node * pipeline(void) { @@ -9554,7 +9519,6 @@ pipeline(void) } - static union node * command(void) { @@ -9604,7 +9568,8 @@ command(void) n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL; n1->nbinary.ch1 = list(0); if ((got=readtoken()) != TDO) { -TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : "")); + TRACE(("expecting DO got %s %s\n", tokname(got), + got == TWORD ? wordtext : "")); synexpect(TDO); } n1->nbinary.ch2 = list(0); @@ -9942,7 +9907,7 @@ readtoken(void) int alreadyseen = tokpushback; #endif -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS top: #endif @@ -9976,7 +9941,7 @@ top: } if (checkkwd & CHKALIAS) { -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS struct alias *ap; if ((ap = lookupalias(wordtext, 1)) != NULL) { if (*ap->val) { @@ -10050,7 +10015,7 @@ static int xxreadtoken(void) c = pgetc_macro(); if ((c != ' ') && (c != '\t') -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS && (c != PEOA) #endif ) { @@ -10117,7 +10082,7 @@ xxreadtoken(void) c = pgetc_macro(); switch (c) { case ' ': case '\t': -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS case PEOA: #endif continue; @@ -10317,7 +10282,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) USTPUTC(c, out); } break; -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT case CLP: /* '(' in arithmetic */ parenlevel++; USTPUTC(c, out); @@ -10358,7 +10323,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) default: if (varnest == 0) goto endword; /* exit outer loop */ -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS if (c != PEOA) #endif USTPUTC(c, out); @@ -10368,7 +10333,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) } } endword: -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT if (syntax == ARISYNTAX) synerror("Missing '))'"); #endif @@ -10402,7 +10367,6 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) /* end of readtoken routine */ - /* * Check to see whether we are at the end of the here document. When this * is called, c is set to the first character of the next input line. If @@ -10411,7 +10375,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) checkend: { if (eofmark) { -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS if (c == PEOA) { c = pgetc2(); } @@ -10526,7 +10490,7 @@ parsesub: { pungetc(); } else if (c == '(') { /* $(command) or $((arith)) */ if (pgetc() == '(') { -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT PARSEARITH(); #else synerror("We unsupport $((arith))"); @@ -10691,7 +10655,7 @@ parsebackq: { /* fall through */ case PEOF: -#ifdef CONFIG_ASH_ALIAS +#if ENABLE_ASH_ALIAS case PEOA: #endif startlinno = plinno; @@ -10768,7 +10732,7 @@ done: goto parsebackq_newreturn; } -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT /* * Parse an arithmetic expansion (indicate start of one and set state) */ @@ -10795,7 +10759,6 @@ parsearith: { } /* end of readtoken */ - /* * Returns true if the text contains nothing to expand (no dollar signs * or backquotes). @@ -10872,7 +10835,7 @@ synerror(const char *msg) * should be added here. */ -#ifdef CONFIG_ASH_EXPAND_PRMT +#if ENABLE_ASH_EXPAND_PRMT static const char * expandstr(const char *ps) { @@ -10896,7 +10859,7 @@ expandstr(const char *ps) static void setprompt(int whichprompt) { const char *prompt; -#ifdef CONFIG_ASH_EXPAND_PRMT +#if ENABLE_ASH_EXPAND_PRMT struct stackmark smark; #endif @@ -10912,12 +10875,12 @@ static void setprompt(int whichprompt) default: /* 0 */ prompt = nullstr; } -#ifdef CONFIG_ASH_EXPAND_PRMT +#if ENABLE_ASH_EXPAND_PRMT setstackmark(&smark); stalloc(stackblocksize()); #endif putprompt(expandstr(prompt)); -#ifdef CONFIG_ASH_EXPAND_PRMT +#if ENABLE_ASH_EXPAND_PRMT popstackmark(&smark); #endif } @@ -11113,7 +11076,6 @@ static void dupredirect(union node *redir, int f) copyfd(f, fd); close(f); } - return; } /* @@ -11386,7 +11348,6 @@ shcmd(union node *cmd, FILE *fp) } - static void sharg(union node *arg, FILE *fp) { @@ -11484,7 +11445,6 @@ indent(int amount, char *pfx, FILE *fp) } - /* * Debugging stuff. */ @@ -11639,7 +11599,6 @@ opentrace(void) #define S_RESET 5 /* temporary - to reset a hard ignored sig */ - /* * The trap builtin. */ @@ -11928,7 +11887,7 @@ static int helpcmd(int argc, char **argv) out1fmt("\n\n"); return EXIT_SUCCESS; } -#endif /* CONFIG_FEATURE_SH_EXTRA_QUIET */ +#endif /* FEATURE_SH_EXTRA_QUIET */ /* * Called to exit the shell. @@ -11976,7 +11935,7 @@ static struct var **findvar(struct var **, const char *); */ -#ifdef CONFIG_ASH_GETOPTS +#if ENABLE_ASH_GETOPTS /* * Safe version of setvar, returns 1 on success 0 on failure. */ @@ -12223,7 +12182,6 @@ showvars(const char *sep_prefix, int on, int off) } - /* * The export and readonly commands. */ @@ -12433,7 +12391,6 @@ out: } - /* * Find the appropriate entry in the hash table from the name. */ @@ -12450,7 +12407,6 @@ hashvar(const char *p) } - /* * Compares two strings up to the first = or '\0'. The first * string must be terminated by '='; the second may be terminated by @@ -12526,7 +12482,7 @@ static int timescmd(int ac, char **av) return 0; } -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT static arith_t dash_arith(const char *s) { @@ -12573,7 +12529,7 @@ letcmd(int argc, char **argv) return !i; } -#endif /* CONFIG_ASH_MATH_SUPPORT */ +#endif /* ASH_MATH_SUPPORT */ /* miscbltin.c */ @@ -12608,13 +12564,13 @@ readcmd(int argc, char **argv) int startword; int status; int i; -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS int nch_flag = 0; int nchars = 0; int silent = 0; struct termios tty, old_tty; #endif -#if defined(CONFIG_ASH_READ_TIMEOUT) +#if ENABLE_ASH_READ_TIMEOUT fd_set set; struct timeval ts; @@ -12623,11 +12579,11 @@ readcmd(int argc, char **argv) rflag = 0; prompt = NULL; -#if defined(CONFIG_ASH_READ_NCHARS) && defined(CONFIG_ASH_READ_TIMEOUT) +#if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT while ((i = nextopt("p:rt:n:s")) != '\0') -#elif defined(CONFIG_ASH_READ_NCHARS) +#elif ENABLE_ASH_READ_NCHARS while ((i = nextopt("p:rn:s")) != '\0') -#elif defined(CONFIG_ASH_READ_TIMEOUT) +#elif ENABLE_ASH_READ_TIMEOUT while ((i = nextopt("p:rt:")) != '\0') #else while ((i = nextopt("p:r")) != '\0') @@ -12637,7 +12593,7 @@ readcmd(int argc, char **argv) case 'p': prompt = optionarg; break; -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS case 'n': nchars = strtol(optionarg, &p, 10); if (*p) @@ -12648,7 +12604,7 @@ readcmd(int argc, char **argv) silent = 1; break; #endif -#if defined(CONFIG_ASH_READ_TIMEOUT) +#if ENABLE_ASH_READ_TIMEOUT case 't': ts.tv_sec = strtol(optionarg, &p, 10); ts.tv_usec = 0; @@ -12687,7 +12643,7 @@ readcmd(int argc, char **argv) sh_error("arg count"); if ((ifs = bltinlookup("IFS")) == NULL) ifs = defifs; -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS if (nch_flag || silent) { tcgetattr(0, &tty); old_tty = tty; @@ -12702,14 +12658,14 @@ readcmd(int argc, char **argv) tcsetattr(0, TCSANOW, &tty); } #endif -#if defined(CONFIG_ASH_READ_TIMEOUT) +#if ENABLE_ASH_READ_TIMEOUT if (ts.tv_sec || ts.tv_usec) { FD_ZERO (&set); FD_SET (0, &set); i = select(FD_SETSIZE, &set, NULL, NULL, &ts); if (!i) { -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS if (nch_flag) tcsetattr(0, TCSANOW, &old_tty); #endif @@ -12721,7 +12677,7 @@ readcmd(int argc, char **argv) startword = 1; backslash = 0; STARTSTACKSTR(p); -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS while (!nch_flag || nchars--) #else for (;;) @@ -12760,7 +12716,7 @@ put: STPUTC(c, p); } } -#if defined(CONFIG_ASH_READ_NCHARS) +#if ENABLE_ASH_READ_NCHARS if (nch_flag || silent) tcsetattr(0, TCSANOW, &old_tty); #endif @@ -13024,7 +12980,7 @@ ulimitcmd(int argc, char **argv) } -#ifdef CONFIG_ASH_MATH_SUPPORT +#if ENABLE_ASH_MATH_SUPPORT /* Copyright (c) 2001 Aaron Lehmann @@ -13416,7 +13372,7 @@ static int arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) goto err; } /* save to shell variable */ -#ifdef CONFIG_ASH_MATH_SUPPORT_64 +#if ENABLE_ASH_MATH_SUPPORT_64 snprintf(buf, sizeof(buf), "%lld", arith_t_type rez); #else snprintf(buf, sizeof(buf), "%ld", arith_t_type rez); @@ -13560,7 +13516,7 @@ static arith_t arith(const char *expr, int *perrcode) continue; } else if (is_digit(arithval)) { numstackptr->var = NULL; -#ifdef CONFIG_ASH_MATH_SUPPORT_64 +#if ENABLE_ASH_MATH_SUPPORT_64 numstackptr->val = strtoll(expr, (char **) &expr, 0); #else numstackptr->val = strtol(expr, (char **) &expr, 0); @@ -13668,7 +13624,7 @@ static arith_t arith(const char *expr, int *perrcode) ++expr; } /* while */ } -#endif /* CONFIG_ASH_MATH_SUPPORT */ +#endif /* ASH_MATH_SUPPORT */ #if DEBUG