diff options
| author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-29 19:41:06 +0000 |
|---|---|---|
| committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-29 19:41:06 +0000 |
| commit | 599e554aad2738efe2fa7948c28162b0f7323a63 (patch) | |
| tree | c0398d52bf44783d2dc330b4b33a908a58d2d55b /shell | |
| parent | ad8f6a3513f8b54f4e80adfcc22cab37dce40a2b (diff) | |
| download | busybox-w32-599e554aad2738efe2fa7948c28162b0f7323a63.tar.gz busybox-w32-599e554aad2738efe2fa7948c28162b0f7323a63.tar.bz2 busybox-w32-599e554aad2738efe2fa7948c28162b0f7323a63.zip | |
Svn 16007 broke the build under gcc 4.0.3. This fixes up some of the damage
(the e2fsprogs directory is too twisty and evil to easily fix, but I plan
to rewrite it anyway so I'll just bump that up in priority a bit).
git-svn-id: svn://busybox.net/trunk/busybox@16015 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 89 | ||||
| -rw-r--r-- | shell/cmdedit.c | 4 | ||||
| -rw-r--r-- | shell/hush.c | 42 |
3 files changed, 53 insertions, 82 deletions
diff --git a/shell/ash.c b/shell/ash.c index c1b2b0ed6..754c1d72b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -1591,7 +1591,7 @@ static int varcmp(const char *, const char *); | |||
| 1591 | static struct var **hashvar(const char *); | 1591 | static struct var **hashvar(const char *); |
| 1592 | 1592 | ||
| 1593 | 1593 | ||
| 1594 | static inline int varequal(const char *a, const char *b) { | 1594 | static int varequal(const char *a, const char *b) { |
| 1595 | return !varcmp(a, b); | 1595 | return !varcmp(a, b); |
| 1596 | } | 1596 | } |
| 1597 | 1597 | ||
| @@ -1649,8 +1649,7 @@ static void out2str(const char *p) | |||
| 1649 | * This routine initializes the builtin variables. | 1649 | * This routine initializes the builtin variables. |
| 1650 | */ | 1650 | */ |
| 1651 | 1651 | ||
| 1652 | static inline void | 1652 | static void initvar(void) |
| 1653 | initvar(void) | ||
| 1654 | { | 1653 | { |
| 1655 | struct var *vp; | 1654 | struct var *vp; |
| 1656 | struct var *end; | 1655 | struct var *end; |
| @@ -1674,8 +1673,7 @@ initvar(void) | |||
| 1674 | } while (++vp < end); | 1673 | } while (++vp < end); |
| 1675 | } | 1674 | } |
| 1676 | 1675 | ||
| 1677 | static inline void | 1676 | static void init(void) |
| 1678 | init(void) | ||
| 1679 | { | 1677 | { |
| 1680 | 1678 | ||
| 1681 | /* from input.c: */ | 1679 | /* from input.c: */ |
| @@ -1860,7 +1858,7 @@ static char *stnputs(const char *, size_t, char *); | |||
| 1860 | static char *stputs(const char *, char *); | 1858 | static char *stputs(const char *, char *); |
| 1861 | 1859 | ||
| 1862 | 1860 | ||
| 1863 | static inline char *_STPUTC(int c, char *p) { | 1861 | static char *_STPUTC(int c, char *p) { |
| 1864 | if (p == sstrend) | 1862 | if (p == sstrend) |
| 1865 | p = growstackstr(); | 1863 | p = growstackstr(); |
| 1866 | *p++ = c; | 1864 | *p++ = c; |
| @@ -2354,8 +2352,7 @@ out: | |||
| 2354 | * cd command. | 2352 | * cd command. |
| 2355 | */ | 2353 | */ |
| 2356 | 2354 | ||
| 2357 | static inline const char * | 2355 | static const char * updatepwd(const char *dir) |
| 2358 | updatepwd(const char *dir) | ||
| 2359 | { | 2356 | { |
| 2360 | char *new; | 2357 | char *new; |
| 2361 | char *p; | 2358 | char *p; |
| @@ -2444,8 +2441,7 @@ out: | |||
| 2444 | * Find out what the current directory is. If we already know the current | 2441 | * Find out what the current directory is. If we already know the current |
| 2445 | * directory, this routine returns immediately. | 2442 | * directory, this routine returns immediately. |
| 2446 | */ | 2443 | */ |
| 2447 | static inline char * | 2444 | static char * getpwd(void) |
| 2448 | getpwd(void) | ||
| 2449 | { | 2445 | { |
| 2450 | char *dir = getcwd(0, 0); | 2446 | char *dir = getcwd(0, 0); |
| 2451 | return dir ? dir : nullstr; | 2447 | return dir ? dir : nullstr; |
| @@ -3167,8 +3163,7 @@ out: | |||
| 3167 | } | 3163 | } |
| 3168 | 3164 | ||
| 3169 | #ifdef CONFIG_ASH_CMDCMD | 3165 | #ifdef CONFIG_ASH_CMDCMD |
| 3170 | static inline char ** | 3166 | static char ** parse_command_args(char **argv, const char **path) |
| 3171 | parse_command_args(char **argv, const char **path) | ||
| 3172 | { | 3167 | { |
| 3173 | char *cp, c; | 3168 | char *cp, c; |
| 3174 | 3169 | ||
| @@ -3199,8 +3194,7 @@ parse_command_args(char **argv, const char **path) | |||
| 3199 | } | 3194 | } |
| 3200 | #endif | 3195 | #endif |
| 3201 | 3196 | ||
| 3202 | static inline int | 3197 | static int isassignment(const char *p) |
| 3203 | isassignment(const char *p) | ||
| 3204 | { | 3198 | { |
| 3205 | const char *q = endofname(p); | 3199 | const char *q = endofname(p); |
| 3206 | if (p == q) | 3200 | if (p == q) |
| @@ -3520,8 +3514,7 @@ funcdone: | |||
| 3520 | } | 3514 | } |
| 3521 | 3515 | ||
| 3522 | 3516 | ||
| 3523 | static inline int | 3517 | static int goodname(const char *p) |
| 3524 | goodname(const char *p) | ||
| 3525 | { | 3518 | { |
| 3526 | return !*endofname(p); | 3519 | return !*endofname(p); |
| 3527 | } | 3520 | } |
| @@ -4245,8 +4238,7 @@ delete_cmd_entry(void) | |||
| 4245 | * the same name - except special builtins. | 4238 | * the same name - except special builtins. |
| 4246 | */ | 4239 | */ |
| 4247 | 4240 | ||
| 4248 | static inline void | 4241 | static void addcmdentry(char *name, struct cmdentry *entry) |
| 4249 | addcmdentry(char *name, struct cmdentry *entry) | ||
| 4250 | { | 4242 | { |
| 4251 | struct tblentry *cmdp; | 4243 | struct tblentry *cmdp; |
| 4252 | 4244 | ||
| @@ -4263,8 +4255,7 @@ addcmdentry(char *name, struct cmdentry *entry) | |||
| 4263 | * Make a copy of a parse tree. | 4255 | * Make a copy of a parse tree. |
| 4264 | */ | 4256 | */ |
| 4265 | 4257 | ||
| 4266 | static inline struct funcnode * | 4258 | static struct funcnode * copyfunc(union node *n) |
| 4267 | copyfunc(union node *n) | ||
| 4268 | { | 4259 | { |
| 4269 | struct funcnode *f; | 4260 | struct funcnode *f; |
| 4270 | size_t blocksize; | 4261 | size_t blocksize; |
| @@ -4529,8 +4520,7 @@ static void varunset(const char *, const char *, const char *, int) | |||
| 4529 | * Returns an stalloced string. | 4520 | * Returns an stalloced string. |
| 4530 | */ | 4521 | */ |
| 4531 | 4522 | ||
| 4532 | static inline char * | 4523 | static char * preglob(const char *pattern, int quoted, int flag) { |
| 4533 | preglob(const char *pattern, int quoted, int flag) { | ||
| 4534 | flag |= RMESCAPE_GLOB; | 4524 | flag |= RMESCAPE_GLOB; |
| 4535 | if (quoted) { | 4525 | if (quoted) { |
| 4536 | flag |= RMESCAPE_QUOTED; | 4526 | flag |= RMESCAPE_QUOTED; |
| @@ -4554,8 +4544,7 @@ esclen(const char *start, const char *p) { | |||
| 4554 | * Expand shell variables and backquotes inside a here document. | 4544 | * Expand shell variables and backquotes inside a here document. |
| 4555 | */ | 4545 | */ |
| 4556 | 4546 | ||
| 4557 | static inline void | 4547 | static void expandhere(union node *arg, int fd) |
| 4558 | expandhere(union node *arg, int fd) | ||
| 4559 | { | 4548 | { |
| 4560 | herefd = fd; | 4549 | herefd = fd; |
| 4561 | expandarg(arg, (struct arglist *)NULL, 0); | 4550 | expandarg(arg, (struct arglist *)NULL, 0); |
| @@ -5783,8 +5772,7 @@ msort(struct strlist *list, int len) | |||
| 5783 | * Returns true if the pattern matches the string. | 5772 | * Returns true if the pattern matches the string. |
| 5784 | */ | 5773 | */ |
| 5785 | 5774 | ||
| 5786 | static inline int | 5775 | static int patmatch(char *pattern, const char *string) |
| 5787 | patmatch(char *pattern, const char *string) | ||
| 5788 | { | 5776 | { |
| 5789 | return pmatch(preglob(pattern, 0, 0), string); | 5777 | return pmatch(preglob(pattern, 0, 0), string); |
| 5790 | } | 5778 | } |
| @@ -5967,7 +5955,7 @@ static int pgetc2(void) | |||
| 5967 | return c; | 5955 | return c; |
| 5968 | } | 5956 | } |
| 5969 | #else | 5957 | #else |
| 5970 | static inline int pgetc2(void) | 5958 | static int pgetc2(void) |
| 5971 | { | 5959 | { |
| 5972 | return pgetc_macro(); | 5960 | return pgetc_macro(); |
| 5973 | } | 5961 | } |
| @@ -5977,8 +5965,7 @@ static inline int pgetc2(void) | |||
| 5977 | * Read a line from the script. | 5965 | * Read a line from the script. |
| 5978 | */ | 5966 | */ |
| 5979 | 5967 | ||
| 5980 | static inline char * | 5968 | static char * pfgets(char *line, int len) |
| 5981 | pfgets(char *line, int len) | ||
| 5982 | { | 5969 | { |
| 5983 | char *p = line; | 5970 | char *p = line; |
| 5984 | int nleft = len; | 5971 | int nleft = len; |
| @@ -6007,7 +5994,7 @@ static char *cmdedit_prompt; | |||
| 6007 | #else | 5994 | #else |
| 6008 | static const char *cmdedit_prompt; | 5995 | static const char *cmdedit_prompt; |
| 6009 | #endif | 5996 | #endif |
| 6010 | static inline void putprompt(const char *s) | 5997 | static void putprompt(const char *s) |
| 6011 | { | 5998 | { |
| 6012 | #ifdef CONFIG_ASH_EXPAND_PRMT | 5999 | #ifdef CONFIG_ASH_EXPAND_PRMT |
| 6013 | free(cmdedit_prompt); | 6000 | free(cmdedit_prompt); |
| @@ -6017,14 +6004,13 @@ static inline void putprompt(const char *s) | |||
| 6017 | #endif | 6004 | #endif |
| 6018 | } | 6005 | } |
| 6019 | #else | 6006 | #else |
| 6020 | static inline void putprompt(const char *s) | 6007 | static void putprompt(const char *s) |
| 6021 | { | 6008 | { |
| 6022 | out2str(s); | 6009 | out2str(s); |
| 6023 | } | 6010 | } |
| 6024 | #endif | 6011 | #endif |
| 6025 | 6012 | ||
| 6026 | static inline int | 6013 | static int preadfd(void) |
| 6027 | preadfd(void) | ||
| 6028 | { | 6014 | { |
| 6029 | int nr; | 6015 | int nr; |
| 6030 | char *buf = parsefile->buf; | 6016 | char *buf = parsefile->buf; |
| @@ -7120,8 +7106,7 @@ growjobtab(void) | |||
| 7120 | * Called with interrupts off. | 7106 | * Called with interrupts off. |
| 7121 | */ | 7107 | */ |
| 7122 | 7108 | ||
| 7123 | static inline void | 7109 | static void forkchild(struct job *jp, union node *n, int mode) |
| 7124 | forkchild(struct job *jp, union node *n, int mode) | ||
| 7125 | { | 7110 | { |
| 7126 | int oldlvl; | 7111 | int oldlvl; |
| 7127 | 7112 | ||
| @@ -7168,8 +7153,7 @@ forkchild(struct job *jp, union node *n, int mode) | |||
| 7168 | jobless = 0; | 7153 | jobless = 0; |
| 7169 | } | 7154 | } |
| 7170 | 7155 | ||
| 7171 | static inline void | 7156 | static void forkparent(struct job *jp, union node *n, int mode, pid_t pid) |
| 7172 | forkparent(struct job *jp, union node *n, int mode, pid_t pid) | ||
| 7173 | { | 7157 | { |
| 7174 | TRACE(("In parent shell: child = %d\n", pid)); | 7158 | TRACE(("In parent shell: child = %d\n", pid)); |
| 7175 | if (!jp) { | 7159 | if (!jp) { |
| @@ -7306,8 +7290,7 @@ waitforjob(struct job *jp) | |||
| 7306 | * and the jobs command may give out of date information. | 7290 | * and the jobs command may give out of date information. |
| 7307 | */ | 7291 | */ |
| 7308 | 7292 | ||
| 7309 | static inline int | 7293 | static int waitproc(int block, int *status) |
| 7310 | waitproc(int block, int *status) | ||
| 7311 | { | 7294 | { |
| 7312 | int flags = 0; | 7295 | int flags = 0; |
| 7313 | 7296 | ||
| @@ -8071,8 +8054,7 @@ readcmdfile(char *name) | |||
| 8071 | * search for the file, which is necessary to find sub-commands. | 8054 | * search for the file, which is necessary to find sub-commands. |
| 8072 | */ | 8055 | */ |
| 8073 | 8056 | ||
| 8074 | static inline char * | 8057 | static char * find_dot_file(char *name) |
| 8075 | find_dot_file(char *name) | ||
| 8076 | { | 8058 | { |
| 8077 | char *fullname; | 8059 | char *fullname; |
| 8078 | const char *path = pathval(); | 8060 | const char *path = pathval(); |
| @@ -8347,8 +8329,7 @@ growstackblock(void) | |||
| 8347 | } | 8329 | } |
| 8348 | } | 8330 | } |
| 8349 | 8331 | ||
| 8350 | static inline void | 8332 | static void grabstackblock(size_t len) |
| 8351 | grabstackblock(size_t len) | ||
| 8352 | { | 8333 | { |
| 8353 | len = SHELL_ALIGN(len); | 8334 | len = SHELL_ALIGN(len); |
| 8354 | stacknxt += len; | 8335 | stacknxt += len; |
| @@ -8830,8 +8811,7 @@ optschanged(void) | |||
| 8830 | setvimode(viflag); | 8811 | setvimode(viflag); |
| 8831 | } | 8812 | } |
| 8832 | 8813 | ||
| 8833 | static inline void | 8814 | static void minus_o(char *name, int val) |
| 8834 | minus_o(char *name, int val) | ||
| 8835 | { | 8815 | { |
| 8836 | int i; | 8816 | int i; |
| 8837 | 8817 | ||
| @@ -10902,8 +10882,7 @@ static const char *const *findkwd(const char *s) | |||
| 10902 | * Open a file in noclobber mode. | 10882 | * Open a file in noclobber mode. |
| 10903 | * The code was copied from bash. | 10883 | * The code was copied from bash. |
| 10904 | */ | 10884 | */ |
| 10905 | static inline int | 10885 | static int noclobberopen(const char *fname) |
| 10906 | noclobberopen(const char *fname) | ||
| 10907 | { | 10886 | { |
| 10908 | int r, fd; | 10887 | int r, fd; |
| 10909 | struct stat finfo, finfo2; | 10888 | struct stat finfo, finfo2; |
| @@ -10962,8 +10941,7 @@ noclobberopen(const char *fname) | |||
| 10962 | * the pipe without forking. | 10941 | * the pipe without forking. |
| 10963 | */ | 10942 | */ |
| 10964 | 10943 | ||
| 10965 | static inline int | 10944 | static int openhere(union node *redir) |
| 10966 | openhere(union node *redir) | ||
| 10967 | { | 10945 | { |
| 10968 | int pip[2]; | 10946 | int pip[2]; |
| 10969 | size_t len = 0; | 10947 | size_t len = 0; |
| @@ -11055,8 +11033,7 @@ eopen: | |||
| 11055 | sh_error("cannot open %s: %s", fname, errmsg(errno, E_OPEN)); | 11033 | sh_error("cannot open %s: %s", fname, errmsg(errno, E_OPEN)); |
| 11056 | } | 11034 | } |
| 11057 | 11035 | ||
| 11058 | static inline void | 11036 | static void dupredirect(union node *redir, int f) |
| 11059 | dupredirect(union node *redir, int f) | ||
| 11060 | { | 11037 | { |
| 11061 | int fd = redir->nfile.fd; | 11038 | int fd = redir->nfile.fd; |
| 11062 | 11039 | ||
| @@ -12231,8 +12208,7 @@ exportcmd(int argc, char **argv) | |||
| 12231 | * "-" as a special case. | 12208 | * "-" as a special case. |
| 12232 | */ | 12209 | */ |
| 12233 | 12210 | ||
| 12234 | static inline void | 12211 | static void mklocal(char *name) |
| 12235 | mklocal(char *name) | ||
| 12236 | { | 12212 | { |
| 12237 | struct localvar *lvp; | 12213 | struct localvar *lvp; |
| 12238 | struct var **vpp; | 12214 | struct var **vpp; |
| @@ -13186,7 +13162,7 @@ typedef unsigned char operator; | |||
| 13186 | 13162 | ||
| 13187 | #define NUMPTR (*numstackptr) | 13163 | #define NUMPTR (*numstackptr) |
| 13188 | 13164 | ||
| 13189 | static inline int tok_have_assign(operator op) | 13165 | static int tok_have_assign(operator op) |
| 13190 | { | 13166 | { |
| 13191 | operator prec = PREC(op); | 13167 | operator prec = PREC(op); |
| 13192 | 13168 | ||
| @@ -13195,7 +13171,7 @@ static inline int tok_have_assign(operator op) | |||
| 13195 | prec == PREC_PRE || prec == PREC_POST); | 13171 | prec == PREC_PRE || prec == PREC_POST); |
| 13196 | } | 13172 | } |
| 13197 | 13173 | ||
| 13198 | static inline int is_right_associativity(operator prec) | 13174 | static int is_right_associativity(operator prec) |
| 13199 | { | 13175 | { |
| 13200 | return (prec == PREC(TOK_ASSIGN) || prec == PREC(TOK_EXPONENT) || | 13176 | return (prec == PREC(TOK_ASSIGN) || prec == PREC(TOK_EXPONENT) || |
| 13201 | prec == PREC(TOK_CONDITIONAL)); | 13177 | prec == PREC(TOK_CONDITIONAL)); |
| @@ -13258,8 +13234,7 @@ static int arith_lookup_val(v_n_t *t) | |||
| 13258 | /* "applying" a token means performing it on the top elements on the integer | 13234 | /* "applying" a token means performing it on the top elements on the integer |
| 13259 | * stack. For a unary operator it will only change the top element, but a | 13235 | * stack. For a unary operator it will only change the top element, but a |
| 13260 | * binary operator will pop two arguments and push a result */ | 13236 | * binary operator will pop two arguments and push a result */ |
| 13261 | static inline int | 13237 | static int arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) |
| 13262 | arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr) | ||
| 13263 | { | 13238 | { |
| 13264 | v_n_t *numptr_m1; | 13239 | v_n_t *numptr_m1; |
| 13265 | arith_t numptr_val, rez; | 13240 | arith_t numptr_val, rez; |
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 03aaa3b2e..fb1946e83 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
| @@ -247,13 +247,13 @@ static void goto_new_line(void) | |||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | 249 | ||
| 250 | static inline void out1str(const char *s) | 250 | static void out1str(const char *s) |
| 251 | { | 251 | { |
| 252 | if ( s ) | 252 | if ( s ) |
| 253 | fputs(s, stdout); | 253 | fputs(s, stdout); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | static inline void beep(void) | 256 | static void beep(void) |
| 257 | { | 257 | { |
| 258 | putchar('\007'); | 258 | putchar('\007'); |
| 259 | } | 259 | } |
diff --git a/shell/hush.c b/shell/hush.c index 8df91a1e8..230b0fb69 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -285,7 +285,7 @@ struct built_in_command { | |||
| 285 | }; | 285 | }; |
| 286 | 286 | ||
| 287 | /* belongs in busybox.h */ | 287 | /* belongs in busybox.h */ |
| 288 | static inline int max(int a, int b) { | 288 | static int max(int a, int b) { |
| 289 | return (a>b)?a:b; | 289 | return (a>b)?a:b; |
| 290 | } | 290 | } |
| 291 | 291 | ||
| @@ -298,8 +298,14 @@ static void debug_printf(const char *format, ...) | |||
| 298 | vfprintf(stderr, format, args); | 298 | vfprintf(stderr, format, args); |
| 299 | va_end(args); | 299 | va_end(args); |
| 300 | } | 300 | } |
| 301 | /* broken, of course, but OK for testing */ | ||
| 302 | static char *indenter(int i) | ||
| 303 | { | ||
| 304 | static char blanks[]=" "; | ||
| 305 | return &blanks[sizeof(blanks)-i-1]; | ||
| 306 | } | ||
| 301 | #else | 307 | #else |
| 302 | static inline void debug_printf(const char *format ATTRIBUTE_UNUSED, ...) { } | 308 | #define debug_printf(...) do {;} while(0); |
| 303 | #endif | 309 | #endif |
| 304 | #define final_printf debug_printf | 310 | #define final_printf debug_printf |
| 305 | 311 | ||
| @@ -345,7 +351,6 @@ static void mark_open(int fd); | |||
| 345 | static void mark_closed(int fd); | 351 | static void mark_closed(int fd); |
| 346 | static void close_all(void); | 352 | static void close_all(void); |
| 347 | /* "run" the final data structures: */ | 353 | /* "run" the final data structures: */ |
| 348 | static char *indenter(int i); | ||
| 349 | static int free_pipe_list(struct pipe *head, int indent); | 354 | static int free_pipe_list(struct pipe *head, int indent); |
| 350 | static int free_pipe(struct pipe *pi, int indent); | 355 | static int free_pipe(struct pipe *pi, int indent); |
| 351 | /* really run the final data structures: */ | 356 | /* really run the final data structures: */ |
| @@ -847,7 +852,7 @@ static int static_peek(struct in_str *i) | |||
| 847 | return *i->p; | 852 | return *i->p; |
| 848 | } | 853 | } |
| 849 | 854 | ||
| 850 | static inline void cmdedit_set_initial_prompt(void) | 855 | static void cmdedit_set_initial_prompt(void) |
| 851 | { | 856 | { |
| 852 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 857 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT |
| 853 | PS1 = NULL; | 858 | PS1 = NULL; |
| @@ -858,7 +863,7 @@ static inline void cmdedit_set_initial_prompt(void) | |||
| 858 | #endif | 863 | #endif |
| 859 | } | 864 | } |
| 860 | 865 | ||
| 861 | static inline void setup_prompt_string(int promptmode, char **prompt_str) | 866 | static void setup_prompt_string(int promptmode, char **prompt_str) |
| 862 | { | 867 | { |
| 863 | debug_printf("setup_prompt_string %d ",promptmode); | 868 | debug_printf("setup_prompt_string %d ",promptmode); |
| 864 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 869 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT |
| @@ -1591,13 +1596,6 @@ static int run_list_real(struct pipe *pi) | |||
| 1591 | return rcode; | 1596 | return rcode; |
| 1592 | } | 1597 | } |
| 1593 | 1598 | ||
| 1594 | /* broken, of course, but OK for testing */ | ||
| 1595 | static char *indenter(int i) | ||
| 1596 | { | ||
| 1597 | static char blanks[]=" "; | ||
| 1598 | return &blanks[sizeof(blanks)-i-1]; | ||
| 1599 | } | ||
| 1600 | |||
| 1601 | /* return code is the exit status of the pipe */ | 1599 | /* return code is the exit status of the pipe */ |
| 1602 | static int free_pipe(struct pipe *pi, int indent) | 1600 | static int free_pipe(struct pipe *pi, int indent) |
| 1603 | { | 1601 | { |
| @@ -1605,29 +1603,28 @@ static int free_pipe(struct pipe *pi, int indent) | |||
| 1605 | struct child_prog *child; | 1603 | struct child_prog *child; |
| 1606 | struct redir_struct *r, *rnext; | 1604 | struct redir_struct *r, *rnext; |
| 1607 | int a, i, ret_code=0; | 1605 | int a, i, ret_code=0; |
| 1608 | char *ind = indenter(indent); | ||
| 1609 | 1606 | ||
| 1610 | if (pi->stopped_progs > 0) | 1607 | if (pi->stopped_progs > 0) |
| 1611 | return ret_code; | 1608 | return ret_code; |
| 1612 | final_printf("%s run pipe: (pid %d)\n",ind,getpid()); | 1609 | final_printf("%s run pipe: (pid %d)\n",indenter(indent),getpid()); |
| 1613 | for (i=0; i<pi->num_progs; i++) { | 1610 | for (i=0; i<pi->num_progs; i++) { |
| 1614 | child = &pi->progs[i]; | 1611 | child = &pi->progs[i]; |
| 1615 | final_printf("%s command %d:\n",ind,i); | 1612 | final_printf("%s command %d:\n",indenter(indent),i); |
| 1616 | if (child->argv) { | 1613 | if (child->argv) { |
| 1617 | for (a=0,p=child->argv; *p; a++,p++) { | 1614 | for (a=0,p=child->argv; *p; a++,p++) { |
| 1618 | final_printf("%s argv[%d] = %s\n",ind,a,*p); | 1615 | final_printf("%s argv[%d] = %s\n",indenter(indent),a,*p); |
| 1619 | } | 1616 | } |
| 1620 | globfree(&child->glob_result); | 1617 | globfree(&child->glob_result); |
| 1621 | child->argv=NULL; | 1618 | child->argv=NULL; |
| 1622 | } else if (child->group) { | 1619 | } else if (child->group) { |
| 1623 | final_printf("%s begin group (subshell:%d)\n",ind, child->subshell); | 1620 | final_printf("%s begin group (subshell:%d)\n",indenter(indent), child->subshell); |
| 1624 | ret_code = free_pipe_list(child->group,indent+3); | 1621 | ret_code = free_pipe_list(child->group,indent+3); |
| 1625 | final_printf("%s end group\n",ind); | 1622 | final_printf("%s end group\n",indenter(indent)); |
| 1626 | } else { | 1623 | } else { |
| 1627 | final_printf("%s (nil)\n",ind); | 1624 | final_printf("%s (nil)\n",indenter(indent)); |
| 1628 | } | 1625 | } |
| 1629 | for (r=child->redirects; r; r=rnext) { | 1626 | for (r=child->redirects; r; r=rnext) { |
| 1630 | final_printf("%s redirect %d%s", ind, r->fd, redir_table[r->type].descrip); | 1627 | final_printf("%s redirect %d%s", indenter(indent), r->fd, redir_table[r->type].descrip); |
| 1631 | if (r->dup == -1) { | 1628 | if (r->dup == -1) { |
| 1632 | /* guard against the case >$FOO, where foo is unset or blank */ | 1629 | /* guard against the case >$FOO, where foo is unset or blank */ |
| 1633 | if (r->word.gl_pathv) { | 1630 | if (r->word.gl_pathv) { |
| @@ -1651,11 +1648,10 @@ static int free_pipe_list(struct pipe *head, int indent) | |||
| 1651 | { | 1648 | { |
| 1652 | int rcode=0; /* if list has no members */ | 1649 | int rcode=0; /* if list has no members */ |
| 1653 | struct pipe *pi, *next; | 1650 | struct pipe *pi, *next; |
| 1654 | char *ind = indenter(indent); | ||
| 1655 | for (pi=head; pi; pi=next) { | 1651 | for (pi=head; pi; pi=next) { |
| 1656 | final_printf("%s pipe reserved mode %d\n", ind, pi->r_mode); | 1652 | final_printf("%s pipe reserved mode %d\n", indenter(indent), pi->r_mode); |
| 1657 | rcode = free_pipe(pi, indent); | 1653 | rcode = free_pipe(pi, indent); |
| 1658 | final_printf("%s pipe followup code %d\n", ind, pi->followup); | 1654 | final_printf("%s pipe followup code %d\n", indenter(indent), pi->followup); |
| 1659 | next=pi->next; | 1655 | next=pi->next; |
| 1660 | pi->next=NULL; | 1656 | pi->next=NULL; |
| 1661 | free(pi); | 1657 | free(pi); |
