/[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 419 by ph10, Wed Aug 12 10:45:33 2009 UTC revision 420 by ph10, Wed Aug 12 17:32:27 2009 UTC
# Line 83  typedef int BOOL; Line 83  typedef int BOOL;
83  output. The order is important; it is assumed that a file name is wanted for  output. The order is important; it is assumed that a file name is wanted for
84  all values greater than FN_DEFAULT. */  all values greater than FN_DEFAULT. */
85    
86  enum { FN_NONE, FN_DEFAULT, FN_ONLY, FN_NOMATCH_ONLY, FN_FORCE };  enum { FN_NONE, FN_DEFAULT, FN_MATCH_ONLY, FN_NOMATCH_ONLY, FN_FORCE };
87    
88  /* File reading styles */  /* File reading styles */
89    
# Line 165  static BOOL invert = FALSE; Line 165  static BOOL invert = FALSE;
165  static BOOL line_offsets = FALSE;  static BOOL line_offsets = FALSE;
166  static BOOL multiline = FALSE;  static BOOL multiline = FALSE;
167  static BOOL number = FALSE;  static BOOL number = FALSE;
168    static BOOL omit_zero_count = FALSE;
169  static BOOL only_matching = FALSE;  static BOOL only_matching = FALSE;
170  static BOOL quiet = FALSE;  static BOOL quiet = FALSE;
171  static BOOL silent = FALSE;  static BOOL silent = FALSE;
# Line 1061  while (ptr < endptr) Line 1062  while (ptr < endptr)
1062      /* If all we want is a file name, there is no need to scan any more lines      /* If all we want is a file name, there is no need to scan any more lines
1063      in the file. */      in the file. */
1064    
1065      else if (filenames == FN_ONLY)      else if (filenames == FN_MATCH_ONLY)
1066        {        {
1067        fprintf(stdout, "%s\n", printname);        fprintf(stdout, "%s\n", printname);
1068        return 0;        return 0;
# Line 1365  if (filenames == FN_NOMATCH_ONLY) Line 1366  if (filenames == FN_NOMATCH_ONLY)
1366    
1367  if (count_only)  if (count_only)
1368    {    {
1369    if (printname != NULL) fprintf(stdout, "%s:", printname);    if (count > 0 || !omit_zero_count)
1370    fprintf(stdout, "%d\n", count);      {
1371        if (printname != NULL && filenames != FN_NONE)
1372          fprintf(stdout, "%s:", printname);
1373        fprintf(stdout, "%d\n", count);
1374        }
1375    }    }
1376    
1377  return rc;  return rc;
# Line 1686  switch(letter) Line 1691  switch(letter)
1691    case 'H': filenames = FN_FORCE; break;    case 'H': filenames = FN_FORCE; break;
1692    case 'h': filenames = FN_NONE; break;    case 'h': filenames = FN_NONE; break;
1693    case 'i': options |= PCRE_CASELESS; break;    case 'i': options |= PCRE_CASELESS; break;
1694    case 'l': filenames = FN_ONLY; break;    case 'l': omit_zero_count = TRUE; filenames = FN_MATCH_ONLY; break;
1695    case 'L': filenames = FN_NOMATCH_ONLY; break;    case 'L': filenames = FN_NOMATCH_ONLY; break;
1696    case 'M': multiline = TRUE; options |= PCRE_MULTILINE|PCRE_FIRSTLINE; break;    case 'M': multiline = TRUE; options |= PCRE_MULTILINE|PCRE_FIRSTLINE; break;
1697    case 'n': number = TRUE; break;    case 'n': number = TRUE; break;

Legend:
Removed from v.419  
changed lines
  Added in v.420

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12