diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-18 13:00:19 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-02-18 13:00:19 +0000 |
commit | 131ae177a71c7f5d9de596d9a83c76bd08579380 (patch) | |
tree | b789361352812965dea062f4bddbc50378216889 | |
parent | a0f82e928a20237945d5d00ec8d034079458e9b9 (diff) | |
download | busybox-w32-131ae177a71c7f5d9de596d9a83c76bd08579380.tar.gz busybox-w32-131ae177a71c7f5d9de596d9a83c76bd08579380.tar.bz2 busybox-w32-131ae177a71c7f5d9de596d9a83c76bd08579380.zip |
ash: convert #ifdef CONFIG_ to #if ENABLE_
-rw-r--r-- | shell/ash.c | 282 |
1 files changed, 119 insertions, 163 deletions
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 @@ | |||
82 | #include <time.h> | 82 | #include <time.h> |
83 | #include <fnmatch.h> | 83 | #include <fnmatch.h> |
84 | 84 | ||
85 | #ifdef CONFIG_ASH_JOB_CONTROL | 85 | #if ENABLE_ASH_JOB_CONTROL |
86 | #define JOBS 1 | 86 | #define JOBS 1 |
87 | #else | 87 | #else |
88 | #define JOBS 0 | 88 | #define JOBS 0 |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #if JOBS || defined(CONFIG_ASH_READ_NCHARS) | 91 | #if JOBS || ENABLE_ASH_READ_NCHARS |
92 | #include <termios.h> | 92 | #include <termios.h> |
93 | #endif | 93 | #endif |
94 | 94 | ||
@@ -111,7 +111,7 @@ static int *dash_errno; | |||
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | 113 | ||
114 | #ifdef CONFIG_ASH_ALIAS | 114 | #if ENABLE_ASH_ALIAS |
115 | /* alias.h */ | 115 | /* alias.h */ |
116 | 116 | ||
117 | #define ALIASINUSE 1 | 117 | #define ALIASINUSE 1 |
@@ -225,7 +225,7 @@ static void exerror(int, const char *, ...) ATTRIBUTE_NORETURN; | |||
225 | 225 | ||
226 | static void sh_warnx(const char *, ...); | 226 | static void sh_warnx(const char *, ...); |
227 | 227 | ||
228 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE | 228 | #if ENABLE_ASH_OPTIMIZE_FOR_SIZE |
229 | static void | 229 | static void |
230 | inton(void) { | 230 | inton(void) { |
231 | if (--suppressint == 0 && intpending) { | 231 | if (--suppressint == 0 && intpending) { |
@@ -254,7 +254,7 @@ static void forceinton(void) | |||
254 | if (intpending) onint(); \ | 254 | if (intpending) onint(); \ |
255 | 0; \ | 255 | 0; \ |
256 | }) | 256 | }) |
257 | #endif /* CONFIG_ASH_OPTIMIZE_FOR_SIZE */ | 257 | #endif /* ASH_OPTIMIZE_FOR_SIZE */ |
258 | 258 | ||
259 | /* expand.h */ | 259 | /* expand.h */ |
260 | 260 | ||
@@ -289,7 +289,7 @@ static void expandarg(union node *, struct arglist *, int); | |||
289 | static char *_rmescapes(char *, int); | 289 | static char *_rmescapes(char *, int); |
290 | static int casematch(union node *, char *); | 290 | static int casematch(union node *, char *); |
291 | 291 | ||
292 | #ifdef CONFIG_ASH_MATH_SUPPORT | 292 | #if ENABLE_ASH_MATH_SUPPORT |
293 | static void expari(int); | 293 | static void expari(int); |
294 | #endif | 294 | #endif |
295 | 295 | ||
@@ -340,7 +340,6 @@ struct backcmd { /* result of evalbackcmd */ | |||
340 | #define NNOT 25 | 340 | #define NNOT 25 |
341 | 341 | ||
342 | 342 | ||
343 | |||
344 | struct ncmd { | 343 | struct ncmd { |
345 | int type; | 344 | int type; |
346 | union node *assign; | 345 | union node *assign; |
@@ -348,28 +347,24 @@ struct ncmd { | |||
348 | union node *redirect; | 347 | union node *redirect; |
349 | }; | 348 | }; |
350 | 349 | ||
351 | |||
352 | struct npipe { | 350 | struct npipe { |
353 | int type; | 351 | int type; |
354 | int backgnd; | 352 | int backgnd; |
355 | struct nodelist *cmdlist; | 353 | struct nodelist *cmdlist; |
356 | }; | 354 | }; |
357 | 355 | ||
358 | |||
359 | struct nredir { | 356 | struct nredir { |
360 | int type; | 357 | int type; |
361 | union node *n; | 358 | union node *n; |
362 | union node *redirect; | 359 | union node *redirect; |
363 | }; | 360 | }; |
364 | 361 | ||
365 | |||
366 | struct nbinary { | 362 | struct nbinary { |
367 | int type; | 363 | int type; |
368 | union node *ch1; | 364 | union node *ch1; |
369 | union node *ch2; | 365 | union node *ch2; |
370 | }; | 366 | }; |
371 | 367 | ||
372 | |||
373 | struct nif { | 368 | struct nif { |
374 | int type; | 369 | int type; |
375 | union node *test; | 370 | union node *test; |
@@ -377,7 +372,6 @@ struct nif { | |||
377 | union node *elsepart; | 372 | union node *elsepart; |
378 | }; | 373 | }; |
379 | 374 | ||
380 | |||
381 | struct nfor { | 375 | struct nfor { |
382 | int type; | 376 | int type; |
383 | union node *args; | 377 | union node *args; |
@@ -385,14 +379,12 @@ struct nfor { | |||
385 | char *var; | 379 | char *var; |
386 | }; | 380 | }; |
387 | 381 | ||
388 | |||
389 | struct ncase { | 382 | struct ncase { |
390 | int type; | 383 | int type; |
391 | union node *expr; | 384 | union node *expr; |
392 | union node *cases; | 385 | union node *cases; |
393 | }; | 386 | }; |
394 | 387 | ||
395 | |||
396 | struct nclist { | 388 | struct nclist { |
397 | int type; | 389 | int type; |
398 | union node *next; | 390 | union node *next; |
@@ -400,7 +392,6 @@ struct nclist { | |||
400 | union node *body; | 392 | union node *body; |
401 | }; | 393 | }; |
402 | 394 | ||
403 | |||
404 | struct narg { | 395 | struct narg { |
405 | int type; | 396 | int type; |
406 | union node *next; | 397 | union node *next; |
@@ -408,7 +399,6 @@ struct narg { | |||
408 | struct nodelist *backquote; | 399 | struct nodelist *backquote; |
409 | }; | 400 | }; |
410 | 401 | ||
411 | |||
412 | struct nfile { | 402 | struct nfile { |
413 | int type; | 403 | int type; |
414 | union node *next; | 404 | union node *next; |
@@ -417,7 +407,6 @@ struct nfile { | |||
417 | char *expfname; | 407 | char *expfname; |
418 | }; | 408 | }; |
419 | 409 | ||
420 | |||
421 | struct ndup { | 410 | struct ndup { |
422 | int type; | 411 | int type; |
423 | union node *next; | 412 | union node *next; |
@@ -426,7 +415,6 @@ struct ndup { | |||
426 | union node *vname; | 415 | union node *vname; |
427 | }; | 416 | }; |
428 | 417 | ||
429 | |||
430 | struct nhere { | 418 | struct nhere { |
431 | int type; | 419 | int type; |
432 | union node *next; | 420 | union node *next; |
@@ -434,13 +422,11 @@ struct nhere { | |||
434 | union node *doc; | 422 | union node *doc; |
435 | }; | 423 | }; |
436 | 424 | ||
437 | |||
438 | struct nnot { | 425 | struct nnot { |
439 | int type; | 426 | int type; |
440 | union node *com; | 427 | union node *com; |
441 | }; | 428 | }; |
442 | 429 | ||
443 | |||
444 | union node { | 430 | union node { |
445 | int type; | 431 | int type; |
446 | struct ncmd ncmd; | 432 | struct ncmd ncmd; |
@@ -458,13 +444,11 @@ union node { | |||
458 | struct nnot nnot; | 444 | struct nnot nnot; |
459 | }; | 445 | }; |
460 | 446 | ||
461 | |||
462 | struct nodelist { | 447 | struct nodelist { |
463 | struct nodelist *next; | 448 | struct nodelist *next; |
464 | union node *n; | 449 | union node *n; |
465 | }; | 450 | }; |
466 | 451 | ||
467 | |||
468 | struct funcnode { | 452 | struct funcnode { |
469 | int count; | 453 | int count; |
470 | union node n; | 454 | union node n; |
@@ -529,7 +513,7 @@ struct strpush { | |||
529 | struct strpush *prev; /* preceding string on stack */ | 513 | struct strpush *prev; /* preceding string on stack */ |
530 | char *prevstring; | 514 | char *prevstring; |
531 | int prevnleft; | 515 | int prevnleft; |
532 | #ifdef CONFIG_ASH_ALIAS | 516 | #if ENABLE_ASH_ALIAS |
533 | struct alias *ap; /* if push was associated with an alias */ | 517 | struct alias *ap; /* if push was associated with an alias */ |
534 | #endif | 518 | #endif |
535 | char *string; /* remember the string since it may change */ | 519 | char *string; /* remember the string since it may change */ |
@@ -709,7 +693,7 @@ static const char *tokname(int tok) | |||
709 | #define CSPCL 13 /* these terminate a word */ | 693 | #define CSPCL 13 /* these terminate a word */ |
710 | #define CIGN 14 /* character should be ignored */ | 694 | #define CIGN 14 /* character should be ignored */ |
711 | 695 | ||
712 | #ifdef CONFIG_ASH_ALIAS | 696 | #if ENABLE_ASH_ALIAS |
713 | #define SYNBASE 130 | 697 | #define SYNBASE 130 |
714 | #define PEOF -130 | 698 | #define PEOF -130 |
715 | #define PEOA -129 | 699 | #define PEOA -129 |
@@ -741,7 +725,7 @@ static const char *tokname(int tok) | |||
741 | * This file was generated by the mksyntax program. | 725 | * This file was generated by the mksyntax program. |
742 | */ | 726 | */ |
743 | 727 | ||
744 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE | 728 | #if ENABLE_ASH_OPTIMIZE_FOR_SIZE |
745 | #define USE_SIT_FUNCTION | 729 | #define USE_SIT_FUNCTION |
746 | #endif | 730 | #endif |
747 | 731 | ||
@@ -751,9 +735,9 @@ static const char *tokname(int tok) | |||
751 | #define SQSYNTAX 2 /* in single quotes */ | 735 | #define SQSYNTAX 2 /* in single quotes */ |
752 | #define ARISYNTAX 3 /* in arithmetic */ | 736 | #define ARISYNTAX 3 /* in arithmetic */ |
753 | 737 | ||
754 | #ifdef CONFIG_ASH_MATH_SUPPORT | 738 | #if ENABLE_ASH_MATH_SUPPORT |
755 | static const char S_I_T[][4] = { | 739 | static const char S_I_T[][4] = { |
756 | #ifdef CONFIG_ASH_ALIAS | 740 | #if ENABLE_ASH_ALIAS |
757 | {CSPCL, CIGN, CIGN, CIGN}, /* 0, PEOA */ | 741 | {CSPCL, CIGN, CIGN, CIGN}, /* 0, PEOA */ |
758 | #endif | 742 | #endif |
759 | {CSPCL, CWORD, CWORD, CWORD}, /* 1, ' ' */ | 743 | {CSPCL, CWORD, CWORD, CWORD}, /* 1, ' ' */ |
@@ -775,7 +759,7 @@ static const char S_I_T[][4] = { | |||
775 | }; | 759 | }; |
776 | #else | 760 | #else |
777 | static const char S_I_T[][3] = { | 761 | static const char S_I_T[][3] = { |
778 | #ifdef CONFIG_ASH_ALIAS | 762 | #if ENABLE_ASH_ALIAS |
779 | {CSPCL, CIGN, CIGN}, /* 0, PEOA */ | 763 | {CSPCL, CIGN, CIGN}, /* 0, PEOA */ |
780 | #endif | 764 | #endif |
781 | {CSPCL, CWORD, CWORD}, /* 1, ' ' */ | 765 | {CSPCL, CWORD, CWORD}, /* 1, ' ' */ |
@@ -795,7 +779,7 @@ static const char S_I_T[][3] = { | |||
795 | {CCTL, CCTL, CCTL} /* 14, CTLESC ... */ | 779 | {CCTL, CCTL, CCTL} /* 14, CTLESC ... */ |
796 | #endif | 780 | #endif |
797 | }; | 781 | }; |
798 | #endif /* CONFIG_ASH_MATH_SUPPORT */ | 782 | #endif /* ASH_MATH_SUPPORT */ |
799 | 783 | ||
800 | #ifdef USE_SIT_FUNCTION | 784 | #ifdef USE_SIT_FUNCTION |
801 | 785 | ||
@@ -804,7 +788,7 @@ static const char S_I_T[][3] = { | |||
804 | static int SIT(int c, int syntax) | 788 | static int SIT(int c, int syntax) |
805 | { | 789 | { |
806 | static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; | 790 | static const char spec_symbls[] = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; |
807 | #ifdef CONFIG_ASH_ALIAS | 791 | #if ENABLE_ASH_ALIAS |
808 | static const char syntax_index_table[] = { | 792 | static const char syntax_index_table[] = { |
809 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ | 793 | 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ |
810 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ | 794 | 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ |
@@ -824,7 +808,7 @@ static int SIT(int c, int syntax) | |||
824 | 808 | ||
825 | if (c == PEOF) /* 2^8+2 */ | 809 | if (c == PEOF) /* 2^8+2 */ |
826 | return CENDFILE; | 810 | return CENDFILE; |
827 | #ifdef CONFIG_ASH_ALIAS | 811 | #if ENABLE_ASH_ALIAS |
828 | if (c == PEOA) /* 2^8+1 */ | 812 | if (c == PEOA) /* 2^8+1 */ |
829 | indx = 0; | 813 | indx = 0; |
830 | else | 814 | else |
@@ -844,7 +828,7 @@ static int SIT(int c, int syntax) | |||
844 | 828 | ||
845 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] | 829 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] |
846 | 830 | ||
847 | #ifdef CONFIG_ASH_ALIAS | 831 | #if ENABLE_ASH_ALIAS |
848 | #define CSPCL_CIGN_CIGN_CIGN 0 | 832 | #define CSPCL_CIGN_CIGN_CIGN 0 |
849 | #define CSPCL_CWORD_CWORD_CWORD 1 | 833 | #define CSPCL_CWORD_CWORD_CWORD 1 |
850 | #define CNL_CNL_CNL_CNL 2 | 834 | #define CNL_CNL_CNL_CNL 2 |
@@ -880,7 +864,7 @@ static int SIT(int c, int syntax) | |||
880 | static const char syntax_index_table[258] = { | 864 | static const char syntax_index_table[258] = { |
881 | /* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */ | 865 | /* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */ |
882 | /* 0 PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE, | 866 | /* 0 PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE, |
883 | #ifdef CONFIG_ASH_ALIAS | 867 | #if ENABLE_ASH_ALIAS |
884 | /* 1 PEOA */ CSPCL_CIGN_CIGN_CIGN, | 868 | /* 1 PEOA */ CSPCL_CIGN_CIGN_CIGN, |
885 | #endif | 869 | #endif |
886 | /* 2 -128 0x80 */ CWORD_CWORD_CWORD_CWORD, | 870 | /* 2 -128 0x80 */ CWORD_CWORD_CWORD_CWORD, |
@@ -1215,15 +1199,15 @@ static int bgcmd(int, char **); | |||
1215 | #endif | 1199 | #endif |
1216 | static int breakcmd(int, char **); | 1200 | static int breakcmd(int, char **); |
1217 | static int cdcmd(int, char **); | 1201 | static int cdcmd(int, char **); |
1218 | #ifdef CONFIG_ASH_CMDCMD | 1202 | #if ENABLE_ASH_CMDCMD |
1219 | static int commandcmd(int, char **); | 1203 | static int commandcmd(int, char **); |
1220 | #endif | 1204 | #endif |
1221 | static int dotcmd(int, char **); | 1205 | static int dotcmd(int, char **); |
1222 | static int evalcmd(int, char **); | 1206 | static int evalcmd(int, char **); |
1223 | #ifdef CONFIG_ASH_BUILTIN_ECHO | 1207 | #if ENABLE_ASH_BUILTIN_ECHO |
1224 | static int echocmd(int, char **); | 1208 | static int echocmd(int, char **); |
1225 | #endif | 1209 | #endif |
1226 | #ifdef CONFIG_ASH_BUILTIN_TEST | 1210 | #if ENABLE_ASH_BUILTIN_TEST |
1227 | static int testcmd(int, char **); | 1211 | static int testcmd(int, char **); |
1228 | #endif | 1212 | #endif |
1229 | static int execcmd(int, char **); | 1213 | static int execcmd(int, char **); |
@@ -1233,7 +1217,7 @@ static int falsecmd(int, char **); | |||
1233 | #if JOBS | 1217 | #if JOBS |
1234 | static int fgcmd(int, char **); | 1218 | static int fgcmd(int, char **); |
1235 | #endif | 1219 | #endif |
1236 | #ifdef CONFIG_ASH_GETOPTS | 1220 | #if ENABLE_ASH_GETOPTS |
1237 | static int getoptscmd(int, char **); | 1221 | static int getoptscmd(int, char **); |
1238 | #endif | 1222 | #endif |
1239 | static int hashcmd(int, char **); | 1223 | static int hashcmd(int, char **); |
@@ -1243,7 +1227,7 @@ static int helpcmd(int argc, char **argv); | |||
1243 | #if JOBS | 1227 | #if JOBS |
1244 | static int jobscmd(int, char **); | 1228 | static int jobscmd(int, char **); |
1245 | #endif | 1229 | #endif |
1246 | #ifdef CONFIG_ASH_MATH_SUPPORT | 1230 | #if ENABLE_ASH_MATH_SUPPORT |
1247 | static int letcmd(int, char **); | 1231 | static int letcmd(int, char **); |
1248 | #endif | 1232 | #endif |
1249 | static int localcmd(int, char **); | 1233 | static int localcmd(int, char **); |
@@ -1266,7 +1250,7 @@ static int killcmd(int, char **); | |||
1266 | 1250 | ||
1267 | /* mail.h */ | 1251 | /* mail.h */ |
1268 | 1252 | ||
1269 | #ifdef CONFIG_ASH_MAIL | 1253 | #if ENABLE_ASH_MAIL |
1270 | static void chkmail(void); | 1254 | static void chkmail(void); |
1271 | static void changemail(const char *); | 1255 | static void changemail(const char *); |
1272 | #endif | 1256 | #endif |
@@ -1314,11 +1298,11 @@ struct builtincmd { | |||
1314 | static const struct builtincmd builtincmd[] = { | 1298 | static const struct builtincmd builtincmd[] = { |
1315 | { BUILTIN_SPEC_REG ".", dotcmd }, | 1299 | { BUILTIN_SPEC_REG ".", dotcmd }, |
1316 | { BUILTIN_SPEC_REG ":", truecmd }, | 1300 | { BUILTIN_SPEC_REG ":", truecmd }, |
1317 | #ifdef CONFIG_ASH_BUILTIN_TEST | 1301 | #if ENABLE_ASH_BUILTIN_TEST |
1318 | { BUILTIN_REGULAR "[", testcmd }, | 1302 | { BUILTIN_REGULAR "[", testcmd }, |
1319 | { BUILTIN_REGULAR "[[", testcmd }, | 1303 | { BUILTIN_REGULAR "[[", testcmd }, |
1320 | #endif | 1304 | #endif |
1321 | #ifdef CONFIG_ASH_ALIAS | 1305 | #if ENABLE_ASH_ALIAS |
1322 | { BUILTIN_REG_ASSG "alias", aliascmd }, | 1306 | { BUILTIN_REG_ASSG "alias", aliascmd }, |
1323 | #endif | 1307 | #endif |
1324 | #if JOBS | 1308 | #if JOBS |
@@ -1327,11 +1311,11 @@ static const struct builtincmd builtincmd[] = { | |||
1327 | { BUILTIN_SPEC_REG "break", breakcmd }, | 1311 | { BUILTIN_SPEC_REG "break", breakcmd }, |
1328 | { BUILTIN_REGULAR "cd", cdcmd }, | 1312 | { BUILTIN_REGULAR "cd", cdcmd }, |
1329 | { BUILTIN_NOSPEC "chdir", cdcmd }, | 1313 | { BUILTIN_NOSPEC "chdir", cdcmd }, |
1330 | #ifdef CONFIG_ASH_CMDCMD | 1314 | #if ENABLE_ASH_CMDCMD |
1331 | { BUILTIN_REGULAR "command", commandcmd }, | 1315 | { BUILTIN_REGULAR "command", commandcmd }, |
1332 | #endif | 1316 | #endif |
1333 | { BUILTIN_SPEC_REG "continue", breakcmd }, | 1317 | { BUILTIN_SPEC_REG "continue", breakcmd }, |
1334 | #ifdef CONFIG_ASH_BUILTIN_ECHO | 1318 | #if ENABLE_ASH_BUILTIN_ECHO |
1335 | { BUILTIN_REGULAR "echo", echocmd }, | 1319 | { BUILTIN_REGULAR "echo", echocmd }, |
1336 | #endif | 1320 | #endif |
1337 | { BUILTIN_SPEC_REG "eval", evalcmd }, | 1321 | { BUILTIN_SPEC_REG "eval", evalcmd }, |
@@ -1342,7 +1326,7 @@ static const struct builtincmd builtincmd[] = { | |||
1342 | #if JOBS | 1326 | #if JOBS |
1343 | { BUILTIN_REGULAR "fg", fgcmd }, | 1327 | { BUILTIN_REGULAR "fg", fgcmd }, |
1344 | #endif | 1328 | #endif |
1345 | #ifdef CONFIG_ASH_GETOPTS | 1329 | #if ENABLE_ASH_GETOPTS |
1346 | { BUILTIN_REGULAR "getopts", getoptscmd }, | 1330 | { BUILTIN_REGULAR "getopts", getoptscmd }, |
1347 | #endif | 1331 | #endif |
1348 | { BUILTIN_NOSPEC "hash", hashcmd }, | 1332 | { BUILTIN_NOSPEC "hash", hashcmd }, |
@@ -1353,7 +1337,7 @@ static const struct builtincmd builtincmd[] = { | |||
1353 | { BUILTIN_REGULAR "jobs", jobscmd }, | 1337 | { BUILTIN_REGULAR "jobs", jobscmd }, |
1354 | { BUILTIN_REGULAR "kill", killcmd }, | 1338 | { BUILTIN_REGULAR "kill", killcmd }, |
1355 | #endif | 1339 | #endif |
1356 | #ifdef CONFIG_ASH_MATH_SUPPORT | 1340 | #if ENABLE_ASH_MATH_SUPPORT |
1357 | { BUILTIN_NOSPEC "let", letcmd }, | 1341 | { BUILTIN_NOSPEC "let", letcmd }, |
1358 | #endif | 1342 | #endif |
1359 | { BUILTIN_ASSIGN "local", localcmd }, | 1343 | { BUILTIN_ASSIGN "local", localcmd }, |
@@ -1364,7 +1348,7 @@ static const struct builtincmd builtincmd[] = { | |||
1364 | { BUILTIN_SPEC_REG "set", setcmd }, | 1348 | { BUILTIN_SPEC_REG "set", setcmd }, |
1365 | { BUILTIN_SPEC_REG "shift", shiftcmd }, | 1349 | { BUILTIN_SPEC_REG "shift", shiftcmd }, |
1366 | { BUILTIN_SPEC_REG "source", dotcmd }, | 1350 | { BUILTIN_SPEC_REG "source", dotcmd }, |
1367 | #ifdef CONFIG_ASH_BUILTIN_TEST | 1351 | #if ENABLE_ASH_BUILTIN_TEST |
1368 | { BUILTIN_REGULAR "test", testcmd }, | 1352 | { BUILTIN_REGULAR "test", testcmd }, |
1369 | #endif | 1353 | #endif |
1370 | { BUILTIN_SPEC_REG "times", timescmd }, | 1354 | { BUILTIN_SPEC_REG "times", timescmd }, |
@@ -1373,7 +1357,7 @@ static const struct builtincmd builtincmd[] = { | |||
1373 | { BUILTIN_NOSPEC "type", typecmd }, | 1357 | { BUILTIN_NOSPEC "type", typecmd }, |
1374 | { BUILTIN_NOSPEC "ulimit", ulimitcmd }, | 1358 | { BUILTIN_NOSPEC "ulimit", ulimitcmd }, |
1375 | { BUILTIN_REGULAR "umask", umaskcmd }, | 1359 | { BUILTIN_REGULAR "umask", umaskcmd }, |
1376 | #ifdef CONFIG_ASH_ALIAS | 1360 | #if ENABLE_ASH_ALIAS |
1377 | { BUILTIN_REGULAR "unalias", unaliascmd }, | 1361 | { BUILTIN_REGULAR "unalias", unaliascmd }, |
1378 | #endif | 1362 | #endif |
1379 | { BUILTIN_SPEC_REG "unset", unsetcmd }, | 1363 | { BUILTIN_SPEC_REG "unset", unsetcmd }, |
@@ -1411,7 +1395,7 @@ static void changepath(const char *); | |||
1411 | static void defun(char *, union node *); | 1395 | static void defun(char *, union node *); |
1412 | static void unsetfunc(const char *); | 1396 | static void unsetfunc(const char *); |
1413 | 1397 | ||
1414 | #ifdef CONFIG_ASH_MATH_SUPPORT_64 | 1398 | #if ENABLE_ASH_MATH_SUPPORT_64 |
1415 | typedef int64_t arith_t; | 1399 | typedef int64_t arith_t; |
1416 | #define arith_t_type (long long) | 1400 | #define arith_t_type (long long) |
1417 | #else | 1401 | #else |
@@ -1419,12 +1403,12 @@ typedef long arith_t; | |||
1419 | #define arith_t_type (long) | 1403 | #define arith_t_type (long) |
1420 | #endif | 1404 | #endif |
1421 | 1405 | ||
1422 | #ifdef CONFIG_ASH_MATH_SUPPORT | 1406 | #if ENABLE_ASH_MATH_SUPPORT |
1423 | static arith_t dash_arith(const char *); | 1407 | static arith_t dash_arith(const char *); |
1424 | static arith_t arith(const char *expr, int *perrcode); | 1408 | static arith_t arith(const char *expr, int *perrcode); |
1425 | #endif | 1409 | #endif |
1426 | 1410 | ||
1427 | #ifdef CONFIG_ASH_RANDOM_SUPPORT | 1411 | #if ENABLE_ASH_RANDOM_SUPPORT |
1428 | static unsigned long rseed; | 1412 | static unsigned long rseed; |
1429 | static void change_random(const char *); | 1413 | static void change_random(const char *); |
1430 | # ifndef DYNAMIC_VAR | 1414 | # ifndef DYNAMIC_VAR |
@@ -1480,11 +1464,11 @@ static struct localvar *localvars; | |||
1480 | * Shell variables. | 1464 | * Shell variables. |
1481 | */ | 1465 | */ |
1482 | 1466 | ||
1483 | #ifdef CONFIG_ASH_GETOPTS | 1467 | #if ENABLE_ASH_GETOPTS |
1484 | static void getoptsreset(const char *); | 1468 | static void getoptsreset(const char *); |
1485 | #endif | 1469 | #endif |
1486 | 1470 | ||
1487 | #ifdef CONFIG_LOCALE_SUPPORT | 1471 | #if ENABLE_LOCALE_SUPPORT |
1488 | static void change_lc_all(const char *value); | 1472 | static void change_lc_all(const char *value); |
1489 | static void change_lc_ctype(const char *value); | 1473 | static void change_lc_ctype(const char *value); |
1490 | #endif | 1474 | #endif |
@@ -1508,7 +1492,7 @@ static struct var varinit[] = { | |||
1508 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "IFS\0", 0 }, | 1492 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "IFS\0", 0 }, |
1509 | #endif | 1493 | #endif |
1510 | 1494 | ||
1511 | #ifdef CONFIG_ASH_MAIL | 1495 | #if ENABLE_ASH_MAIL |
1512 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL\0", changemail }, | 1496 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL\0", changemail }, |
1513 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail }, | 1497 | { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail }, |
1514 | #endif | 1498 | #endif |
@@ -1517,13 +1501,13 @@ static struct var varinit[] = { | |||
1517 | { 0, VSTRFIXED|VTEXTFIXED, "PS1=$ ", 0 }, | 1501 | { 0, VSTRFIXED|VTEXTFIXED, "PS1=$ ", 0 }, |
1518 | { 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 }, | 1502 | { 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 }, |
1519 | { 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 }, | 1503 | { 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 }, |
1520 | #ifdef CONFIG_ASH_GETOPTS | 1504 | #if ENABLE_ASH_GETOPTS |
1521 | { 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset }, | 1505 | { 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset }, |
1522 | #endif | 1506 | #endif |
1523 | #ifdef CONFIG_ASH_RANDOM_SUPPORT | 1507 | #if ENABLE_ASH_RANDOM_SUPPORT |
1524 | {0, VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM\0", change_random }, | 1508 | {0, VSTRFIXED|VTEXTFIXED|VUNSET|VDYNAMIC, "RANDOM\0", change_random }, |
1525 | #endif | 1509 | #endif |
1526 | #ifdef CONFIG_LOCALE_SUPPORT | 1510 | #if ENABLE_LOCALE_SUPPORT |
1527 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all }, | 1511 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all }, |
1528 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype }, | 1512 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype }, |
1529 | #endif | 1513 | #endif |
@@ -1533,7 +1517,7 @@ static struct var varinit[] = { | |||
1533 | }; | 1517 | }; |
1534 | 1518 | ||
1535 | #define vifs varinit[0] | 1519 | #define vifs varinit[0] |
1536 | #ifdef CONFIG_ASH_MAIL | 1520 | #if ENABLE_ASH_MAIL |
1537 | #define vmail (&vifs)[1] | 1521 | #define vmail (&vifs)[1] |
1538 | #define vmpath (&vmail)[1] | 1522 | #define vmpath (&vmail)[1] |
1539 | #else | 1523 | #else |
@@ -1544,7 +1528,7 @@ static struct var varinit[] = { | |||
1544 | #define vps2 (&vps1)[1] | 1528 | #define vps2 (&vps1)[1] |
1545 | #define vps4 (&vps2)[1] | 1529 | #define vps4 (&vps2)[1] |
1546 | #define voptind (&vps4)[1] | 1530 | #define voptind (&vps4)[1] |
1547 | #ifdef CONFIG_ASH_GETOPTS | 1531 | #if ENABLE_ASH_GETOPTS |
1548 | #define vrandom (&voptind)[1] | 1532 | #define vrandom (&voptind)[1] |
1549 | #else | 1533 | #else |
1550 | #define vrandom (&vps4)[1] | 1534 | #define vrandom (&vps4)[1] |
@@ -1579,7 +1563,7 @@ static char **listvars(int, int, char ***); | |||
1579 | static int showvars(const char *, int, int); | 1563 | static int showvars(const char *, int, int); |
1580 | static void poplocalvars(void); | 1564 | static void poplocalvars(void); |
1581 | static int unsetvar(const char *); | 1565 | static int unsetvar(const char *); |
1582 | #ifdef CONFIG_ASH_GETOPTS | 1566 | #if ENABLE_ASH_GETOPTS |
1583 | static int setvarsafe(const char *, const char *, int); | 1567 | static int setvarsafe(const char *, const char *, int); |
1584 | #endif | 1568 | #endif |
1585 | static int varcmp(const char *, const char *); | 1569 | static int varcmp(const char *, const char *); |
@@ -1905,7 +1889,7 @@ struct shparam { | |||
1905 | int nparam; /* # of positional parameters (without $0) */ | 1889 | int nparam; /* # of positional parameters (without $0) */ |
1906 | unsigned char malloc; /* if parameter list dynamically allocated */ | 1890 | unsigned char malloc; /* if parameter list dynamically allocated */ |
1907 | char **p; /* parameter list */ | 1891 | char **p; /* parameter list */ |
1908 | #ifdef CONFIG_ASH_GETOPTS | 1892 | #if ENABLE_ASH_GETOPTS |
1909 | int optind; /* next parameter to be processed by getopts */ | 1893 | int optind; /* next parameter to be processed by getopts */ |
1910 | int optoff; /* used by getopts */ | 1894 | int optoff; /* used by getopts */ |
1911 | #endif | 1895 | #endif |
@@ -2093,7 +2077,7 @@ reset(void) | |||
2093 | } | 2077 | } |
2094 | } | 2078 | } |
2095 | 2079 | ||
2096 | #ifdef CONFIG_ASH_ALIAS | 2080 | #if ENABLE_ASH_ALIAS |
2097 | static struct alias *atab[ATABSIZE]; | 2081 | static struct alias *atab[ATABSIZE]; |
2098 | 2082 | ||
2099 | static void setalias(const char *, const char *); | 2083 | static void setalias(const char *, const char *); |
@@ -2274,7 +2258,7 @@ __lookupalias(const char *name) { | |||
2274 | 2258 | ||
2275 | return app; | 2259 | return app; |
2276 | } | 2260 | } |
2277 | #endif /* CONFIG_ASH_ALIAS */ | 2261 | #endif /* ASH_ALIAS */ |
2278 | 2262 | ||
2279 | 2263 | ||
2280 | /* cd.c */ | 2264 | /* cd.c */ |
@@ -2531,7 +2515,6 @@ setpwd(const char *val, int setold) | |||
2531 | */ | 2515 | */ |
2532 | 2516 | ||
2533 | 2517 | ||
2534 | |||
2535 | static void exverror(int, const char *, va_list) ATTRIBUTE_NORETURN; | 2518 | static void exverror(int, const char *, va_list) ATTRIBUTE_NORETURN; |
2536 | 2519 | ||
2537 | /* | 2520 | /* |
@@ -2668,7 +2651,6 @@ static const char * | |||
2668 | errmsg(int e, const char *em) | 2651 | errmsg(int e, const char *em) |
2669 | { | 2652 | { |
2670 | if (e == ENOENT || e == ENOTDIR) { | 2653 | if (e == ENOENT || e == ENOTDIR) { |
2671 | |||
2672 | return em; | 2654 | return em; |
2673 | } | 2655 | } |
2674 | return strerror(e); | 2656 | return strerror(e); |
@@ -2771,7 +2753,6 @@ evalstring(char *s, int mask) | |||
2771 | } | 2753 | } |
2772 | 2754 | ||
2773 | 2755 | ||
2774 | |||
2775 | /* | 2756 | /* |
2776 | * Evaluate a parse tree. The value is left in the global variable | 2757 | * Evaluate a parse tree. The value is left in the global variable |
2777 | * exitstatus. | 2758 | * exitstatus. |
@@ -2933,7 +2914,6 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) { | |||
2933 | } | 2914 | } |
2934 | 2915 | ||
2935 | 2916 | ||
2936 | |||
2937 | static void | 2917 | static void |
2938 | evalfor(union node *n, int flags) | 2918 | evalfor(union node *n, int flags) |
2939 | { | 2919 | { |
@@ -3002,7 +2982,6 @@ out: | |||
3002 | } | 2982 | } |
3003 | 2983 | ||
3004 | 2984 | ||
3005 | |||
3006 | /* | 2985 | /* |
3007 | * Kick off a subshell to evaluate a tree. | 2986 | * Kick off a subshell to evaluate a tree. |
3008 | */ | 2987 | */ |
@@ -3037,7 +3016,6 @@ nofork: | |||
3037 | } | 3016 | } |
3038 | 3017 | ||
3039 | 3018 | ||
3040 | |||
3041 | /* | 3019 | /* |
3042 | * Compute the names of the files in a redirection list. | 3020 | * Compute the names of the files in a redirection list. |
3043 | */ | 3021 | */ |
@@ -3075,7 +3053,6 @@ expredir(union node *n) | |||
3075 | } | 3053 | } |
3076 | 3054 | ||
3077 | 3055 | ||
3078 | |||
3079 | /* | 3056 | /* |
3080 | * Evaluate a pipeline. All the processes in the pipeline are children | 3057 | * Evaluate a pipeline. All the processes in the pipeline are children |
3081 | * of the process creating the pipeline. (This differs from some versions | 3058 | * of the process creating the pipeline. (This differs from some versions |
@@ -3138,7 +3115,6 @@ evalpipe(union node *n, int flags) | |||
3138 | } | 3115 | } |
3139 | 3116 | ||
3140 | 3117 | ||
3141 | |||
3142 | /* | 3118 | /* |
3143 | * Execute a command inside back quotes. If it's a builtin command, we | 3119 | * Execute a command inside back quotes. If it's a builtin command, we |
3144 | * want to save its output in a block obtained from malloc. Otherwise | 3120 | * want to save its output in a block obtained from malloc. Otherwise |
@@ -3191,7 +3167,7 @@ out: | |||
3191 | result->fd, result->buf, result->nleft, result->jp)); | 3167 | result->fd, result->buf, result->nleft, result->jp)); |
3192 | } | 3168 | } |
3193 | 3169 | ||
3194 | #ifdef CONFIG_ASH_CMDCMD | 3170 | #if ENABLE_ASH_CMDCMD |
3195 | static char ** parse_command_args(char **argv, const char **path) | 3171 | static char ** parse_command_args(char **argv, const char **path) |
3196 | { | 3172 | { |
3197 | char *cp, c; | 3173 | char *cp, c; |
@@ -3231,7 +3207,7 @@ static int isassignment(const char *p) | |||
3231 | return *q == '='; | 3207 | return *q == '='; |
3232 | } | 3208 | } |
3233 | 3209 | ||
3234 | #ifdef CONFIG_ASH_EXPAND_PRMT | 3210 | #if ENABLE_ASH_EXPAND_PRMT |
3235 | static const char *expandstr(const char *ps); | 3211 | static const char *expandstr(const char *ps); |
3236 | #else | 3212 | #else |
3237 | #define expandstr(s) s | 3213 | #define expandstr(s) s |
@@ -3373,7 +3349,7 @@ evalcommand(union node *cmd, int flags) | |||
3373 | spclbltin = IS_BUILTIN_SPECIAL(cmdentry.u.cmd); | 3349 | spclbltin = IS_BUILTIN_SPECIAL(cmdentry.u.cmd); |
3374 | if (cmdentry.u.cmd == EXECCMD) | 3350 | if (cmdentry.u.cmd == EXECCMD) |
3375 | cmd_is_exec++; | 3351 | cmd_is_exec++; |
3376 | #ifdef CONFIG_ASH_CMDCMD | 3352 | #if ENABLE_ASH_CMDCMD |
3377 | if (cmdentry.u.cmd == COMMANDCMD) { | 3353 | if (cmdentry.u.cmd == COMMANDCMD) { |
3378 | 3354 | ||
3379 | path = oldpath; | 3355 | path = oldpath; |
@@ -3523,7 +3499,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags) | |||
3523 | INTON; | 3499 | INTON; |
3524 | shellparam.nparam = argc - 1; | 3500 | shellparam.nparam = argc - 1; |
3525 | shellparam.p = argv + 1; | 3501 | shellparam.p = argv + 1; |
3526 | #ifdef CONFIG_ASH_GETOPTS | 3502 | #if ENABLE_ASH_GETOPTS |
3527 | shellparam.optind = 1; | 3503 | shellparam.optind = 1; |
3528 | shellparam.optoff = -1; | 3504 | shellparam.optoff = -1; |
3529 | #endif | 3505 | #endif |
@@ -3768,7 +3744,7 @@ tryexec(char *cmd, char **argv, char **envp) | |||
3768 | #if ENABLE_FEATURE_SH_STANDALONE_SHELL | 3744 | #if ENABLE_FEATURE_SH_STANDALONE_SHELL |
3769 | if (find_applet_by_name(cmd) != NULL) { | 3745 | if (find_applet_by_name(cmd) != NULL) { |
3770 | /* re-exec ourselves with the new arguments */ | 3746 | /* re-exec ourselves with the new arguments */ |
3771 | execve(CONFIG_BUSYBOX_EXEC_PATH,argv,envp); | 3747 | execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp); |
3772 | /* If they called chroot or otherwise made the binary no longer | 3748 | /* If they called chroot or otherwise made the binary no longer |
3773 | * executable, fall through */ | 3749 | * executable, fall through */ |
3774 | } | 3750 | } |
@@ -4115,7 +4091,6 @@ find_builtin(const char *name) | |||
4115 | } | 4091 | } |
4116 | 4092 | ||
4117 | 4093 | ||
4118 | |||
4119 | /* | 4094 | /* |
4120 | * Called when a cd is done. Marks all commands so the next time they | 4095 | * Called when a cd is done. Marks all commands so the next time they |
4121 | * are executed they will be rehashed. | 4096 | * are executed they will be rehashed. |
@@ -4140,7 +4115,6 @@ hashcd(void) | |||
4140 | } | 4115 | } |
4141 | 4116 | ||
4142 | 4117 | ||
4143 | |||
4144 | /* | 4118 | /* |
4145 | * Fix command hash table when PATH changed. | 4119 | * Fix command hash table when PATH changed. |
4146 | * Called before PATH is changed. The argument is the new value of PATH; | 4120 | * Called before PATH is changed. The argument is the new value of PATH; |
@@ -4357,7 +4331,7 @@ unsetfunc(const char *name) | |||
4357 | */ | 4331 | */ |
4358 | 4332 | ||
4359 | 4333 | ||
4360 | #ifdef CONFIG_ASH_CMDCMD | 4334 | #if ENABLE_ASH_CMDCMD |
4361 | static int | 4335 | static int |
4362 | describe_command(char *command, int describe_command_verbose) | 4336 | describe_command(char *command, int describe_command_verbose) |
4363 | #else | 4337 | #else |
@@ -4368,7 +4342,7 @@ describe_command(char *command) | |||
4368 | { | 4342 | { |
4369 | struct cmdentry entry; | 4343 | struct cmdentry entry; |
4370 | struct tblentry *cmdp; | 4344 | struct tblentry *cmdp; |
4371 | #ifdef CONFIG_ASH_ALIAS | 4345 | #if ENABLE_ASH_ALIAS |
4372 | const struct alias *ap; | 4346 | const struct alias *ap; |
4373 | #endif | 4347 | #endif |
4374 | const char *path = pathval(); | 4348 | const char *path = pathval(); |
@@ -4383,7 +4357,7 @@ describe_command(char *command) | |||
4383 | goto out; | 4357 | goto out; |
4384 | } | 4358 | } |
4385 | 4359 | ||
4386 | #ifdef CONFIG_ASH_ALIAS | 4360 | #if ENABLE_ASH_ALIAS |
4387 | /* Then look at the aliases */ | 4361 | /* Then look at the aliases */ |
4388 | if ((ap = lookupalias(command, 0)) != NULL) { | 4362 | if ((ap = lookupalias(command, 0)) != NULL) { |
4389 | if (describe_command_verbose) { | 4363 | if (describe_command_verbose) { |
@@ -4465,7 +4439,7 @@ typecmd(int argc, char **argv) | |||
4465 | int err = 0; | 4439 | int err = 0; |
4466 | 4440 | ||
4467 | for (i = 1; i < argc; i++) { | 4441 | for (i = 1; i < argc; i++) { |
4468 | #ifdef CONFIG_ASH_CMDCMD | 4442 | #if ENABLE_ASH_CMDCMD |
4469 | err |= describe_command(argv[i], 1); | 4443 | err |= describe_command(argv[i], 1); |
4470 | #else | 4444 | #else |
4471 | err |= describe_command(argv[i]); | 4445 | err |= describe_command(argv[i]); |
@@ -4474,7 +4448,7 @@ typecmd(int argc, char **argv) | |||
4474 | return err; | 4448 | return err; |
4475 | } | 4449 | } |
4476 | 4450 | ||
4477 | #ifdef CONFIG_ASH_CMDCMD | 4451 | #if ENABLE_ASH_CMDCMD |
4478 | static int | 4452 | static int |
4479 | commandcmd(int argc, char **argv) | 4453 | commandcmd(int argc, char **argv) |
4480 | { | 4454 | { |
@@ -4670,7 +4644,7 @@ argstr(char *p, int flag) | |||
4670 | CTLVAR, | 4644 | CTLVAR, |
4671 | CTLBACKQ, | 4645 | CTLBACKQ, |
4672 | CTLBACKQ | CTLQUOTE, | 4646 | CTLBACKQ | CTLQUOTE, |
4673 | #ifdef CONFIG_ASH_MATH_SUPPORT | 4647 | #if ENABLE_ASH_MATH_SUPPORT |
4674 | CTLENDARI, | 4648 | CTLENDARI, |
4675 | #endif | 4649 | #endif |
4676 | 0 | 4650 | 0 |
@@ -4707,7 +4681,7 @@ start: | |||
4707 | length += strcspn(p + length, reject); | 4681 | length += strcspn(p + length, reject); |
4708 | c = p[length]; | 4682 | c = p[length]; |
4709 | if (c && (!(c & 0x80) | 4683 | if (c && (!(c & 0x80) |
4710 | #ifdef CONFIG_ASH_MATH_SUPPORT | 4684 | #if ENABLE_ASH_MATH_SUPPORT |
4711 | || c == CTLENDARI | 4685 | || c == CTLENDARI |
4712 | #endif | 4686 | #endif |
4713 | )) { | 4687 | )) { |
@@ -4785,7 +4759,7 @@ addquote: | |||
4785 | expbackq(argbackq->n, c, quotes); | 4759 | expbackq(argbackq->n, c, quotes); |
4786 | argbackq = argbackq->next; | 4760 | argbackq = argbackq->next; |
4787 | goto start; | 4761 | goto start; |
4788 | #ifdef CONFIG_ASH_MATH_SUPPORT | 4762 | #if ENABLE_ASH_MATH_SUPPORT |
4789 | case CTLENDARI: | 4763 | case CTLENDARI: |
4790 | p--; | 4764 | p--; |
4791 | expari(quotes); | 4765 | expari(quotes); |
@@ -4886,7 +4860,7 @@ removerecordregions(int endoff) | |||
4886 | } | 4860 | } |
4887 | 4861 | ||
4888 | 4862 | ||
4889 | #ifdef CONFIG_ASH_MATH_SUPPORT | 4863 | #if ENABLE_ASH_MATH_SUPPORT |
4890 | /* | 4864 | /* |
4891 | * Expand arithmetic expression. Backup to start of expression, | 4865 | * Expand arithmetic expression. Backup to start of expression, |
4892 | * evaluate, place result in (backed up) result, adjust string position. | 4866 | * evaluate, place result in (backed up) result, adjust string position. |
@@ -5474,7 +5448,6 @@ ifsbreakup(char *string, struct arglist *arglist) | |||
5474 | int ifsspc; | 5448 | int ifsspc; |
5475 | int nulonly; | 5449 | int nulonly; |
5476 | 5450 | ||
5477 | |||
5478 | start = string; | 5451 | start = string; |
5479 | if (ifslastp != NULL) { | 5452 | if (ifslastp != NULL) { |
5480 | ifsspc = 0; | 5453 | ifsspc = 0; |
@@ -5790,7 +5763,7 @@ msort(struct strlist *list, int len) | |||
5790 | p = msort(p, len - half); /* sort second half */ | 5763 | p = msort(p, len - half); /* sort second half */ |
5791 | lpp = &list; | 5764 | lpp = &list; |
5792 | for (;;) { | 5765 | for (;;) { |
5793 | #ifdef CONFIG_LOCALE_SUPPORT | 5766 | #if ENABLE_LOCALE_SUPPORT |
5794 | if (strcoll(p->text, q->text) < 0) | 5767 | if (strcoll(p->text, q->text) < 0) |
5795 | #else | 5768 | #else |
5796 | if (strcmp(p->text, q->text) < 0) | 5769 | if (strcmp(p->text, q->text) < 0) |
@@ -5925,7 +5898,7 @@ cvtnum(arith_t num) | |||
5925 | int len; | 5898 | int len; |
5926 | 5899 | ||
5927 | expdest = makestrspace(32, expdest); | 5900 | expdest = makestrspace(32, expdest); |
5928 | #ifdef CONFIG_ASH_MATH_SUPPORT_64 | 5901 | #if ENABLE_ASH_MATH_SUPPORT_64 |
5929 | len = fmtstr(expdest, 32, "%lld", (long long) num); | 5902 | len = fmtstr(expdest, 32, "%lld", (long long) num); |
5930 | #else | 5903 | #else |
5931 | len = fmtstr(expdest, 32, "%ld", num); | 5904 | len = fmtstr(expdest, 32, "%ld", num); |
@@ -5971,7 +5944,7 @@ static void pushfile(void); | |||
5971 | 5944 | ||
5972 | #define pgetc_as_macro() (--parsenleft >= 0? SC2INT(*parsenextc++) : preadbuffer()) | 5945 | #define pgetc_as_macro() (--parsenleft >= 0? SC2INT(*parsenextc++) : preadbuffer()) |
5973 | 5946 | ||
5974 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE | 5947 | #if ENABLE_ASH_OPTIMIZE_FOR_SIZE |
5975 | #define pgetc_macro() pgetc() | 5948 | #define pgetc_macro() pgetc() |
5976 | static int | 5949 | static int |
5977 | pgetc(void) | 5950 | pgetc(void) |
@@ -5991,7 +5964,7 @@ pgetc(void) | |||
5991 | /* | 5964 | /* |
5992 | * Same as pgetc(), but ignores PEOA. | 5965 | * Same as pgetc(), but ignores PEOA. |
5993 | */ | 5966 | */ |
5994 | #ifdef CONFIG_ASH_ALIAS | 5967 | #if ENABLE_ASH_ALIAS |
5995 | static int pgetc2(void) | 5968 | static int pgetc2(void) |
5996 | { | 5969 | { |
5997 | int c; | 5970 | int c; |
@@ -6131,7 +6104,7 @@ preadbuffer(void) | |||
6131 | char savec; | 6104 | char savec; |
6132 | 6105 | ||
6133 | while (parsefile->strpush) { | 6106 | while (parsefile->strpush) { |
6134 | #ifdef CONFIG_ASH_ALIAS | 6107 | #if ENABLE_ASH_ALIAS |
6135 | if (parsenleft == -1 && parsefile->strpush->ap && | 6108 | if (parsenleft == -1 && parsefile->strpush->ap && |
6136 | parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { | 6109 | parsenextc[-1] != ' ' && parsenextc[-1] != '\t') { |
6137 | return PEOA; | 6110 | return PEOA; |
@@ -6227,7 +6200,7 @@ pushstring(char *s, void *ap) | |||
6227 | sp = parsefile->strpush = &(parsefile->basestrpush); | 6200 | sp = parsefile->strpush = &(parsefile->basestrpush); |
6228 | sp->prevstring = parsenextc; | 6201 | sp->prevstring = parsenextc; |
6229 | sp->prevnleft = parsenleft; | 6202 | sp->prevnleft = parsenleft; |
6230 | #ifdef CONFIG_ASH_ALIAS | 6203 | #if ENABLE_ASH_ALIAS |
6231 | sp->ap = (struct alias *)ap; | 6204 | sp->ap = (struct alias *)ap; |
6232 | if (ap) { | 6205 | if (ap) { |
6233 | ((struct alias *)ap)->flag |= ALIASINUSE; | 6206 | ((struct alias *)ap)->flag |= ALIASINUSE; |
@@ -6245,7 +6218,7 @@ popstring(void) | |||
6245 | struct strpush *sp = parsefile->strpush; | 6218 | struct strpush *sp = parsefile->strpush; |
6246 | 6219 | ||
6247 | INTOFF; | 6220 | INTOFF; |
6248 | #ifdef CONFIG_ASH_ALIAS | 6221 | #if ENABLE_ASH_ALIAS |
6249 | if (sp->ap) { | 6222 | if (sp->ap) { |
6250 | if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') { | 6223 | if (parsenextc[-1] == ' ' || parsenextc[-1] == '\t') { |
6251 | checkkwd |= CHKALIAS; | 6224 | checkkwd |= CHKALIAS; |
@@ -7705,7 +7678,7 @@ cmdputs(const char *s) | |||
7705 | case CTLBACKQ+CTLQUOTE: | 7678 | case CTLBACKQ+CTLQUOTE: |
7706 | str = "\"$(...)\""; | 7679 | str = "\"$(...)\""; |
7707 | goto dostr; | 7680 | goto dostr; |
7708 | #ifdef CONFIG_ASH_MATH_SUPPORT | 7681 | #if ENABLE_ASH_MATH_SUPPORT |
7709 | case CTLARI: | 7682 | case CTLARI: |
7710 | str = "$(("; | 7683 | str = "$(("; |
7711 | goto dostr; | 7684 | goto dostr; |
@@ -7805,7 +7778,7 @@ getstatus(struct job *job) { | |||
7805 | return retval; | 7778 | return retval; |
7806 | } | 7779 | } |
7807 | 7780 | ||
7808 | #ifdef CONFIG_ASH_MAIL | 7781 | #if ENABLE_ASH_MAIL |
7809 | /* mail.c */ | 7782 | /* mail.c */ |
7810 | 7783 | ||
7811 | /* | 7784 | /* |
@@ -7875,7 +7848,7 @@ changemail(const char *val) | |||
7875 | mail_var_path_changed++; | 7848 | mail_var_path_changed++; |
7876 | } | 7849 | } |
7877 | 7850 | ||
7878 | #endif /* CONFIG_ASH_MAIL */ | 7851 | #endif /* ASH_MAIL */ |
7879 | 7852 | ||
7880 | /* main.c */ | 7853 | /* main.c */ |
7881 | 7854 | ||
@@ -7951,7 +7924,7 @@ int ash_main(int argc, char **argv) | |||
7951 | #endif | 7924 | #endif |
7952 | rootpid = getpid(); | 7925 | rootpid = getpid(); |
7953 | 7926 | ||
7954 | #ifdef CONFIG_ASH_RANDOM_SUPPORT | 7927 | #if ENABLE_ASH_RANDOM_SUPPORT |
7955 | rseed = rootpid + ((time_t)time((time_t *)0)); | 7928 | rseed = rootpid + ((time_t)time((time_t *)0)); |
7956 | #endif | 7929 | #endif |
7957 | init(); | 7930 | init(); |
@@ -8048,7 +8021,7 @@ cmdloop(int top) | |||
8048 | inter = 0; | 8021 | inter = 0; |
8049 | if (iflag && top) { | 8022 | if (iflag && top) { |
8050 | inter++; | 8023 | inter++; |
8051 | #ifdef CONFIG_ASH_MAIL | 8024 | #if ENABLE_ASH_MAIL |
8052 | chkmail(); | 8025 | chkmail(); |
8053 | #endif | 8026 | #endif |
8054 | } | 8027 | } |
@@ -8192,7 +8165,7 @@ exitcmd(int argc, char **argv) | |||
8192 | /* NOTREACHED */ | 8165 | /* NOTREACHED */ |
8193 | } | 8166 | } |
8194 | 8167 | ||
8195 | #ifdef CONFIG_ASH_BUILTIN_ECHO | 8168 | #if ENABLE_ASH_BUILTIN_ECHO |
8196 | static int | 8169 | static int |
8197 | echocmd(int argc, char **argv) | 8170 | echocmd(int argc, char **argv) |
8198 | { | 8171 | { |
@@ -8200,7 +8173,7 @@ echocmd(int argc, char **argv) | |||
8200 | } | 8173 | } |
8201 | #endif | 8174 | #endif |
8202 | 8175 | ||
8203 | #ifdef CONFIG_ASH_BUILTIN_TEST | 8176 | #if ENABLE_ASH_BUILTIN_TEST |
8204 | static int | 8177 | static int |
8205 | testcmd(int argc, char **argv) | 8178 | testcmd(int argc, char **argv) |
8206 | { | 8179 | { |
@@ -8853,7 +8826,7 @@ setarg0: | |||
8853 | } | 8826 | } |
8854 | 8827 | ||
8855 | shellparam.p = xargv; | 8828 | shellparam.p = xargv; |
8856 | #ifdef CONFIG_ASH_GETOPTS | 8829 | #if ENABLE_ASH_GETOPTS |
8857 | shellparam.optind = 1; | 8830 | shellparam.optind = 1; |
8858 | shellparam.optoff = -1; | 8831 | shellparam.optoff = -1; |
8859 | #endif | 8832 | #endif |
@@ -8965,7 +8938,6 @@ setoption(int flag, int val) | |||
8965 | } | 8938 | } |
8966 | 8939 | ||
8967 | 8940 | ||
8968 | |||
8969 | /* | 8941 | /* |
8970 | * Set the shell parameters. | 8942 | * Set the shell parameters. |
8971 | */ | 8943 | */ |
@@ -8987,7 +8959,7 @@ setparam(char **argv) | |||
8987 | shellparam.malloc = 1; | 8959 | shellparam.malloc = 1; |
8988 | shellparam.nparam = nparam; | 8960 | shellparam.nparam = nparam; |
8989 | shellparam.p = newparam; | 8961 | shellparam.p = newparam; |
8990 | #ifdef CONFIG_ASH_GETOPTS | 8962 | #if ENABLE_ASH_GETOPTS |
8991 | shellparam.optind = 1; | 8963 | shellparam.optind = 1; |
8992 | shellparam.optoff = -1; | 8964 | shellparam.optoff = -1; |
8993 | #endif | 8965 | #endif |
@@ -9011,7 +8983,6 @@ freeparam(volatile struct shparam *param) | |||
9011 | } | 8983 | } |
9012 | 8984 | ||
9013 | 8985 | ||
9014 | |||
9015 | /* | 8986 | /* |
9016 | * The shift builtin command. | 8987 | * The shift builtin command. |
9017 | */ | 8988 | */ |
@@ -9035,7 +9006,7 @@ shiftcmd(int argc, char **argv) | |||
9035 | } | 9006 | } |
9036 | ap2 = shellparam.p; | 9007 | ap2 = shellparam.p; |
9037 | while ((*ap2++ = *ap1++) != NULL); | 9008 | while ((*ap2++ = *ap1++) != NULL); |
9038 | #ifdef CONFIG_ASH_GETOPTS | 9009 | #if ENABLE_ASH_GETOPTS |
9039 | shellparam.optind = 1; | 9010 | shellparam.optind = 1; |
9040 | shellparam.optoff = -1; | 9011 | shellparam.optoff = -1; |
9041 | #endif | 9012 | #endif |
@@ -9044,7 +9015,6 @@ shiftcmd(int argc, char **argv) | |||
9044 | } | 9015 | } |
9045 | 9016 | ||
9046 | 9017 | ||
9047 | |||
9048 | /* | 9018 | /* |
9049 | * The set command builtin. | 9019 | * The set command builtin. |
9050 | */ | 9020 | */ |
@@ -9065,7 +9035,7 @@ setcmd(int argc, char **argv) | |||
9065 | } | 9035 | } |
9066 | 9036 | ||
9067 | 9037 | ||
9068 | #ifdef CONFIG_ASH_GETOPTS | 9038 | #if ENABLE_ASH_GETOPTS |
9069 | static void | 9039 | static void |
9070 | getoptsreset(const char *value) | 9040 | getoptsreset(const char *value) |
9071 | { | 9041 | { |
@@ -9074,7 +9044,7 @@ getoptsreset(const char *value) | |||
9074 | } | 9044 | } |
9075 | #endif | 9045 | #endif |
9076 | 9046 | ||
9077 | #ifdef CONFIG_LOCALE_SUPPORT | 9047 | #if ENABLE_LOCALE_SUPPORT |
9078 | static void change_lc_all(const char *value) | 9048 | static void change_lc_all(const char *value) |
9079 | { | 9049 | { |
9080 | if (value != 0 && *value != 0) | 9050 | if (value != 0 && *value != 0) |
@@ -9089,7 +9059,7 @@ static void change_lc_ctype(const char *value) | |||
9089 | 9059 | ||
9090 | #endif | 9060 | #endif |
9091 | 9061 | ||
9092 | #ifdef CONFIG_ASH_RANDOM_SUPPORT | 9062 | #if ENABLE_ASH_RANDOM_SUPPORT |
9093 | /* Roughly copied from bash.. */ | 9063 | /* Roughly copied from bash.. */ |
9094 | static void change_random(const char *value) | 9064 | static void change_random(const char *value) |
9095 | { | 9065 | { |
@@ -9110,7 +9080,7 @@ static void change_random(const char *value) | |||
9110 | #endif | 9080 | #endif |
9111 | 9081 | ||
9112 | 9082 | ||
9113 | #ifdef CONFIG_ASH_GETOPTS | 9083 | #if ENABLE_ASH_GETOPTS |
9114 | static int | 9084 | static int |
9115 | getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *optoff) | 9085 | getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *optoff) |
9116 | { | 9086 | { |
@@ -9232,7 +9202,7 @@ getoptscmd(int argc, char **argv) | |||
9232 | return getopts(argv[1], argv[2], optbase, &shellparam.optind, | 9202 | return getopts(argv[1], argv[2], optbase, &shellparam.optind, |
9233 | &shellparam.optoff); | 9203 | &shellparam.optoff); |
9234 | } | 9204 | } |
9235 | #endif /* CONFIG_ASH_GETOPTS */ | 9205 | #endif /* ASH_GETOPTS */ |
9236 | 9206 | ||
9237 | /* | 9207 | /* |
9238 | * XXX - should get rid of. have all builtins use getopt(3). the | 9208 | * 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, ...) | |||
9345 | } | 9315 | } |
9346 | 9316 | ||
9347 | 9317 | ||
9348 | |||
9349 | /* parser.c */ | 9318 | /* parser.c */ |
9350 | 9319 | ||
9351 | 9320 | ||
@@ -9386,8 +9355,6 @@ static void synerror(const char *) ATTRIBUTE_NORETURN; | |||
9386 | static void setprompt(int); | 9355 | static void setprompt(int); |
9387 | 9356 | ||
9388 | 9357 | ||
9389 | |||
9390 | |||
9391 | /* | 9358 | /* |
9392 | * Read and parse a command. Returns NEOF on end of file. (NULL is a | 9359 | * Read and parse a command. Returns NEOF on end of file. (NULL is a |
9393 | * valid parse tree indicating a blank line.) | 9360 | * valid parse tree indicating a blank line.) |
@@ -9482,7 +9449,6 @@ list(int nlflag) | |||
9482 | } | 9449 | } |
9483 | 9450 | ||
9484 | 9451 | ||
9485 | |||
9486 | static union node * | 9452 | static union node * |
9487 | andor(void) | 9453 | andor(void) |
9488 | { | 9454 | { |
@@ -9510,7 +9476,6 @@ andor(void) | |||
9510 | } | 9476 | } |
9511 | 9477 | ||
9512 | 9478 | ||
9513 | |||
9514 | static union node * | 9479 | static union node * |
9515 | pipeline(void) | 9480 | pipeline(void) |
9516 | { | 9481 | { |
@@ -9554,7 +9519,6 @@ pipeline(void) | |||
9554 | } | 9519 | } |
9555 | 9520 | ||
9556 | 9521 | ||
9557 | |||
9558 | static union node * | 9522 | static union node * |
9559 | command(void) | 9523 | command(void) |
9560 | { | 9524 | { |
@@ -9604,7 +9568,8 @@ command(void) | |||
9604 | n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL; | 9568 | n1->type = (lasttoken == TWHILE)? NWHILE : NUNTIL; |
9605 | n1->nbinary.ch1 = list(0); | 9569 | n1->nbinary.ch1 = list(0); |
9606 | if ((got=readtoken()) != TDO) { | 9570 | if ((got=readtoken()) != TDO) { |
9607 | TRACE(("expecting DO got %s %s\n", tokname(got), got == TWORD ? wordtext : "")); | 9571 | TRACE(("expecting DO got %s %s\n", tokname(got), |
9572 | got == TWORD ? wordtext : "")); | ||
9608 | synexpect(TDO); | 9573 | synexpect(TDO); |
9609 | } | 9574 | } |
9610 | n1->nbinary.ch2 = list(0); | 9575 | n1->nbinary.ch2 = list(0); |
@@ -9942,7 +9907,7 @@ readtoken(void) | |||
9942 | int alreadyseen = tokpushback; | 9907 | int alreadyseen = tokpushback; |
9943 | #endif | 9908 | #endif |
9944 | 9909 | ||
9945 | #ifdef CONFIG_ASH_ALIAS | 9910 | #if ENABLE_ASH_ALIAS |
9946 | top: | 9911 | top: |
9947 | #endif | 9912 | #endif |
9948 | 9913 | ||
@@ -9976,7 +9941,7 @@ top: | |||
9976 | } | 9941 | } |
9977 | 9942 | ||
9978 | if (checkkwd & CHKALIAS) { | 9943 | if (checkkwd & CHKALIAS) { |
9979 | #ifdef CONFIG_ASH_ALIAS | 9944 | #if ENABLE_ASH_ALIAS |
9980 | struct alias *ap; | 9945 | struct alias *ap; |
9981 | if ((ap = lookupalias(wordtext, 1)) != NULL) { | 9946 | if ((ap = lookupalias(wordtext, 1)) != NULL) { |
9982 | if (*ap->val) { | 9947 | if (*ap->val) { |
@@ -10050,7 +10015,7 @@ static int xxreadtoken(void) | |||
10050 | c = pgetc_macro(); | 10015 | c = pgetc_macro(); |
10051 | 10016 | ||
10052 | if ((c != ' ') && (c != '\t') | 10017 | if ((c != ' ') && (c != '\t') |
10053 | #ifdef CONFIG_ASH_ALIAS | 10018 | #if ENABLE_ASH_ALIAS |
10054 | && (c != PEOA) | 10019 | && (c != PEOA) |
10055 | #endif | 10020 | #endif |
10056 | ) { | 10021 | ) { |
@@ -10117,7 +10082,7 @@ xxreadtoken(void) | |||
10117 | c = pgetc_macro(); | 10082 | c = pgetc_macro(); |
10118 | switch (c) { | 10083 | switch (c) { |
10119 | case ' ': case '\t': | 10084 | case ' ': case '\t': |
10120 | #ifdef CONFIG_ASH_ALIAS | 10085 | #if ENABLE_ASH_ALIAS |
10121 | case PEOA: | 10086 | case PEOA: |
10122 | #endif | 10087 | #endif |
10123 | continue; | 10088 | continue; |
@@ -10317,7 +10282,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) | |||
10317 | USTPUTC(c, out); | 10282 | USTPUTC(c, out); |
10318 | } | 10283 | } |
10319 | break; | 10284 | break; |
10320 | #ifdef CONFIG_ASH_MATH_SUPPORT | 10285 | #if ENABLE_ASH_MATH_SUPPORT |
10321 | case CLP: /* '(' in arithmetic */ | 10286 | case CLP: /* '(' in arithmetic */ |
10322 | parenlevel++; | 10287 | parenlevel++; |
10323 | USTPUTC(c, out); | 10288 | USTPUTC(c, out); |
@@ -10358,7 +10323,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) | |||
10358 | default: | 10323 | default: |
10359 | if (varnest == 0) | 10324 | if (varnest == 0) |
10360 | goto endword; /* exit outer loop */ | 10325 | goto endword; /* exit outer loop */ |
10361 | #ifdef CONFIG_ASH_ALIAS | 10326 | #if ENABLE_ASH_ALIAS |
10362 | if (c != PEOA) | 10327 | if (c != PEOA) |
10363 | #endif | 10328 | #endif |
10364 | USTPUTC(c, out); | 10329 | USTPUTC(c, out); |
@@ -10368,7 +10333,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) | |||
10368 | } | 10333 | } |
10369 | } | 10334 | } |
10370 | endword: | 10335 | endword: |
10371 | #ifdef CONFIG_ASH_MATH_SUPPORT | 10336 | #if ENABLE_ASH_MATH_SUPPORT |
10372 | if (syntax == ARISYNTAX) | 10337 | if (syntax == ARISYNTAX) |
10373 | synerror("Missing '))'"); | 10338 | synerror("Missing '))'"); |
10374 | #endif | 10339 | #endif |
@@ -10402,7 +10367,6 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) | |||
10402 | /* end of readtoken routine */ | 10367 | /* end of readtoken routine */ |
10403 | 10368 | ||
10404 | 10369 | ||
10405 | |||
10406 | /* | 10370 | /* |
10407 | * Check to see whether we are at the end of the here document. When this | 10371 | * Check to see whether we are at the end of the here document. When this |
10408 | * is called, c is set to the first character of the next input line. If | 10372 | * 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) | |||
10411 | 10375 | ||
10412 | checkend: { | 10376 | checkend: { |
10413 | if (eofmark) { | 10377 | if (eofmark) { |
10414 | #ifdef CONFIG_ASH_ALIAS | 10378 | #if ENABLE_ASH_ALIAS |
10415 | if (c == PEOA) { | 10379 | if (c == PEOA) { |
10416 | c = pgetc2(); | 10380 | c = pgetc2(); |
10417 | } | 10381 | } |
@@ -10526,7 +10490,7 @@ parsesub: { | |||
10526 | pungetc(); | 10490 | pungetc(); |
10527 | } else if (c == '(') { /* $(command) or $((arith)) */ | 10491 | } else if (c == '(') { /* $(command) or $((arith)) */ |
10528 | if (pgetc() == '(') { | 10492 | if (pgetc() == '(') { |
10529 | #ifdef CONFIG_ASH_MATH_SUPPORT | 10493 | #if ENABLE_ASH_MATH_SUPPORT |
10530 | PARSEARITH(); | 10494 | PARSEARITH(); |
10531 | #else | 10495 | #else |
10532 | synerror("We unsupport $((arith))"); | 10496 | synerror("We unsupport $((arith))"); |
@@ -10691,7 +10655,7 @@ parsebackq: { | |||
10691 | /* fall through */ | 10655 | /* fall through */ |
10692 | 10656 | ||
10693 | case PEOF: | 10657 | case PEOF: |
10694 | #ifdef CONFIG_ASH_ALIAS | 10658 | #if ENABLE_ASH_ALIAS |
10695 | case PEOA: | 10659 | case PEOA: |
10696 | #endif | 10660 | #endif |
10697 | startlinno = plinno; | 10661 | startlinno = plinno; |
@@ -10768,7 +10732,7 @@ done: | |||
10768 | goto parsebackq_newreturn; | 10732 | goto parsebackq_newreturn; |
10769 | } | 10733 | } |
10770 | 10734 | ||
10771 | #ifdef CONFIG_ASH_MATH_SUPPORT | 10735 | #if ENABLE_ASH_MATH_SUPPORT |
10772 | /* | 10736 | /* |
10773 | * Parse an arithmetic expansion (indicate start of one and set state) | 10737 | * Parse an arithmetic expansion (indicate start of one and set state) |
10774 | */ | 10738 | */ |
@@ -10795,7 +10759,6 @@ parsearith: { | |||
10795 | } /* end of readtoken */ | 10759 | } /* end of readtoken */ |
10796 | 10760 | ||
10797 | 10761 | ||
10798 | |||
10799 | /* | 10762 | /* |
10800 | * Returns true if the text contains nothing to expand (no dollar signs | 10763 | * Returns true if the text contains nothing to expand (no dollar signs |
10801 | * or backquotes). | 10764 | * or backquotes). |
@@ -10872,7 +10835,7 @@ synerror(const char *msg) | |||
10872 | * should be added here. | 10835 | * should be added here. |
10873 | */ | 10836 | */ |
10874 | 10837 | ||
10875 | #ifdef CONFIG_ASH_EXPAND_PRMT | 10838 | #if ENABLE_ASH_EXPAND_PRMT |
10876 | static const char * | 10839 | static const char * |
10877 | expandstr(const char *ps) | 10840 | expandstr(const char *ps) |
10878 | { | 10841 | { |
@@ -10896,7 +10859,7 @@ expandstr(const char *ps) | |||
10896 | static void setprompt(int whichprompt) | 10859 | static void setprompt(int whichprompt) |
10897 | { | 10860 | { |
10898 | const char *prompt; | 10861 | const char *prompt; |
10899 | #ifdef CONFIG_ASH_EXPAND_PRMT | 10862 | #if ENABLE_ASH_EXPAND_PRMT |
10900 | struct stackmark smark; | 10863 | struct stackmark smark; |
10901 | #endif | 10864 | #endif |
10902 | 10865 | ||
@@ -10912,12 +10875,12 @@ static void setprompt(int whichprompt) | |||
10912 | default: /* 0 */ | 10875 | default: /* 0 */ |
10913 | prompt = nullstr; | 10876 | prompt = nullstr; |
10914 | } | 10877 | } |
10915 | #ifdef CONFIG_ASH_EXPAND_PRMT | 10878 | #if ENABLE_ASH_EXPAND_PRMT |
10916 | setstackmark(&smark); | 10879 | setstackmark(&smark); |
10917 | stalloc(stackblocksize()); | 10880 | stalloc(stackblocksize()); |
10918 | #endif | 10881 | #endif |
10919 | putprompt(expandstr(prompt)); | 10882 | putprompt(expandstr(prompt)); |
10920 | #ifdef CONFIG_ASH_EXPAND_PRMT | 10883 | #if ENABLE_ASH_EXPAND_PRMT |
10921 | popstackmark(&smark); | 10884 | popstackmark(&smark); |
10922 | #endif | 10885 | #endif |
10923 | } | 10886 | } |
@@ -11113,7 +11076,6 @@ static void dupredirect(union node *redir, int f) | |||
11113 | copyfd(f, fd); | 11076 | copyfd(f, fd); |
11114 | close(f); | 11077 | close(f); |
11115 | } | 11078 | } |
11116 | return; | ||
11117 | } | 11079 | } |
11118 | 11080 | ||
11119 | /* | 11081 | /* |
@@ -11386,7 +11348,6 @@ shcmd(union node *cmd, FILE *fp) | |||
11386 | } | 11348 | } |
11387 | 11349 | ||
11388 | 11350 | ||
11389 | |||
11390 | static void | 11351 | static void |
11391 | sharg(union node *arg, FILE *fp) | 11352 | sharg(union node *arg, FILE *fp) |
11392 | { | 11353 | { |
@@ -11484,7 +11445,6 @@ indent(int amount, char *pfx, FILE *fp) | |||
11484 | } | 11445 | } |
11485 | 11446 | ||
11486 | 11447 | ||
11487 | |||
11488 | /* | 11448 | /* |
11489 | * Debugging stuff. | 11449 | * Debugging stuff. |
11490 | */ | 11450 | */ |
@@ -11639,7 +11599,6 @@ opentrace(void) | |||
11639 | #define S_RESET 5 /* temporary - to reset a hard ignored sig */ | 11599 | #define S_RESET 5 /* temporary - to reset a hard ignored sig */ |
11640 | 11600 | ||
11641 | 11601 | ||
11642 | |||
11643 | /* | 11602 | /* |
11644 | * The trap builtin. | 11603 | * The trap builtin. |
11645 | */ | 11604 | */ |
@@ -11928,7 +11887,7 @@ static int helpcmd(int argc, char **argv) | |||
11928 | out1fmt("\n\n"); | 11887 | out1fmt("\n\n"); |
11929 | return EXIT_SUCCESS; | 11888 | return EXIT_SUCCESS; |
11930 | } | 11889 | } |
11931 | #endif /* CONFIG_FEATURE_SH_EXTRA_QUIET */ | 11890 | #endif /* FEATURE_SH_EXTRA_QUIET */ |
11932 | 11891 | ||
11933 | /* | 11892 | /* |
11934 | * Called to exit the shell. | 11893 | * Called to exit the shell. |
@@ -11976,7 +11935,7 @@ static struct var **findvar(struct var **, const char *); | |||
11976 | */ | 11935 | */ |
11977 | 11936 | ||
11978 | 11937 | ||
11979 | #ifdef CONFIG_ASH_GETOPTS | 11938 | #if ENABLE_ASH_GETOPTS |
11980 | /* | 11939 | /* |
11981 | * Safe version of setvar, returns 1 on success 0 on failure. | 11940 | * Safe version of setvar, returns 1 on success 0 on failure. |
11982 | */ | 11941 | */ |
@@ -12223,7 +12182,6 @@ showvars(const char *sep_prefix, int on, int off) | |||
12223 | } | 12182 | } |
12224 | 12183 | ||
12225 | 12184 | ||
12226 | |||
12227 | /* | 12185 | /* |
12228 | * The export and readonly commands. | 12186 | * The export and readonly commands. |
12229 | */ | 12187 | */ |
@@ -12433,7 +12391,6 @@ out: | |||
12433 | } | 12391 | } |
12434 | 12392 | ||
12435 | 12393 | ||
12436 | |||
12437 | /* | 12394 | /* |
12438 | * Find the appropriate entry in the hash table from the name. | 12395 | * Find the appropriate entry in the hash table from the name. |
12439 | */ | 12396 | */ |
@@ -12450,7 +12407,6 @@ hashvar(const char *p) | |||
12450 | } | 12407 | } |
12451 | 12408 | ||
12452 | 12409 | ||
12453 | |||
12454 | /* | 12410 | /* |
12455 | * Compares two strings up to the first = or '\0'. The first | 12411 | * Compares two strings up to the first = or '\0'. The first |
12456 | * string must be terminated by '='; the second may be terminated by | 12412 | * string must be terminated by '='; the second may be terminated by |
@@ -12526,7 +12482,7 @@ static int timescmd(int ac, char **av) | |||
12526 | return 0; | 12482 | return 0; |
12527 | } | 12483 | } |
12528 | 12484 | ||
12529 | #ifdef CONFIG_ASH_MATH_SUPPORT | 12485 | #if ENABLE_ASH_MATH_SUPPORT |
12530 | static arith_t | 12486 | static arith_t |
12531 | dash_arith(const char *s) | 12487 | dash_arith(const char *s) |
12532 | { | 12488 | { |
@@ -12573,7 +12529,7 @@ letcmd(int argc, char **argv) | |||
12573 | 12529 | ||
12574 | return !i; | 12530 | return !i; |
12575 | } | 12531 | } |
12576 | #endif /* CONFIG_ASH_MATH_SUPPORT */ | 12532 | #endif /* ASH_MATH_SUPPORT */ |
12577 | 12533 | ||
12578 | /* miscbltin.c */ | 12534 | /* miscbltin.c */ |
12579 | 12535 | ||
@@ -12608,13 +12564,13 @@ readcmd(int argc, char **argv) | |||
12608 | int startword; | 12564 | int startword; |
12609 | int status; | 12565 | int status; |
12610 | int i; | 12566 | int i; |
12611 | #if defined(CONFIG_ASH_READ_NCHARS) | 12567 | #if ENABLE_ASH_READ_NCHARS |
12612 | int nch_flag = 0; | 12568 | int nch_flag = 0; |
12613 | int nchars = 0; | 12569 | int nchars = 0; |
12614 | int silent = 0; | 12570 | int silent = 0; |
12615 | struct termios tty, old_tty; | 12571 | struct termios tty, old_tty; |
12616 | #endif | 12572 | #endif |
12617 | #if defined(CONFIG_ASH_READ_TIMEOUT) | 12573 | #if ENABLE_ASH_READ_TIMEOUT |
12618 | fd_set set; | 12574 | fd_set set; |
12619 | struct timeval ts; | 12575 | struct timeval ts; |
12620 | 12576 | ||
@@ -12623,11 +12579,11 @@ readcmd(int argc, char **argv) | |||
12623 | 12579 | ||
12624 | rflag = 0; | 12580 | rflag = 0; |
12625 | prompt = NULL; | 12581 | prompt = NULL; |
12626 | #if defined(CONFIG_ASH_READ_NCHARS) && defined(CONFIG_ASH_READ_TIMEOUT) | 12582 | #if ENABLE_ASH_READ_NCHARS && ENABLE_ASH_READ_TIMEOUT |
12627 | while ((i = nextopt("p:rt:n:s")) != '\0') | 12583 | while ((i = nextopt("p:rt:n:s")) != '\0') |
12628 | #elif defined(CONFIG_ASH_READ_NCHARS) | 12584 | #elif ENABLE_ASH_READ_NCHARS |
12629 | while ((i = nextopt("p:rn:s")) != '\0') | 12585 | while ((i = nextopt("p:rn:s")) != '\0') |
12630 | #elif defined(CONFIG_ASH_READ_TIMEOUT) | 12586 | #elif ENABLE_ASH_READ_TIMEOUT |
12631 | while ((i = nextopt("p:rt:")) != '\0') | 12587 | while ((i = nextopt("p:rt:")) != '\0') |
12632 | #else | 12588 | #else |
12633 | while ((i = nextopt("p:r")) != '\0') | 12589 | while ((i = nextopt("p:r")) != '\0') |
@@ -12637,7 +12593,7 @@ readcmd(int argc, char **argv) | |||
12637 | case 'p': | 12593 | case 'p': |
12638 | prompt = optionarg; | 12594 | prompt = optionarg; |
12639 | break; | 12595 | break; |
12640 | #if defined(CONFIG_ASH_READ_NCHARS) | 12596 | #if ENABLE_ASH_READ_NCHARS |
12641 | case 'n': | 12597 | case 'n': |
12642 | nchars = strtol(optionarg, &p, 10); | 12598 | nchars = strtol(optionarg, &p, 10); |
12643 | if (*p) | 12599 | if (*p) |
@@ -12648,7 +12604,7 @@ readcmd(int argc, char **argv) | |||
12648 | silent = 1; | 12604 | silent = 1; |
12649 | break; | 12605 | break; |
12650 | #endif | 12606 | #endif |
12651 | #if defined(CONFIG_ASH_READ_TIMEOUT) | 12607 | #if ENABLE_ASH_READ_TIMEOUT |
12652 | case 't': | 12608 | case 't': |
12653 | ts.tv_sec = strtol(optionarg, &p, 10); | 12609 | ts.tv_sec = strtol(optionarg, &p, 10); |
12654 | ts.tv_usec = 0; | 12610 | ts.tv_usec = 0; |
@@ -12687,7 +12643,7 @@ readcmd(int argc, char **argv) | |||
12687 | sh_error("arg count"); | 12643 | sh_error("arg count"); |
12688 | if ((ifs = bltinlookup("IFS")) == NULL) | 12644 | if ((ifs = bltinlookup("IFS")) == NULL) |
12689 | ifs = defifs; | 12645 | ifs = defifs; |
12690 | #if defined(CONFIG_ASH_READ_NCHARS) | 12646 | #if ENABLE_ASH_READ_NCHARS |
12691 | if (nch_flag || silent) { | 12647 | if (nch_flag || silent) { |
12692 | tcgetattr(0, &tty); | 12648 | tcgetattr(0, &tty); |
12693 | old_tty = tty; | 12649 | old_tty = tty; |
@@ -12702,14 +12658,14 @@ readcmd(int argc, char **argv) | |||
12702 | tcsetattr(0, TCSANOW, &tty); | 12658 | tcsetattr(0, TCSANOW, &tty); |
12703 | } | 12659 | } |
12704 | #endif | 12660 | #endif |
12705 | #if defined(CONFIG_ASH_READ_TIMEOUT) | 12661 | #if ENABLE_ASH_READ_TIMEOUT |
12706 | if (ts.tv_sec || ts.tv_usec) { | 12662 | if (ts.tv_sec || ts.tv_usec) { |
12707 | FD_ZERO (&set); | 12663 | FD_ZERO (&set); |
12708 | FD_SET (0, &set); | 12664 | FD_SET (0, &set); |
12709 | 12665 | ||
12710 | i = select(FD_SETSIZE, &set, NULL, NULL, &ts); | 12666 | i = select(FD_SETSIZE, &set, NULL, NULL, &ts); |
12711 | if (!i) { | 12667 | if (!i) { |
12712 | #if defined(CONFIG_ASH_READ_NCHARS) | 12668 | #if ENABLE_ASH_READ_NCHARS |
12713 | if (nch_flag) | 12669 | if (nch_flag) |
12714 | tcsetattr(0, TCSANOW, &old_tty); | 12670 | tcsetattr(0, TCSANOW, &old_tty); |
12715 | #endif | 12671 | #endif |
@@ -12721,7 +12677,7 @@ readcmd(int argc, char **argv) | |||
12721 | startword = 1; | 12677 | startword = 1; |
12722 | backslash = 0; | 12678 | backslash = 0; |
12723 | STARTSTACKSTR(p); | 12679 | STARTSTACKSTR(p); |
12724 | #if defined(CONFIG_ASH_READ_NCHARS) | 12680 | #if ENABLE_ASH_READ_NCHARS |
12725 | while (!nch_flag || nchars--) | 12681 | while (!nch_flag || nchars--) |
12726 | #else | 12682 | #else |
12727 | for (;;) | 12683 | for (;;) |
@@ -12760,7 +12716,7 @@ put: | |||
12760 | STPUTC(c, p); | 12716 | STPUTC(c, p); |
12761 | } | 12717 | } |
12762 | } | 12718 | } |
12763 | #if defined(CONFIG_ASH_READ_NCHARS) | 12719 | #if ENABLE_ASH_READ_NCHARS |
12764 | if (nch_flag || silent) | 12720 | if (nch_flag || silent) |
12765 | tcsetattr(0, TCSANOW, &old_tty); | 12721 | tcsetattr(0, TCSANOW, &old_tty); |
12766 | #endif | 12722 | #endif |
@@ -13024,7 +12980,7 @@ ulimitcmd(int argc, char **argv) | |||
13024 | } | 12980 | } |
13025 | 12981 | ||
13026 | 12982 | ||
13027 | #ifdef CONFIG_ASH_MATH_SUPPORT | 12983 | #if ENABLE_ASH_MATH_SUPPORT |
13028 | 12984 | ||
13029 | /* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com> | 12985 | /* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com> |
13030 | 12986 | ||
@@ -13416,7 +13372,7 @@ static int arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) | |||
13416 | goto err; | 13372 | goto err; |
13417 | } | 13373 | } |
13418 | /* save to shell variable */ | 13374 | /* save to shell variable */ |
13419 | #ifdef CONFIG_ASH_MATH_SUPPORT_64 | 13375 | #if ENABLE_ASH_MATH_SUPPORT_64 |
13420 | snprintf(buf, sizeof(buf), "%lld", arith_t_type rez); | 13376 | snprintf(buf, sizeof(buf), "%lld", arith_t_type rez); |
13421 | #else | 13377 | #else |
13422 | snprintf(buf, sizeof(buf), "%ld", arith_t_type rez); | 13378 | snprintf(buf, sizeof(buf), "%ld", arith_t_type rez); |
@@ -13560,7 +13516,7 @@ static arith_t arith(const char *expr, int *perrcode) | |||
13560 | continue; | 13516 | continue; |
13561 | } else if (is_digit(arithval)) { | 13517 | } else if (is_digit(arithval)) { |
13562 | numstackptr->var = NULL; | 13518 | numstackptr->var = NULL; |
13563 | #ifdef CONFIG_ASH_MATH_SUPPORT_64 | 13519 | #if ENABLE_ASH_MATH_SUPPORT_64 |
13564 | numstackptr->val = strtoll(expr, (char **) &expr, 0); | 13520 | numstackptr->val = strtoll(expr, (char **) &expr, 0); |
13565 | #else | 13521 | #else |
13566 | numstackptr->val = strtol(expr, (char **) &expr, 0); | 13522 | numstackptr->val = strtol(expr, (char **) &expr, 0); |
@@ -13668,7 +13624,7 @@ static arith_t arith(const char *expr, int *perrcode) | |||
13668 | ++expr; | 13624 | ++expr; |
13669 | } /* while */ | 13625 | } /* while */ |
13670 | } | 13626 | } |
13671 | #endif /* CONFIG_ASH_MATH_SUPPORT */ | 13627 | #endif /* ASH_MATH_SUPPORT */ |
13672 | 13628 | ||
13673 | 13629 | ||
13674 | #if DEBUG | 13630 | #if DEBUG |