[BACK]Return to gnum4.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / m4

Diff for /src/usr.bin/m4/gnum4.c between version 1.13 and 1.14

version 1.13, 2001/09/27 12:35:20 version 1.14, 2001/09/28 00:46:02
Line 207 
Line 207 
 static void do_regexp __P((const char *, regex_t *, const char *, regmatch_t *));  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_sub __P((int, const char *, regex_t *, regmatch_t *));
 static void add_replace __P((const char *, regex_t *, const char *, 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  static void
 addchars(c, n)  addchars(c, n)
Line 419 
Line 420 
 {  {
         /* This could use strcspn for speed... */          /* This could use strcspn for speed... */
         while (*p != '\0') {          while (*p != '\0') {
                 if (*p == '\\' && (p[1] == '(' || p[1] == ')')) {                  if (*p == '\\') {
                         addchar(p[1]);                          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;                          p+=2;
                         continue;                          continue;
                 }                  }
                 if (*p == '(' || *p == ')')                  if (*p == '(' || *p == ')' || *p == '|')
                         addchar('\\');                          addchar('\\');
   
                 addchar(*p);                  addchar(*p);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14