diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-23 01:04:37 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-02-23 01:04:37 +0000 |
commit | 79702e13b401e175c385384c51c5b8524370d227 (patch) | |
tree | 4e5c348858fb468f17e70d20803378f225098429 /shell | |
parent | 2d9c143561b6cc2acdd6b48ac1ca358f0feca2a5 (diff) | |
download | busybox-w32-79702e13b401e175c385384c51c5b8524370d227.tar.gz busybox-w32-79702e13b401e175c385384c51c5b8524370d227.tar.bz2 busybox-w32-79702e13b401e175c385384c51c5b8524370d227.zip |
ash: cleanup part 3
git-svn-id: svn://busybox.net/trunk/busybox@17955 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 88 |
1 files changed, 46 insertions, 42 deletions
diff --git a/shell/ash.c b/shell/ash.c index 731b07996..3107181a6 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -1190,9 +1190,9 @@ varcmp(const char *p, const char *q) | |||
1190 | q++; | 1190 | q++; |
1191 | } | 1191 | } |
1192 | if (c == '=') | 1192 | if (c == '=') |
1193 | c = 0; | 1193 | c = '\0'; |
1194 | if (d == '=') | 1194 | if (d == '=') |
1195 | d = 0; | 1195 | d = '\0'; |
1196 | out: | 1196 | out: |
1197 | return c - d; | 1197 | return c - d; |
1198 | } | 1198 | } |
@@ -1469,7 +1469,8 @@ listsetvar(struct strlist *list_set_var, int flags) | |||
1469 | INT_OFF; | 1469 | INT_OFF; |
1470 | do { | 1470 | do { |
1471 | setvareq(lp->text, flags); | 1471 | setvareq(lp->text, flags); |
1472 | } while ((lp = lp->next)); | 1472 | lp = lp->next; |
1473 | } while (lp); | ||
1473 | INT_ON; | 1474 | INT_ON; |
1474 | } | 1475 | } |
1475 | 1476 | ||
@@ -3790,7 +3791,8 @@ parse_command_args(char **argv, const char **path) | |||
3790 | /* run 'typecmd' for other options */ | 3791 | /* run 'typecmd' for other options */ |
3791 | return 0; | 3792 | return 0; |
3792 | } | 3793 | } |
3793 | } while ((c = *cp++)); | 3794 | c = *cp++; |
3795 | } while (c); | ||
3794 | } | 3796 | } |
3795 | return argv; | 3797 | return argv; |
3796 | } | 3798 | } |
@@ -6025,49 +6027,51 @@ ifsbreakup(char *string, struct arglist *arglist) | |||
6025 | q = p; | 6027 | q = p; |
6026 | if (*p == CTLESC) | 6028 | if (*p == CTLESC) |
6027 | p++; | 6029 | p++; |
6028 | if (strchr(ifs, *p)) { | 6030 | if (!strchr(ifs, *p)) { |
6029 | if (!nulonly) | ||
6030 | ifsspc = (strchr(defifs, *p) != NULL); | ||
6031 | /* Ignore IFS whitespace at start */ | ||
6032 | if (q == start && ifsspc) { | ||
6033 | p++; | ||
6034 | start = p; | ||
6035 | continue; | ||
6036 | } | ||
6037 | *q = '\0'; | ||
6038 | sp = stalloc(sizeof(*sp)); | ||
6039 | sp->text = start; | ||
6040 | *arglist->lastp = sp; | ||
6041 | arglist->lastp = &sp->next; | ||
6042 | p++; | 6031 | p++; |
6043 | if (!nulonly) { | 6032 | continue; |
6044 | for (;;) { | 6033 | } |
6045 | if (p >= string + ifsp->endoff) { | 6034 | if (!nulonly) |
6046 | break; | 6035 | ifsspc = (strchr(defifs, *p) != NULL); |
6047 | } | 6036 | /* Ignore IFS whitespace at start */ |
6048 | q = p; | 6037 | if (q == start && ifsspc) { |
6049 | if (*p == CTLESC) | 6038 | p++; |
6039 | start = p; | ||
6040 | continue; | ||
6041 | } | ||
6042 | *q = '\0'; | ||
6043 | sp = stalloc(sizeof(*sp)); | ||
6044 | sp->text = start; | ||
6045 | *arglist->lastp = sp; | ||
6046 | arglist->lastp = &sp->next; | ||
6047 | p++; | ||
6048 | if (!nulonly) { | ||
6049 | for (;;) { | ||
6050 | if (p >= string + ifsp->endoff) { | ||
6051 | break; | ||
6052 | } | ||
6053 | q = p; | ||
6054 | if (*p == CTLESC) | ||
6055 | p++; | ||
6056 | if (strchr(ifs, *p) == NULL ) { | ||
6057 | p = q; | ||
6058 | break; | ||
6059 | } else if (strchr(defifs, *p) == NULL) { | ||
6060 | if (ifsspc) { | ||
6050 | p++; | 6061 | p++; |
6051 | if (strchr(ifs, *p) == NULL ) { | 6062 | ifsspc = 0; |
6063 | } else { | ||
6052 | p = q; | 6064 | p = q; |
6053 | break; | 6065 | break; |
6054 | } else if (strchr(defifs, *p) == NULL) { | 6066 | } |
6055 | if (ifsspc) { | 6067 | } else |
6056 | p++; | 6068 | p++; |
6057 | ifsspc = 0; | ||
6058 | } else { | ||
6059 | p = q; | ||
6060 | break; | ||
6061 | } | ||
6062 | } else | ||
6063 | p++; | ||
6064 | } | ||
6065 | } | 6069 | } |
6066 | start = p; | 6070 | } |
6067 | } else | 6071 | start = p; |
6068 | p++; | 6072 | } /* while */ |
6069 | } | 6073 | ifsp = ifsp->next; |
6070 | } while ((ifsp = ifsp->next) != NULL); | 6074 | } while (ifsp != NULL); |
6071 | if (nulonly) | 6075 | if (nulonly) |
6072 | goto add; | 6076 | goto add; |
6073 | } | 6077 | } |