/[pcre]/code/trunk/pcregrep.c
ViewVC logotype

Diff of /code/trunk/pcregrep.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 149 by ph10, Mon Apr 16 15:28:08 2007 UTC revision 151 by ph10, Tue Apr 17 15:07:29 2007 UTC
# Line 280  for (;;) Line 280  for (;;)
280    if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0)    if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0)
281      return dent->d_name;      return dent->d_name;
282    }    }
283  return NULL;   /* Keep compiler happy; never executed */  /* Control never reaches here */
284  }  }
285    
286  static void  static void
# Line 580  switch(endlinetype) Line 580  switch(endlinetype)
580          }          }
581        else *lenptr = 1;        else *lenptr = 1;
582        return p;        return p;
583    
584        default:        default:
585        break;        break;
586        }        }
587      }   /* End of loop for ANYCRLF case */      }   /* End of loop for ANYCRLF case */
588    
589    *lenptr = 0;  /* Must have hit the end */    *lenptr = 0;  /* Must have hit the end */
590    return endptr;    return endptr;
591    
# Line 687  switch(endlinetype) Line 687  switch(endlinetype)
687    return p;   /* But control should never get here */    return p;   /* But control should never get here */
688    
689    case EL_ANY:    case EL_ANY:
690    case EL_ANYCRLF:    case EL_ANYCRLF:
691    if (*(--p) == '\n' && p > startptr && p[-1] == '\r') p--;    if (*(--p) == '\n' && p > startptr && p[-1] == '\r') p--;
692    if (utf8) while ((*p & 0xc0) == 0x80) p--;    if (utf8) while ((*p & 0xc0) == 0x80) p--;
693    
# Line 721  switch(endlinetype) Line 721  switch(endlinetype)
721        case 0x0a:    /* LF */        case 0x0a:    /* LF */
722        case 0x0d:    /* CR */        case 0x0d:    /* CR */
723        return p;        return p;
724    
725        default:        default:
726        break;        break;
727        }        }
728    
729      else switch (c)      else switch (c)
730        {        {
# Line 1525  if ((process_options & PO_FIXED_STRINGS) Line 1525  if ((process_options & PO_FIXED_STRINGS)
1525      char *p = end_of_line(pattern, eop, &ellength);      char *p = end_of_line(pattern, eop, &ellength);
1526      if (ellength == 0)      if (ellength == 0)
1527        return compile_single_pattern(pattern, options, filename, count);        return compile_single_pattern(pattern, options, filename, count);
1528      sprintf(buffer, "%.*s", p - pattern - ellength, pattern);      sprintf(buffer, "%.*s", (int)(p - pattern - ellength), pattern);
1529      pattern = p;      pattern = p;
1530      if (!compile_single_pattern(buffer, options, filename, count))      if (!compile_single_pattern(buffer, options, filename, count))
1531        return FALSE;        return FALSE;
# Line 1567  switch(i) Line 1567  switch(i)
1567    case '\r':               newline = (char *)"cr"; break;    case '\r':               newline = (char *)"cr"; break;
1568    case ('\r' << 8) | '\n': newline = (char *)"crlf"; break;    case ('\r' << 8) | '\n': newline = (char *)"crlf"; break;
1569    case -1:                 newline = (char *)"any"; break;    case -1:                 newline = (char *)"any"; break;
1570    case -2:                 newline = (char *)"anycrlf"; break;    case -2:                 newline = (char *)"anycrlf"; break;
1571    }    }
1572    
1573  /* Process the options */  /* Process the options */
# Line 1644  for (i = 1; i < argc; i++) Line 1644  for (i = 1; i < argc; i++)
1644          char buff2[24];          char buff2[24];
1645          int baselen = opbra - op->long_name;          int baselen = opbra - op->long_name;
1646          sprintf(buff1, "%.*s", baselen, op->long_name);          sprintf(buff1, "%.*s", baselen, op->long_name);
1647          sprintf(buff2, "%s%.*s", buff1, strlen(op->long_name) - baselen - 2,          sprintf(buff2, "%s%.*s", buff1,
1648            opbra + 1);            (int)strlen(op->long_name) - baselen - 2, opbra + 1);
1649          if (strcmp(arg, buff1) == 0 || strcmp(arg, buff2) == 0)          if (strcmp(arg, buff1) == 0 || strcmp(arg, buff2) == 0)
1650            break;            break;
1651          }          }

Legend:
Removed from v.149  
changed lines
  Added in v.151

  ViewVC Help
Powered by ViewVC 1.1.5