diff options
author | Denis Vlasenko | 2006-12-16 23:49:13 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-12-16 23:49:13 +0000 |
commit | 9f739445cd3deddd0343c3a8d5a981ede26bef30 (patch) | |
tree | 6dc013e44d2281eb1e6f61c4bca1ae7546001f79 /shell | |
parent | a597aaddfa76d589d3e1a37b1f1c3401c2decffd (diff) | |
download | busybox-9f739445cd3deddd0343c3a8d5a981ede26bef30.zip busybox-9f739445cd3deddd0343c3a8d5a981ede26bef30.tar.gz |
inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 14 | ||||
-rw-r--r-- | shell/msh.c | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3a9998f..8ba4cb8 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2315,7 +2315,7 @@ cdcmd(int argc, char **argv) dest = *argptr; if (!dest) dest = bltinlookup(homestr); - else if (dest[0] == '-' && dest[1] == '\0') { + else if (LONE_DASH(dest)) { dest = bltinlookup("OLDPWD"); flags |= CD_PRINT; } @@ -8889,7 +8889,7 @@ options(int cmdline) argptr++; if ((c = *p++) == '-') { val = 1; - if (p[0] == '\0' || (p[0] == '-' && p[1] == '\0')) { + if (p[0] == '\0' || LONE_DASH(p)) { if (!cmdline) { /* "-" means turn off -x and -v */ if (p[0] == '\0') @@ -9114,7 +9114,7 @@ atend: goto out; } optnext++; - if (p[0] == '-' && p[1] == '\0') /* check for "--" */ + if (LONE_DASH(p)) /* check for "--" */ goto atend; } @@ -9232,7 +9232,7 @@ nextopt(const char *optstring) if (p == NULL || *p != '-' || *++p == '\0') return '\0'; argptr++; - if (p[0] == '-' && p[1] == '\0') /* check for "--" */ + if (LONE_DASH(p)) /* check for "--" */ return '\0'; } c = *p++; @@ -9825,7 +9825,7 @@ void fixredir(union node *n, const char *text, int err) if (is_digit(text[0]) && text[1] == '\0') n->ndup.dupfd = digit_val(text[0]); - else if (text[0] == '-' && text[1] == '\0') + else if (LONE_DASH(text)) n->ndup.dupfd = -1; else { @@ -11650,7 +11650,7 @@ trapcmd(int argc, char **argv) sh_error("%s: bad trap", *ap); INTOFF; if (action) { - if (action[0] == '-' && action[1] == '\0') + if (LONE_DASH(action)) action = NULL; else action = savestr(action); @@ -12257,7 +12257,7 @@ static void mklocal(char *name) INTOFF; lvp = ckmalloc(sizeof (struct localvar)); - if (name[0] == '-' && name[1] == '\0') { + if (LONE_DASH(name)) { char *p; p = ckmalloc(sizeof(optlist)); lvp->text = memcpy(p, optlist, sizeof(optlist)); diff --git a/shell/msh.c b/shell/msh.c index 492d3cf..45ca3df 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -1001,7 +1001,7 @@ static int newfile(char *s) DBGPRINTF7(("NEWFILE: opening %s\n", s)); - if (strcmp(s, "-") != 0) { + if (NOT_LONE_DASH(s)) { DBGPRINTF(("NEWFILE: s is %s\n", s)); f = open(s, 0); if (f < 0) { |