/[pcre]/code/tags/pcre-8.01/pcregrep.c
ViewVC logotype

Diff of /code/tags/pcre-8.01/pcregrep.c

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

revision 286 by ph10, Mon Dec 17 14:46:11 2007 UTC revision 324 by ph10, Fri Mar 7 19:48:32 2008 UTC
# Line 6  Line 6 
6  its pattern matching. On a Unix or Win32 system it can recurse into  its pattern matching. On a Unix or Win32 system it can recurse into
7  directories.  directories.
8    
9             Copyright (c) 1997-2007 University of Cambridge             Copyright (c) 1997-2008 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 1383  if ((sep = isdirectory(pathname)) != 0) Line 1383  if ((sep = isdirectory(pathname)) != 0)
1383    
1384      while ((nextfile = readdirectory(dir)) != NULL)      while ((nextfile = readdirectory(dir)) != NULL)
1385        {        {
1386        int frc, blen;        int frc, nflen;
1387        sprintf(buffer, "%.512s%c%.128s", pathname, sep, nextfile);        sprintf(buffer, "%.512s%c%.128s", pathname, sep, nextfile);
1388        blen = strlen(buffer);        nflen = strlen(nextfile);
1389    
1390        if (exclude_compiled != NULL &&        if (!isdirectory(buffer))
1391            pcre_exec(exclude_compiled, NULL, buffer, blen, 0, 0, NULL, 0) >= 0)          {
1392          continue;          if (exclude_compiled != NULL &&
1393                pcre_exec(exclude_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) >= 0)
1394        if (include_compiled != NULL &&            continue;
1395            pcre_exec(include_compiled, NULL, buffer, blen, 0, 0, NULL, 0) < 0)  
1396          continue;          if (include_compiled != NULL &&
1397                pcre_exec(include_compiled, NULL, nextfile, nflen, 0, 0, NULL, 0) < 0)
1398              continue;
1399            }
1400    
1401        frc = grep_or_recurse(buffer, dir_recurse, FALSE);        frc = grep_or_recurse(buffer, dir_recurse, FALSE);
1402        if (frc > 1) rc = frc;        if (frc > 1) rc = frc;
# Line 1579  for (op = optionlist; op->one_char != 0; Line 1582  for (op = optionlist; op->one_char != 0;
1582    int n;    int n;
1583    char s[4];    char s[4];
1584    if (op->one_char > 0) sprintf(s, "-%c,", op->one_char); else strcpy(s, "   ");    if (op->one_char > 0) sprintf(s, "-%c,", op->one_char); else strcpy(s, "   ");
1585    printf("  %s --%s%n", s, op->long_name, &n);    n = 30 - printf("  %s --%s", s, op->long_name);
   n = 30 - n;  
1586    if (n < 1) n = 1;    if (n < 1) n = 1;
1587    printf("%.*s%s\n", n, "                    ", op->help_text);    printf("%.*s%s\n", n, "                    ", op->help_text);
1588    }    }

Legend:
Removed from v.286  
changed lines
  Added in v.324

  ViewVC Help
Powered by ViewVC 1.1.5