=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/m4/gnum4.c,v retrieving revision 1.13 retrieving revision 1.14 diff -c -r1.13 -r1.14 *** src/usr.bin/m4/gnum4.c 2001/09/27 12:35:20 1.13 --- src/usr.bin/m4/gnum4.c 2001/09/28 00:46:02 1.14 *************** *** 1,4 **** ! /* $OpenBSD: gnum4.c,v 1.13 2001/09/27 12:35:20 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie --- 1,4 ---- ! /* $OpenBSD: gnum4.c,v 1.14 2001/09/28 00:46:02 espie Exp $ */ /* * Copyright (c) 1999 Marc Espie *************** *** 207,212 **** --- 207,213 ---- static void do_regexp __P((const char *, regex_t *, const char *, regmatch_t *)); static void add_sub __P((int, const char *, regex_t *, regmatch_t *)); static void add_replace __P((const char *, regex_t *, const char *, regmatch_t *)); + #define addconstantstring(s) addchars((s), sizeof(s)-1) static void addchars(c, n) *************** *** 419,430 **** { /* This could use strcspn for speed... */ while (*p != '\0') { ! if (*p == '\\' && (p[1] == '(' || p[1] == ')')) { ! addchar(p[1]); p+=2; continue; } ! if (*p == '(' || *p == ')') addchar('\\'); addchar(*p); --- 420,452 ---- { /* This could use strcspn for speed... */ while (*p != '\0') { ! if (*p == '\\') { ! switch(p[1]) { ! case '(': ! case ')': ! case '|': ! addchar(p[1]); ! break; ! case 'w': ! addconstantstring("[_a-zA-Z0-9]"); ! break; ! case 'W': ! addconstantstring("[^_a-zA-Z0-9]"); ! break; ! case '<': ! addconstantstring("[[:<:]]"); ! break; ! case '>': ! addconstantstring("[[:>:]]"); ! break; ! default: ! addchars(p, 2); ! break; ! } p+=2; continue; } ! if (*p == '(' || *p == ')' || *p == '|') addchar('\\'); addchar(*p);