diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-16 23:49:13 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-16 23:49:13 +0000 |
commit | 9f739445cd3deddd0343c3a8d5a981ede26bef30 (patch) | |
tree | 6dc013e44d2281eb1e6f61c4bca1ae7546001f79 /shell/ash.c | |
parent | a597aaddfa76d589d3e1a37b1f1c3401c2decffd (diff) |
inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3a9998fc0..8ba4cb8a0 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)); |