From: mmcc Date: Mon, 19 Oct 2015 17:15:53 +0000 (+0000) Subject: Remove the define NOT, replace it with '!'. No binary change. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cff6084900b80ba0a12236432e3879ee369ac49c;p=openbsd Remove the define NOT, replace it with '!'. No binary change. "The ^ is used in regular expressions and many versions of fnmatch(3) accept both ! and ^. However, we are never going to accept ^ instead of ! so I think this makes sense" -millert@ "go for it" -nicm@ --- diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c index c19758c919b..3dd83a9f4cb 100644 --- a/bin/ksh/eval.c +++ b/bin/ksh/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.45 2015/10/19 14:42:16 mmcc Exp $ */ +/* $OpenBSD: eval.c,v 1.46 2015/10/19 17:15:53 mmcc Exp $ */ /* * Expansion - quoting, separation, substitution, globbing @@ -603,7 +603,7 @@ expand(char *cp, /* input word */ if (!quote) switch (c) { case '[': - case NOT: + case '!': case '-': case ']': /* For character classes - doesn't hurt @@ -1126,7 +1126,7 @@ copy_non_glob(XString *xs, char **xpp, char *p) if (*p == '[') { char *q = p + 1; - if (ISMAGIC(*q) && q[1] == NOT) + if (ISMAGIC(*q) && q[1] == '!') q += 2; if (ISMAGIC(*q) && q[1] == ']') q += 2; diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index c7e5537c458..7e23257007b 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.49 2015/10/19 14:42:16 mmcc Exp $ */ +/* $OpenBSD: misc.c,v 1.50 2015/10/19 17:15:53 mmcc Exp $ */ /* * Miscellaneous functions @@ -548,7 +548,7 @@ has_globbing(const char *xp, const char *xpe) if (!in_bracket) { saw_glob = 1; in_bracket = 1; - if (ISMAGIC(p[1]) && p[2] == NOT) + if (ISMAGIC(p[1]) && p[2] == '!') p += 2; if (ISMAGIC(p[1]) && p[2] == ']') p += 2; @@ -740,7 +740,7 @@ cclass(const unsigned char *p, int sub) int c, d, rv, not, found = 0; const unsigned char *orig_p = p; - if ((not = (ISMAGIC(*p) && *++p == NOT))) + if ((not = (ISMAGIC(*p) && *++p == '!'))) p++; do { /* check for POSIX character class (e.g. [[:alpha:]]) */ diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index cb8b39e47e3..d7681607ead 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.45 2015/10/19 17:10:53 mmcc Exp $ */ +/* $OpenBSD: sh.h,v 1.46 2015/10/19 17:15:53 mmcc Exp $ */ /* * Public Domain Bourne/Korn shell @@ -50,7 +50,6 @@ */ #define MAGIC (7) /* prefix for *?[!{,} during expand */ #define ISMAGIC(c) ((unsigned char)(c) == MAGIC) -#define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */ #define LINE 2048 /* input line size */ #define PATH 1024 /* pathname size (todo: PATH_MAX/pathconf()) */