diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-07 10:26:19 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-07 10:26:19 +0000 |
commit | 17fda26c6c08149fb33f218c16f2315439b11fba (patch) | |
tree | 62a69f824c5e36d96e0a6846216359ec62fb3c17 | |
parent | 2425e7927173805fe31f4a52ea1604784e85bddf (diff) |
twiddle + at start of regexp.
-rw-r--r-- | usr.bin/m4/gnum4.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/m4/gnum4.c b/usr.bin/m4/gnum4.c index 7420c5bf888..568df93bef7 100644 --- a/usr.bin/m4/gnum4.c +++ b/usr.bin/m4/gnum4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gnum4.c,v 1.27 2003/11/22 11:51:52 espie Exp $ */ +/* $OpenBSD: gnum4.c,v 1.28 2004/11/07 10:26:18 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie @@ -384,6 +384,14 @@ do_regexpindex(const char *string, regex_t *re, regmatch_t *pm) static char * twiddle(const char *p) { + /* + at start of regexp is a normal character for Gnu m4 */ + if (*p == '^') { + addchar(*p); + p++; + } + if (*p == '+') { + addchar('\\'); + } /* This could use strcspn for speed... */ while (*p != '\0') { if (*p == '\\') { |