summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-10-19 17:15:54 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-10-19 17:15:54 +0000
commit64fa183c33371ced802d3cd40d8c4298d329e303 (patch)
tree550243879c1bc44e080da1f86da31449acbafa15
parent430e097c01f714dd0dd3e60cc912856d6421c0b8 (diff)
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@
-rw-r--r--bin/ksh/eval.c6
-rw-r--r--bin/ksh/misc.c6
-rw-r--r--bin/ksh/sh.h3
3 files changed, 7 insertions, 8 deletions
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()) */