drop use of the NOT macro, [^foo] ≠ [!foo] anyway, and we’re not gonna change that

This commit is contained in:
tg 2012-03-23 20:07:13 +00:00
parent c5cc22a13f
commit 3795e667c5
4 changed files with 8 additions and 9 deletions

4
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.111 2011/12/16 20:03:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.112 2012/03/23 20:07:10 tg Exp $");
/*
* string expansion
@ -896,7 +896,7 @@ expand(const char *cp, /* input word */
if (!quote)
switch (c) {
case '[':
case NOT:
case '!':
case '-':
case ']':
/*

6
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.182 2012/01/04 22:38:33 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.183 2012/03/23 20:07:11 tg Exp $");
/* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1];
@ -645,7 +645,7 @@ has_globbing(const char *xp, const char *xpe)
if (!in_bracket) {
saw_glob = true;
in_bracket = true;
if (ISMAGIC(p[1]) && p[2] == NOT)
if (ISMAGIC(p[1]) && p[2] == '!')
p += 2;
if (ISMAGIC(p[1]) && p[2] == ']')
p += 2;
@ -824,7 +824,7 @@ cclass(const unsigned char *p, int sub)
int c, d, notp, found = 0;
const unsigned char *orig_p = p;
if ((notp = (ISMAGIC(*p) && *++p == NOT)))
if ((notp = (ISMAGIC(*p) && *++p == '!')))
p++;
do {
c = *p++;

3
sh.h
View File

@ -152,7 +152,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.523 2012/03/23 19:38:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.524 2012/03/23 20:07:11 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/03/03"
@ -374,7 +374,6 @@ extern int wcwidth(__WCHAR_TYPE__);
*/
#define MAGIC (7) /* prefix for *?[!{,} during expand */
#define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
#define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */
#define LINE 4096 /* input line size */

4
tree.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.56 2012/02/06 17:42:24 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.57 2012/03/23 20:07:13 tg Exp $");
#define INDENT 8
@ -291,7 +291,7 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode)
case CHAR:
c = *wp++;
if ((opmode & WDS_MAGIC) &&
(ISMAGIC(c) || c == '[' || c == NOT ||
(ISMAGIC(c) || c == '[' || c == '!' ||
c == '-' || c == ']' || c == '*' || c == '?'))
shf_putc(MAGIC, shf);
shf_putc(c, shf);