@@ -1580,7 +1580,7 @@ pmatch(const char *pattern, const char *string)
startp = p;
invert = 0;
- if (*p == '!') {
+ if (*p == '!' || *p == '^') {
invert++;
p++;
}
@@ -1694,11 +1694,8 @@ _rmescapes(char *str, int flag)
notescaped ^= globbing;
goto copy;
}
- if (FNMATCH_IS_ENABLED && *p == '^')
- goto add_escape;
if (*p == (char)CTLESC) {
p++;
-add_escape:
if (notescaped)
*q++ = '\\';
else if (inquotes) {
@@ -178,14 +178,14 @@ main(int argc, char **argv)
add("$", "CVAR");
add("}", "CENDVAR");
/* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
- add("!*?[=~:/-]", "CCTL");
+ add("^!*?[=~:/-]", "CCTL");
print("dqsyntax");
init();
fputs("\n/* syntax table used when in single quotes */\n", cfile);
add("\n", "CNL");
add("'", "CENDQUOTE");
/* ':/' for tilde expansion, '-' for [a\-x] pattern ranges */
- add("!*?[=~:/-]\\", "CCTL");
+ add("^!*?[=~:/-]\\", "CCTL");
print("sqsyntax");
init();
fputs("\n/* syntax table used when in arithmetic */\n", cfile);
@@ -64,9 +64,6 @@ const char dolatstr[] = { CTLQUOTEMARK, CTLVAR, VSNORMAL | VSBIT, '@', '=',
CTLQUOTEMARK, '\0' };
const char cqchars[] = {
'\\',
-#ifdef HAVE_FNMATCH
- '^',
-#endif
CTLESC, CTLQUOTEMARK, 0
};
const char illnum[] = "Illegal number: %s";
@@ -54,7 +54,7 @@ extern const char spcstr[];
extern const char dolatstr[];
#define DOLATSTRLEN 6
extern const char cqchars[];
-#define qchars (cqchars + FNMATCH_IS_ENABLED + 1)
+#define qchars (cqchars + 1)
extern const char illnum[];
extern const char homestr[];
Rather than making dash bigger by actively excluding carets when fnmatch is enabled, add caret support when fnmatch is disabled. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --- src/expand.c | 5 +---- src/mksyntax.c | 4 ++-- src/mystring.c | 3 --- src/mystring.h | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-)