[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.10 and 1.11

version 1.10, 2001/09/16 21:08:55 version 1.11, 2001/09/18 13:42:37
Line 336 
Line 336 
         regmatch_t *pm;          regmatch_t *pm;
 {  {
         int error;          int error;
         regoff_t last_match = -1;          int flags = 0;
           const char *last_match = NULL;
   
         while ((error = regexec(re, string, re->re_nsub+1, pm, 0)) == 0) {          while ((error = regexec(re, string, re->re_nsub+1, pm, flags)) == 0) {
                   flags = REG_NOTBOL;
   
                 /* NULL length matches are special... We use the `vi-mode'                  /* NULL length matches are special... We use the `vi-mode'
                  * rule: don't allow a NULL-match at the last match                   * rule: don't allow a NULL-match at the last match
                  * position.                   * position.
                  */                   */
                 if (pm[0].rm_so == pm[0].rm_eo && pm[0].rm_so == last_match) {                  if (pm[0].rm_so == pm[0].rm_eo &&
                       string + pm[0].rm_so == last_match) {
                         if (*string == '\0')                          if (*string == '\0')
                                 return;                                  return;
                         addchar(*string);                          addchar(*string);
                         string++;                          string++;
                         continue;                          continue;
                 }                  }
                 last_match = pm[0].rm_so;                  last_match = string + pm[0].rm_so;
                 addchars(string, last_match);                  addchars(string, pm[0].rm_so);
                 add_replace(string, re, replace, pm);                  add_replace(string, re, replace, pm);
                 string += pm[0].rm_eo;                  string += pm[0].rm_eo;
         }          }
Line 444 
Line 447 
                 return;                  return;
         }          }
         error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],          error = regcomp(&re, mimic_gnu ? twiddle(argv[3]) : argv[3],
             REG_EXTENDED);              REG_NEWLINE | REG_EXTENDED);
         if (error != 0)          if (error != 0)
                 exit_regerror(error, &re);                  exit_regerror(error, &re);
   

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11