A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/pcre2grep_8c_source.html below:

NCBI C++ ToolKit: src/util/regexp/pcre2grep.c Source File

58 #include <sys/types.h> 61 #if (defined _WIN32 || (defined HAVE_WINDOWS_H && HAVE_WINDOWS_H)) \ 62  && !defined WIN32 && !defined(__CYGWIN__) 67 #if defined(__CYGWIN__) && defined(WIN32) 82 #if defined(SUPPORT_PCRE2GREP_CALLOUT) && defined(SUPPORT_PCRE2GREP_CALLOUT_FORK) 102 #define PCRE2_CODE_UNIT_WIDTH 8 109 #if defined(_MSC_VER) && (_MSC_VER < 1900) 110 #define snprintf _snprintf 116 #if defined(DISABLE_PERCENT_ZT) || (defined(_MSC_VER) && (_MSC_VER < 1800)) || \ 117  (!defined(_MSC_VER) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)) 119 #define SIZ_FORM "llu" 121 #define SIZ_FORM "lu" 124 #define SIZ_FORM "zu" 132 #define DEFAULT_CAPTURE_MAX 50 135 #define MAXPATLEN BUFSIZ 137 #define MAXPATLEN 8192 140 #define FNBUFSIZ 2048 141 #define ERRBUFSIZ 256 160 #define PO_WORD_MATCH 0x0001 161 #define PO_LINE_MATCH 0x0002 162 #define PO_FIXED_STRINGS 0x0004 178 #define FWRITE_IGNORE(a,b,c,d) if (fwrite(a,b,c,d)) {} 187 #define STDOUT_NL "\r\n" 188 #define STDOUT_NL_LEN 2 191 #define STDOUT_NL "\n" 192 #define STDOUT_NL_LEN 1 200 #define STDOUT_NL_CODE 0x7fffffffu 249 #ifdef SUPPORT_PCRE2GREP_JIT 384 static const char

*

incexname

[4] = {

"--include"

,

"--exclude"

,

385  "--include-dir"

,

"--exclude-dir"

};

403 #define N_COLOUR (-1) 404 #define N_EXCLUDE (-2) 405 #define N_EXCLUDE_DIR (-3) 407 #define N_INCLUDE (-5) 408 #define N_INCLUDE_DIR (-6) 410 #define N_LOCALE (-8) 412 #define N_LOFFSETS (-10) 413 #define N_FOFFSETS (-11) 414 #define N_LBUFFER (-12) 415 #define N_H_LIMIT (-13) 416 #define N_M_LIMIT (-14) 417 #define N_M_LIMIT_DEP (-15) 418 #define N_BUFSIZE (-16) 419 #define N_NOJIT (-17) 420 #define N_FILE_LIST (-18) 421 #define N_BINARY_FILES (-19) 422 #define N_EXCLUDE_FROM (-20) 423 #define N_INCLUDE_FROM (-21) 424 #define N_OM_SEPARATOR (-22) 425 #define N_MAX_BUFSIZE (-23) 426 #define N_OM_CAPTURE (-24) 427 #define N_ALLABSK (-25) 428 #define N_POSIX_DIGIT (-26) 429 #define N_GROUP_SEPARATOR (-27) 430 #define N_NO_GROUP_SEPARATOR (-28) 436

{

OP_NODATA

,

'a'

,

NULL

,

"text"

,

"treat binary files as text"

},

443

{

OP_NUMBER

,

'C'

, &

both_context

,

"context=number"

,

"set number of context lines, before & after"

},

444

{

OP_NODATA

,

'c'

,

NULL

,

"count"

,

"print only a count of matching lines per FILE"

},

445

{

OP_STRING

,

'D'

, &

DEE_option

,

"devices=action"

,

"how to handle devices, FIFOs, and sockets"

},

448

{

OP_NODATA

,

'E'

,

NULL

,

"case-restrict"

,

"restrict case matching (no mix ASCII/non-ASCII)"

},

450

{

OP_NODATA

,

'F'

,

NULL

,

"fixed-strings"

,

"patterns are sets of newline-separated strings"

},

455

{

OP_NODATA

,

'H'

,

NULL

,

"with-filename"

,

"force the prefixing filename on output"

},

456

{

OP_NODATA

,

'h'

,

NULL

,

"no-filename"

,

"suppress the prefixing filename on output"

},

457

{

OP_NODATA

,

'I'

,

NULL

,

""

,

"treat binary files as not matching (ignore)"

},

458

{

OP_NODATA

,

'i'

,

NULL

,

"ignore-case"

,

"ignore case distinctions"

},

459

{

OP_NODATA

,

'l'

,

NULL

,

"files-with-matches"

,

"print only FILE names containing matches"

},

460

{

OP_NODATA

,

'L'

,

NULL

,

"files-without-match"

,

"print only FILE names not containing matches"

},

469

{

OP_NODATA

,

'M'

,

NULL

,

"multiline"

,

"run in multiline mode"

},

471

{

OP_STRING

,

'N'

, &

newline_arg

,

"newline=type"

,

"set newline type (CR, LF, CRLF, ANYCRLF, ANY, or NUL)"

},

472

{

OP_NODATA

,

'n'

,

NULL

,

"line-number"

,

"print line number with output lines"

},

473 #ifdef SUPPORT_PCRE2GREP_JIT 479

{

OP_STRING

,

'O'

, &

output_text

,

"output=text"

,

"show only this text (possibly expanded)"

},

483

{

OP_NODATA

,

'P'

,

NULL

,

"no-ucp"

,

"do not enable UCP mode with Unicode"

},

484

{

OP_NODATA

,

'q'

,

NULL

,

"quiet"

,

"suppress output, just set return code"

},

485

{

OP_NODATA

,

'r'

,

NULL

,

"recursive"

,

"recursively scan sub-directories"

},

492

{

OP_NODATA

,

's'

,

NULL

,

"no-messages"

,

"suppress error messages"

},

493

{

OP_NODATA

,

't'

,

NULL

,

"total-count"

,

"print total count of matching lines"

},

495

{

OP_NODATA

,

'U'

,

NULL

,

"utf-allow-invalid"

,

"use UTF/Unicode, allow for invalid code units"

},

496

{

OP_NODATA

,

'V'

,

NULL

,

"version"

,

"print version information and exit"

},

497

{

OP_NODATA

,

'v'

,

NULL

,

"invert-match"

,

"select non-matching lines"

},

498

{

OP_NODATA

,

'w'

,

NULL

,

"word-regex(p)"

,

"force patterns to match only as words"

},

499

{

OP_NODATA

,

'x'

,

NULL

,

"line-regex(p)"

,

"force patterns to match only whole lines"

},

501

{

OP_NODATA

,

'Z'

,

NULL

,

"null"

,

"output 0 byte after file names"

},

509  "DEFAULT"

,

"CR"

,

"LF"

,

"CRLF"

,

"ANY"

,

"ANYCRLF"

,

"NUL"

};

514

{ 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};

521

1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

522

1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

523

2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,

524

3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };

527 #if !defined(VPCOMPAT) && !defined(HAVE_MEMMOVE) 544 unsigned char

*dest = (

unsigned char

*)d;

545 const unsigned char

*src = (

const unsigned char

*)s;

550  for

(

i

= 0;

i

<

n

; ++

i

) *(--dest) = *(--src);

551  return

(

void

*)dest;

555  for

(

i

= 0;

i

<

n

; ++

i

) *dest++ = *src++;

556  return

(

void

*)(dest -

n

);

561 #define memmove(d,s,n) emulated_memmove(d,s,n) 580 for

(j =

i

; j > 0; j--)

582

*utf8bytes-- = 0x80 | (

value

& 0x3f);

599 while

(*str1 !=

'\0'

|| *str2 !=

'\0'

)

603  if

(c1 != c2)

return

((c1 > c2) << 1) - 1;

626

col = strstr(gc,

"ms="

);

627 if

(col ==

NULL

) col = strstr(gc,

"mt="

);

631 while

(*col !=

':'

&& *col != 0 &&

len

<

sizeof

(seq)-1)

632

seq[

len

++] = *col++;

658

$DESCRIPTOR(sym_nam,

"PCRE2GREP_RC"

);

659

$DESCRIPTOR(sym_val, val_buf);

660

sprintf(val_buf,

"%d"

, rc);

661

sym_val.dsc$w_length = strlen(val_buf);

662

lib$set_symbol(&sym_nam, &sym_val);

667

fprintf(stderr,

"pcre2grep: Error %d, %d, %d or %d means that a resource " 670

fprintf(stderr,

"pcre2grep: Check your regex for nested unlimited loops.\n"

);

700

fprintf(stderr,

"pcre2grep: malloc failed\n"

);

705

fprintf(stderr,

"pcre2grep: pattern is too long (limit is %d bytes)\n"

,

783 #ifndef WIN32_LEAN_AND_MEAN 784 # define WIN32_LEAN_AND_MEAN 789 #define iswild(name) (strpbrk(name, "*?"

) != NULL)

792 #define BGR_RGB(x) (((x) & 1 ? 4 : 0) | ((x) & 2) | ((x) & 4 ? 1 : 0)) 795 static

CONSOLE_SCREEN_BUFFER_INFO csbi;

796 static WORD

match_colour;

799

decode_ANSI_colour(

const char

*cs)

804  if

(

isdigit

((

unsigned char

)(*cs)))

811  else if

(

code

== 39)

result

= (

result

& 0xF0) | (csbi.wAttributes & 0x0F);

813  else if

(

code

== 49)

result

= (

result

& 0x0F) | (csbi.wAttributes & 0xF0);

818  while

(

isdigit

((

unsigned char

)(*cs))) cs++;

831

hstdout = GetStdHandle(STD_OUTPUT_HANDLE);

833  if

(!GetConsoleScreenBufferInfo(hstdout, &csbi) && !do_ansi)

835  HANDLE

hcon = CreateFile(

"CONOUT$"

, GENERIC_READ | GENERIC_WRITE,

836

FILE_SHARE_WRITE,

NULL

, OPEN_EXISTING, 0,

NULL

);

837

GetConsoleScreenBufferInfo(hcon, &csbi);

856 #if (defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS 857 #include <sys/types.h> 858 #include <sys/stat.h> 861 #if defined NATIVE_ZOS 865 #include "pcrzosfs.h" 879 if

(stat(filename, &statbuf) < 0)

881 return

S_ISDIR(statbuf.st_mode);

887 return

opendir(filename);

895  struct

dirent *dent = readdir(dir);

897  if

(

strcmp

(dent->d_name,

"."

) != 0 &&

strcmp

(dent->d_name,

".."

) != 0)

916 if

(stat(filename, &statbuf) < 0)

918 return

S_ISREG(statbuf.st_mode);

922 #if defined NATIVE_ZOS 945 return

isatty(fileno(stdout));

951 return

isatty(fileno(

f

));

961 if

(length == 0)

return

;

964 if

(

do_colour

) fprintf(stdout,

"%c[0m"

, 0x1b);

980 #ifndef INVALID_FILE_ATTRIBUTES 981 #define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF 988

WIN32_FIND_DATA

data

;

996 DWORD

attr = GetFileAttributes(filename);

997 if

(attr == INVALID_FILE_ATTRIBUTES)

999 return

(attr & FILE_ATTRIBUTE_DIRECTORY) != 0;

1009 len

= strlen(filename);

1012 if

((pattern ==

NULL

) || (dir ==

NULL

))

1014

fprintf(stderr,

"pcre2grep: malloc failed\n"

);

1017

memcpy(pattern, filename,

len

);

1018 if

(iswild(filename))

1021

memcpy(&(pattern[

len

]),

"\\*"

, 3);

1022

dir->handle = FindFirstFile(pattern, &(dir->data));

1029

err = GetLastError();

1032

errno = (err == ERROR_ACCESS_DENIED) ? EACCES : ENOENT;

1043  if

(!FindNextFile(dir->handle, &(dir->data)))

1048

dir->first =

FALSE

;

1050  if

(

strcmp

(dir->data.cFileName,

"."

) != 0 &&

strcmp

(dir->data.cFileName,

".."

) != 0)

1051  return

dir->data.cFileName;

1061

FindClose(dir->handle);

1082 return

_isatty(_fileno(stdout));

1088 return

_isatty(_fileno(

f

));

1097 if

(length == 0)

return

;

1100  if

(do_ansi) fprintf(stdout,

"%c[%sm"

, 0x1b,

colour_string

);

1101  else

SetConsoleTextAttribute(hstdout, match_colour);

1106  if

(do_ansi) fprintf(stdout,

"%c[0m"

, 0x1b);

1107  else

SetConsoleTextAttribute(hstdout, csbi.wAttributes);

1156 if

(length == 0)

return

;

1164 #ifndef HAVE_STRERROR 1179 if

(n < 0 || n >=

sys_nerr

)

return "unknown error number"

;

1194

fprintf(stderr,

"Usage: pcre2grep [-"

);

1199

fprintf(stderr,

"] [long options] [pattern] [files]\n"

);

1200

fprintf(stderr,

"Type \"pcre2grep --help\" for more information and the long " 1216

printf(

"Usage: pcre2grep [OPTION]... [PATTERN] [FILE1 FILE2 ...]" STDOUT_NL

);

1217

printf(

"Search for PATTERN in each FILE or standard input." STDOUT_NL

);

1218

printf(

"PATTERN must be present if neither -e nor -f is used." STDOUT_NL

);

1220 #ifdef SUPPORT_PCRE2GREP_CALLOUT 1221 #ifdef SUPPORT_PCRE2GREP_CALLOUT_FORK 1222

printf(

"All callout scripts in patterns are supported." STDOUT_NL

);

1224

printf(

"Non-fork callout scripts in patterns are supported." STDOUT_NL

);

1227

printf(

"Callout scripts are not supported in this pcre2grep." STDOUT_NL

);

1230

printf(

"\"-\" can be used as a file name to mean STDIN." STDOUT_NL

);

1233

printf(

"Files whose names end in .gz are read using zlib." STDOUT_NL

);

1236 #ifdef SUPPORT_LIBBZ2 1237

printf(

"Files whose names end in .bz2 are read using bzlib2." STDOUT_NL

);

1240 #if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2 1241

printf(

"Other files and the standard input are read as plain files." STDOUT_NL STDOUT_NL

);

1243

printf(

"All files are read as plain files, without any interpretation." STDOUT_NL STDOUT_NL

);

1255  n

= 31 - printf(

" -%c"

, op->

one_char

);

1259  else

strcpy(s,

" "

);

1260  n

= 31 - printf(

" %s --%s"

, s, op->

long_name

);

1267

printf(

STDOUT_NL "Numbers may be followed by K or M, e.g. --max-buffer-size=100K." STDOUT_NL

);

1270

printf(

"When reading patterns or file names from a file, trailing white" STDOUT_NL

);

1271

printf(

"space is removed and blank lines are ignored." STDOUT_NL

);

1274

printf(

STDOUT_NL "With no FILEs, read standard input. If fewer than two FILEs given, assume -h." STDOUT_NL

);

1275

printf(

"Exit status is 0 if any matches, 1 if no matches, and 2 if trouble." STDOUT_NL

);

1298 int

plen = strlen((

const char

*)path);

1300 for

(; ep !=

NULL

; ep = ep->

next

)

1338 unsigned long int n

= 0;

1339 char

*endptr = option_data;

1340 while

(*endptr != 0 &&

isspace

((

unsigned char

)(*endptr))) endptr++;

1341 while

(

isdigit

((

unsigned char

)(*endptr)))

1342  n

=

n

* 10 + (

int

)(*endptr++ -

'0'

);

1343 if

(

toupper

(*endptr) ==

'K'

)

1348 else if

(

toupper

(*endptr) ==

'M'

)

1358  char

*equals = strchr(op->

long_name

,

'='

);

1359  int

nlen = (equals ==

NULL

)? (

int

)strlen(op->

long_name

) :

1361

fprintf(stderr,

"pcre2grep: Malformed number \"%s\" after --%.*s\n"

,

1365

fprintf(stderr,

"pcre2grep: Malformed number \"%s\" after -%c\n"

,

1398

fprintf(stderr,

"pcre2grep: malloc failed\n"

);

1409  om

->next = after->

next

;

1443 while

((c = fgetc(

f

)) != EOF)

1446  if

(c ==

'\n'

|| yield >= length)

break

;

1476  while

(p < endptr && *p !=

'\n'

) p++;

1486  while

(p < endptr && *p !=

'\r'

) p++;

1496  while

(p < endptr && *p !=

'\0'

) p++;

1508  while

(p < endptr && *p !=

'\r'

) p++;

1526  int

c = *((

unsigned char

*)p);

1528  if

(

utf

&& c >= 0xc0)

1534  for

(gcii = 1; gcii <= extra; gcii++)

1537

c |= (p[gcii] & 0x3f) << gcss;

1550  if

(p < endptr && *p ==

'\n'

)

1570  int

c = *((

unsigned char

*)p);

1572  if

(

utf

&& c >= 0xc0)

1578  for

(gcii = 1; gcii <= extra; gcii++)

1581

c |= (p[gcii] & 0x3f) << gcss;

1596  if

(p < endptr && *p ==

'\n'

)

1606

*lenptr =

utf

? 2 : 1;

1648  while

(p > startptr && p[-1] !=

'\n'

) p--;

1653  while

(p > startptr && p[-1] !=

'\n'

) p--;

1658  while

(p > startptr && p[-1] !=

'\0'

) p--;

1665  while

(p > startptr && p[-1] !=

'\n'

) p--;

1666  if

(p <= startptr + 1 || p[-2] ==

'\r'

)

return

p;

1672  if

(*(--p) ==

'\n'

&& p > startptr && p[-1] ==

'\r'

) p--;

1673  if

(

utf

)

while

((*p & 0xc0) == 0x80) p--;

1675  while

(p > startptr)

1683  while

((*pp & 0xc0) == 0x80) pp--;

1684

c = *((

unsigned char

*)pp);

1691  for

(gcii = 1; gcii <= extra; gcii++)

1694

c |= (pp[gcii] & 0x3f) << gcss;

1698  else

c = *((

unsigned char

*)pp);

1756

fprintf(stdout,

"\n"

);

1760

fprintf(stdout,

"\r"

);

1764

fprintf(stdout,

"\r\n"

);

1768

fprintf(stdout,

"%c"

, 0);

1793  char

*endptr,

const char

*printname)

1801  char

*pp =

end_of_line

(lastmatchrestart, endptr, &ellength);

1804  if

(

number

) fprintf(stdout,

"%lu-"

, lastmatchnumber++);

1805  FWRITE_IGNORE

(lastmatchrestart, 1, pp - lastmatchrestart, stdout);

1806

lastmatchrestart = pp;

1817  if

(ellength == 0 && lastmatchrestart >= endptr)

1854 const char

*

msg

=

"this text:\n\n"

;

1859  msg

=

"text that starts:\n\n"

;

1862 for

(

int i

= 1; p !=

NULL

; p = p->

next

,

i

++)

1894

fprintf(stderr,

"pcre2grep: pcre2_match() gave error %d while matching "

, rc);

1896

fprintf(stderr,

"%s"

,

msg

);

1898

fprintf(stderr,

"\n\n"

);

1902  unsigned char

mbuffer[256];

1905

fprintf(stderr,

"%s at offset %" SIZ_FORM "\n\n"

, mbuffer, startchar);

1912

fprintf(stderr,

"pcre2grep: Too many errors - abandoned.\n"

);

1985 switch

(*(++

string

))

1989

fprintf(stderr,

"pcre2grep: Error in output text at offset %d: %s\n"

,

1990

(

int

)(

string

- begin),

"no character after $"

);

1997  if

(!

isdigit

((

unsigned char

)(*

string

)))

2000

fprintf(stderr,

"pcre2grep: Error in output text at offset %d: %s\n"

,

2001

(

int

)(

string

- begin),

"decimal number expected"

);

2012  case '0'

:

case '1'

:

case '2'

:

case '3'

:

case '4'

:

2013  case '5'

:

case '6'

:

case '7'

:

case '8'

:

case '9'

:

2016  if

(c <= 65535) c = c * 10 + (*

string

-

'0'

);

2019  while

(*

string

>=

'0'

&& *

string

<=

'9'

);

2025  if

(callout && c == 0)

2042  if

(*

string

==

'{'

)

2049  for

(; dcount > 0; dcount--)

2051  if

(*string < '0' || *string >

'7'

)

break

;

2052

c = c * 8 + (*

string

++ -

'0'

);

2064  if

(*

string

==

'{'

)

2071  for

(; dcount > 0; dcount--)

2073  if

(!

isxdigit

(*

string

))

break

;

2074  if

(*

string

>=

'0'

&& *

string

<=

'9'

)

2075

c = c *16 + *

string

++ -

'0'

;

2077

c = c * 16 + (*

string

++ | 0x20) -

'a'

+ 10;

2083  case 'a'

: *

value

=

'\a'

;

break

;

2084  case 'b'

: *

value

=

'\b'

;

break

;

2086  case 'e'

: *

value

=

'\033'

;

break

;

2088  case 'e'

: *

value

=

'\047'

;

break

;

2090  case 'f'

: *

value

=

'\f'

;

break

;

2092  case 'r'

: *

value

=

'\r'

;

break

;

2093  case 't'

: *

value

=

'\t'

;

break

;

2094  case 'v'

: *

value

=

'\v'

;

break

;

2107  if

((base == 8 && c >=

'0'

&& c <=

'7'

) ||

2110

fprintf(stderr,

"pcre2grep: Error in output text at offset %d: " 2111  "too many %s digits\n"

, (

int

)(

string

- begin),

2112

(base == 8)?

"octal"

:

"hex"

);

2116

fprintf(stderr,

"pcre2grep: Error in output text at offset %d: %s\n"

,

2117

(

int

)(

string

- begin),

"missing closing brace"

);

2132

fprintf(stderr,

"pcre2grep: Error in output text at offset %d: " 2133  "code point greater than 0x%x is invalid\n"

, (

int

)(

string

- begin),

max

);

2164 for

(; *

string

!= 0;

string

++)

2166  if

(*

string

==

'$'

&&

2201 for

(; *

string

!= 0;

string

++)

2203  if

(*

string

==

'$'

)

2217  if

(

value

< capture_top)

2221

capturesize = ovector[

value

+ 1] - ovector[

value

];

2222  if

(capturesize > 0)

2239  if

(!

utf

||

value

<= 127) fprintf(stdout,

"%c"

,

value

);

else 2252 #ifdef SUPPORT_PCRE2GREP_CALLOUT 2303 PCRE2_SIZE

length = calloutptr->callout_string_length;

2304 PCRE2_SPTR string

= calloutptr->callout_string;

2306 PCRE2_SIZE

*ovector = calloutptr->offset_vector;

2307 PCRE2_SIZE

capture_top = calloutptr->capture_top;

2309 #ifdef SUPPORT_PCRE2GREP_CALLOUT_FORK 2315 char

**argsvectorptr;

2326 if

(

string

==

NULL

|| length == 0)

return

0;

2330 if

(*

string

==

'|'

)

2338 #ifndef SUPPORT_PCRE2GREP_CALLOUT_FORK 2347  if

(*

string

==

'|'

)

2350  if

(argsvectorlen > 10000)

return

0;

2353  else if

(*

string

==

'$'

)

2361  if

(

value

< capture_top)

2364

argslen += ovector[

value

+ 1] - ovector[

value

];

2381

length -= (

string

- begin);

2391

args = (

char

*)

malloc

(argslen);

2392 if

(args ==

NULL

)

return

0;

2394

argsvector = (

char

**)

malloc

(argsvectorlen *

sizeof

(

char

*));

2395 if

(argsvector ==

NULL

)

2406

argsvectorptr = argsvector;

2407

*argsvectorptr++ = argsptr;

2409

length = calloutptr->callout_string_length;

2410 string

= calloutptr->callout_string;

2414  if

(*

string

==

'|'

)

2417

*argsvectorptr++ = argsptr;

2420  else if

(*

string

==

'$'

)

2428  if

(

value

< capture_top)

2432

capturesize = ovector[

value

+ 1] - ovector[

value

];

2433

memcpy(argsptr,

subject

+ ovector[

value

], capturesize);

2434

argsptr += capturesize;

2452

*argsptr++ =

value

;

2465

length -= (

string

- begin);

2468  else

*argsptr++ = *

string

;

2477

*argsvectorptr =

NULL

;

2483 result

= _spawnvp(_P_WAIT, argsvector[0], (

const char

*

const

*)argsvector);

2489  int flags

= CLI$M_NOCLISYM|CLI$M_NOLOGNAM|CLI$M_NOKEYPAD, status, retstat;

2490

$DESCRIPTOR(

cmd

, cmdbuf);

2493  while

(argsvector[

i

])

2495  strcat

(cmdbuf, argsvector[

i

]);

2499  cmd

.dsc$w_length = strlen(cmdbuf) - 1;

2500

status = lib$spawn(&

cmd

, 0,0, &

flags

, 0,0, &retstat);

2501  if

(!(status & 1))

result

= 0;

2502  else result

= retstat & 1 ? 0 : 1;

2509

(void)execv(argsvector[0], argsvector);

2515

(void)fflush(stdout);

2516

(void)waitpid(pid, &

result

, 0);

2517

(void)fflush(stdout);

2540  BOOL

input_line_buffered)

2550 #ifdef SUPPORT_LIBBZ2 2556 return

(input_line_buffered ?

2558

fread(

buffer

, 1, length, (FILE *)handle));

2591 pcre2grep

(

void

*handle,

int

frtype,

const char

*filename,

const char

*printname)

2595 unsigned long int

linenumber = 1;

2596 unsigned long int

lastmatchnumber = 0;

2597 unsigned long int count

= 0;

2598 long int

count_matched_lines = 0;

2608 long

stream_start = -1;

2617  in

= (FILE *)handle;

2618  if

(feof(

in

))

return

1;

2623

stream_start = ftell(

in

);

2626 else

input_line_buffered =

FALSE

;

2629

input_line_buffered);

2631 #ifdef SUPPORT_LIBBZ2 2632 if

(frtype ==

FR_LIBBZ2

&& (

int

)bufflength < 0)

return

3;

2644

binary = memchr(

main_buffer

, 0, (bufflength > 1024)? 1024 : bufflength)

2654 while

(ptr < endptr)

2658  unsigned int

options = 0;

2671  if

(stream_start >= 0)

2672

(void)

fseek

(handle, stream_start + (

long int

)filepos,

SEEK_SET

);

2686

linelength =

t

- ptr - endlinelength;

2702

new_buffer = (

char

*)

malloc

(3*new_bufthird);

2704  if

(new_buffer ==

NULL

)

2708  "pcre2grep: line %lu%s%s is too long for the internal buffer\n" 2709  "pcre2grep: not enough memory to increase the buffer size to %" 2712

(filename ==

NULL

)?

""

:

" of file "

,

2713

(filename ==

NULL

)?

""

: filename,

2725

lastmatchrestart = new_buffer + (lastmatchrestart -

main_buffer

);

2733  bufsize

- bufflength, input_line_buffered);

2740  "pcre2grep: line %lu%s%s is too long for the internal buffer\n" 2741  "pcre2grep: the maximum buffer size is %" SIZ_FORM "\n" 2742  "pcre2grep: use the --max-buffer-size option to change it\n"

,

2744

(filename ==

NULL

)?

""

:

" of file "

,

2745

(filename ==

NULL

)?

""

: filename,

2755

ONLY_MATCHING_RESTART:

2781

line_matched =

TRUE

;

2785  if

(

quiet

)

return

0;

2797

fprintf(stdout,

"Binary file %s matches" STDOUT_NL

, filename);

2806

fprintf(stdout,

"%s"

, printname);

2827  if

(printname !=

NULL

) fprintf(stdout,

"%s%c"

, printname,

2829  if

(

number

) fprintf(stdout,

"%lu:"

, linenumber);

2841

(

int

)(filepos + ptr +

offsets

[0] - ptr),

2862  int n

=

om

->groupnum;

2863  if

(

n

== 0 ||

n

< mrc)

2892  if

(startoffset <= oldstartoffset)

2894  if

(startoffset >= length)

goto

END_ONE_MATCH;

2895

startoffset = oldstartoffset + 1;

2896  if

(

utf

)

while

((ptr[startoffset] & 0xc0) == 0x80) startoffset++;

2903  while

(startoffset > linelength)

2905

ptr += linelength + endlinelength;

2906

filepos += (

int

)(linelength + endlinelength);

2908

startoffset -= (

int

)(linelength + endlinelength);

2910

linelength =

t

- ptr - endlinelength;

2914  goto

ONLY_MATCHING_RESTART;

2924

lines_printed =

TRUE

;

2933  char

*p = lastmatchrestart;

2945  while

(lastmatchrestart < p)

2947  char

*pp = lastmatchrestart;

2948  if

(printname !=

NULL

) fprintf(stdout,

"%s%c"

, printname,

2950  if

(

number

) fprintf(stdout,

"%lu-"

, lastmatchnumber++);

2952  FWRITE_IGNORE

(lastmatchrestart, 1, pp - lastmatchrestart, stdout);

2953

lastmatchrestart = pp;

2965

hyphenprinted =

TRUE

;

2977

(lastmatchnumber == 0 || p > lastmatchrestart) &&

2984  if

(lastmatchnumber > 0 && p > lastmatchrestart && !hyphenprinted &&

2992  if

(printname !=

NULL

) fprintf(stdout,

"%s%c"

, printname,

2994  if

(

number

) fprintf(stdout,

"%lu-"

, linenumber - linecount--);

3005

endhyphenpending =

TRUE

;

3007  if

(printname !=

NULL

) fprintf(stdout,

"%s%c"

, printname,

3009  if

(

number

) fprintf(stdout,

"%lu:"

, linenumber);

3040

startoffset = endprevious;

3047  if

(startoffset <= oldstartoffset)

3049

startoffset = oldstartoffset + 1;

3050  if

(

utf

)

while

((ptr[startoffset] & 0xc0) == 0x80) startoffset++;

3059  while

(startoffset > linelength + endlinelength)

3061

ptr += linelength + endlinelength;

3062

filepos += (

int

)(linelength + endlinelength);

3064

startoffset -= (

int

)(linelength + endlinelength);

3065

endprevious -= (

int

)(linelength + endlinelength);

3067

linelength =

t

- ptr - endlinelength;

3075  if

(startoffset == linelength + endlinelength)

break

;

3080  if

(!

match_patterns

(ptr, length, options, startoffset, &mrc))

break

;

3100

plength = (

int

)((linelength + endlinelength) - endprevious);

3101  if

(plength > 0)

FWRITE_IGNORE

(ptr + endprevious, 1, plength, stdout);

3106  else FWRITE_IGNORE

(ptr, 1, linelength + endlinelength, stdout);

3118

lastmatchrestart = ptr + linelength + endlinelength;

3119

lastmatchnumber = linenumber + 1;

3124  if

(lines_printed && lastmatchrestart >= endptr && endlinelength == 0)

3135  char

*endmatch = ptr +

offsets

[1];

3137  while

(

t

< endmatch)

3140  if

(

t

<= endmatch) linenumber++;

else break

;

3142

endmatch =

end_of_line

(endmatch, endptr, &ellength);

3143

linelength = endmatch - ptr - ellength;

3150

ptr += linelength + endlinelength;

3151

filepos += (

int

)(linelength + endlinelength);

3157  if

(line_matched) count_matched_lines++;

3177

lastmatchnumber > 0 &&

3180  do_after_lines

(lastmatchnumber, lastmatchrestart, endptr, printname);

3181

lastmatchnumber = 0;

3195  if

(lastmatchnumber > 0) lastmatchrestart -=

bufthird

;

3204  do_after_lines

(lastmatchnumber, lastmatchrestart, endptr, printname);

3213

fprintf(stdout,

"%s"

, printname);

3271 #ifdef SUPPORT_LIBBZ2 3275 #if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2 3279 #if defined NATIVE_ZOS 3281

FILE *zos_test_file;

3286 if

(

strcmp

(pathname,

"-"

) == 0)

3298

lastcomp = strrchr(pathname,

FILESEP

);

3299

lastcomp = (lastcomp ==

NULL

)? pathname : lastcomp + 1;

3308 #if defined NATIVE_ZOS 3309

zos_test_file = fopen(pathname,

"rb"

);

3311 if

(zos_test_file ==

NULL

)

3313  if

(!

silent

) fprintf(stderr,

"pcre2grep: failed to test next file %s\n"

,

3317

zos_type = identifyzosfiletype (zos_test_file);

3318

fclose (zos_test_file);

3322 if

(zos_type == __ZOS_PDS || zos_type == __ZOS_PDSE)

3324  return

travelonpdsdir (pathname, only_one_at_top);

3337 else if

(zos_type == __ZOS_HFS)

3360

fprintf(stderr,

"pcre2grep: Failed to open directory %s: %s\n"

, pathname,

3369  int

fnlength = strlen(pathname) + strlen(nextfile) + 2;

3373

fprintf(stderr,

"pcre2grep: recursive filename is too long\n"

);

3378

sprintf(childpath,

"%s%c%s"

, pathname,

FILESEP

, nextfile);

3387 #ifdef HAVE_REALPATH 3392  if

(realpath(childpath, resolvedpath) ==

NULL

)

3396

isSame =

strcmp

(pathname, resolvedpath) == 0;

3397  if

(isSame)

continue

;

3398

rlen = strlen(resolvedpath);

3399  if

(rlen++ <

sizeof

(resolvedpath) - 3)

3402  strcat

(resolvedpath,

"/"

);

3403

contained =

strncmp

(pathname, resolvedpath, rlen) == 0;

3404  if

(contained)

continue

;

3410  if

(frc > 1) rc = frc;

3411  else if

(frc == 0 && rc == 1) rc = 0;

3420 if

(iswild(pathname))

3430  for

(nextfile = name = pathname; *nextfile != 0; nextfile++)

3431  if

(*nextfile ==

'/'

|| *nextfile ==

'\\'

)

3432

name = nextfile + 1;

3438

sprintf(

buffer

,

"%.512s%.128s"

, pathname, nextfile);

3440  if

(frc > 1) rc = frc;

3441  else if

(frc == 0 && rc == 1) rc = 0;

3449 #if defined NATIVE_ZOS 3458

#

if

defined NATIVE_ZOS

3472 #if defined SUPPORT_LIBZ || defined SUPPORT_LIBBZ2 3473

pathlen = (

int

)(strlen(pathname));

3479 if

(pathlen > 3 &&

strcmp

(pathname + pathlen - 3,

".gz"

) == 0)

3481

ingz =

gzopen

(pathname,

"rb"

);

3486

fprintf(stderr,

"pcre2grep: Failed to open %s: %s\n"

, pathname,

3491

handle = (

void

*)ingz;

3499 #ifdef SUPPORT_LIBBZ2 3500 if

(pathlen > 4 &&

strcmp

(pathname + pathlen - 4,

".bz2"

) == 0)

3503

handle = (

void

*)inbz2;

3512 #ifdef SUPPORT_LIBBZ2 3516  in

= fopen(pathname,

"rb"

);

3517

handle = (

void

*)

in

;

3523 if

(handle ==

NULL

)

3526

fprintf(stderr,

"pcre2grep: Failed to open %s: %s\n"

, pathname,

3548 #ifdef SUPPORT_LIBBZ2 3562

fprintf(stderr,

"pcre2grep: Failed to read %s using bzlib: %s\n"

,

3632  unsigned char buffer

[128];

3645

fprintf(stderr,

"pcre2grep: Unknown option -%c\n"

,

letter

);

3666

sprintf(p,

"%d"

,

n

);

3667 while

(*p != 0) p++;

3669 if

(

n

>= 11 &&

n

<= 13)

n

= 0;

3672  case

1: strcpy(p,

"st"

);

break

;

3673  case

2: strcpy(p,

"nd"

);

break

;

3674  case

3: strcpy(p,

"rd"

);

break

;

3675  default

: strcpy(p,

"th"

);

break

;

3722  char

*eop = ps + patlen;

3727

patlen = pe - ps - ellength;

3741 #ifdef SUPPORT_PCRE2GREP_JIT 3749 if

(erroffset > patlen) erroffset = patlen;

3754

fprintf(stderr,

"pcre2grep: Error in regex in line %d of %s " 3755  "at offset %d: %s\n"

,

count

, fromtext, (

int

)erroffset, errmessbuffer);

3760

fprintf(stderr,

"pcre2grep: Error in %s regex at offset %d: %s\n"

,

3761

fromtext, (

int

)erroffset, errmessbuffer);

3763

fprintf(stderr,

"pcre2grep: Error in %s %s regex at offset %d: %s\n"

,

3764  ordin

(

count

), fromtext, (

int

)erroffset, errmessbuffer);

3792 const char

*filename;

3795 if

(

strcmp

(name,

"-"

) == 0)

3802  f

= fopen(name,

"r"

);

3805

fprintf(stderr,

"pcre2grep: Failed to open %s: %s\n"

, name,

strerror

(errno));

3813  while

(patlen > 0 &&

isspace

((

unsigned char

)(

buffer

[patlen-1]))) patlen--;

3815  if

(patlen == 0)

continue

;

3823  if

(*patlastptr ==

NULL

)

3826  if

(

f

!= stdin) fclose(

f

);

3830  if

(*patptr ==

NULL

) *patptr = *patlastptr;

3843  if

(

f

!= stdin) fclose(

f

);

3846

(*patlastptr)->string =

NULL

;

3847  if

((*patlastptr)->next ==

NULL

)

break

;

3848

*patlastptr = (*patlastptr)->

next

;

3852 if

(

f

!= stdin) fclose(

f

);

3869 BOOL

only_one_at_top;

3873 const char

*locale_from =

"--locale"

;

3875 #ifdef SUPPORT_PCRE2GREP_JIT 3886

_setmode(_fileno(stdout), _O_BINARY);

3891 for

(

i

= 1;

i

< argc;

i

++)

3894  char

*option_data = (

char

*)

""

;

3898  if

(argv[

i

][0] !=

'-'

)

break

;

3903  if

(argv[

i

][1] == 0)

3911  if

(argv[

i

][1] ==

'-'

)

3913  char

*arg = argv[

i

] + 2;

3914  char

*argequals = strchr(arg,

'='

);

3933  char

*opbra = strchr(op->

long_name

,

'('

);

3934  char

*equals = strchr(op->

long_name

,

'='

);

3940  if

(equals ==

NULL

)

3947  int

arglen = (argequals ==

NULL

)?

3948

(

int

)strlen(arg) : (

int

)(argequals - arg);

3951

option_data = arg + arglen;

3952  if

(*option_data ==

'='

)

3955

longopwasequals =

TRUE

;

3972  int

arglen = (argequals ==

NULL

|| equals ==

NULL

)?

3973

(

int

)strlen(arg) : (

int

)(argequals - arg);

3975  if

((ret = snprintf(buff1,

sizeof

(buff1),

"%.*s"

, baselen, op->

long_name

),

3976

ret < 0 || ret > (

int

)

sizeof

(buff1)) ||

3977

(ret = snprintf(buff2,

sizeof

(buff2),

"%s%.*s"

, buff1,

3978

fulllen - baselen - 2, opbra + 1),

3979

ret < 0 || ret > (

int

)

sizeof

(buff2)))

3982

fprintf(stderr,

"pcre2grep: Buffer overflow when parsing %s option\n"

,

3988  if

(

strncmp

(arg, buff1, arglen) == 0 ||

3989  strncmp

(arg, buff2, arglen) == 0)

3991  if

(equals !=

NULL

&& argequals !=

NULL

)

3993

option_data = argequals;

3994  if

(*option_data ==

'='

)

3997

longopwasequals =

TRUE

;

4007

fprintf(stderr,

"pcre2grep: Unknown option %s\n"

, argv[

i

]);

4017  char

*s = argv[

i

] + 1;

4028

fprintf(stderr,

"pcre2grep: Unknown option letter '%c' in \"%s\"\n"

,

4038  if

(*option_data == 0)

break

;

4047  if

(

isdigit

((

unsigned char

)(s[1])))

break

;

4076  if

(*option_data == 0 &&

4096  if

(*option_data == 0)

4098  if

(

i

>= argc - 1 || longopwasequals)

4100

fprintf(stderr,

"pcre2grep: Data missing after %s\n"

, argv[

i

]);

4103

option_data = argv[++

i

];

4140

fprintf(stderr,

"pcre2grep: malloc failed\n"

);

4145

fn->

name

= option_data;

4157  if

(

strcmp

(option_data,

"binary"

) == 0)

4159  else if

(

strcmp

(option_data,

"without-match"

) == 0)

4161  else if

(

strcmp

(option_data,

"text"

) == 0)

4165

fprintf(stderr,

"pcre2grep: unknown value \"%s\" for binary-files\n"

,

4176

*((

char

**)op->

dataptr

) = option_data;

4183  else

*((

int

*)op->

dataptr

) =

n

;

4205

fprintf(stderr,

"pcre2grep: Cannot mix --only-matching, --output, " 4206  "--file-offsets and/or --line-offsets\n"

);

4214  int n

=

om

->groupnum;

4217

fprintf(stderr,

"pcre2grep: Requested group %d cannot be captured.\n"

,

n

);

4218

fprintf(stderr,

"pcre2grep: Use --om-capture to increase the size of the capture vector.\n"

);

4245 #ifdef SUPPORT_PCRE2GREP_CALLOUT 4260  locale

= getenv(

"LC_ALL"

);

4261

locale_from =

"LC_ALL"

;

4266  locale

= getenv(

"LC_CTYPE"

);

4267

locale_from =

"LC_CTYPE"

;

4277

fprintf(stderr,

"pcre2grep: Failed to set locale %s (obtained from %s)\n"

,

4297

fprintf(stderr,

"pcre2grep: Unknown colour setting \"%s\"\n"

,

4303  char

*cs = getenv(

"PCRE2GREP_COLOUR"

);

4304  if

(cs ==

NULL

) cs = getenv(

"PCRE2GREP_COLOR"

);

4305  if

(cs ==

NULL

) cs = getenv(

"PCREGREP_COLOUR"

);

4306  if

(cs ==

NULL

) cs = getenv(

"PCREGREP_COLOR"

);

4308  if

(cs ==

NULL

) cs = getenv(

"GREP_COLOR"

);

4311  if

(strspn(cs,

";0123456789"

) == strlen(cs))

colour_string

= cs;

4314

init_colour_output();

4337

fprintf(stderr,

"pcre2grep: Invalid newline specifier \"%s\"\n"

,

4359

fprintf(stderr,

"pcre2grep: Invalid value \"%s\" for -d\n"

,

dee_option

);

4370

fprintf(stderr,

"pcre2grep: Invalid value \"%s\" for -D\n"

,

DEE_option

);

4403

fprintf(stderr,

"pcre2grep: --buffer-size must be greater than zero\n"

);

4413

fprintf(stderr,

"pcre2grep: malloc failed\n"

);

4423  if

(

i

>= argc)

return usage

(2);

4452 #ifdef SUPPORT_PCRE2GREP_JIT 4470 for

(j = 0; j < 4; j++)

4476

(k == 1 && cp->next ==

NULL

)? 0 : k))

4504

setbuf(stdin,

NULL

);

4517  if

(

strcmp

(fn->

name

,

"-"

) == 0) fl = stdin;

else 4519

fl = fopen(fn->

name

,

"rb"

);

4522

fprintf(stderr,

"pcre2grep: Failed to open %s: %s\n"

, fn->

name

,

4531  while

(end >

buffer

&&

isspace

((

unsigned char

)(end[-1]))) end--;

4536  if

(frc > 1) rc = frc;

4537  else if

(frc == 0 && rc == 1) rc = 0;

4540  if

(fl != stdin) fclose(fl);

4549 for

(;

i

< argc;

i

++)

4553  if

(frc > 1) rc = frc;

4554  else if

(frc == 0 && rc == 1) rc = 0;

4563

fprintf(stdout,

"TOTAL:"

);

4568 #ifdef SUPPORT_PCRE2GREP_JIT

BZFILE * BZ2_bzopen(const char *path, const char *mode)

int BZ2_bzread(BZFILE *b, void *buf, int len)

#define BZ_DATA_ERROR_MAGIC

const char * BZ2_bzerror(BZFILE *b, int *errnum)

void BZ2_bzclose(BZFILE *b)

static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)

static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)

static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

#define INVALID_HANDLE_VALUE

A value for an invalid file handle.

#define HANDLE

An abstraction for a file handle.

unsigned int

A callback function used to compare two keys in a database.

static const CS_INT unused

const GenericPointer< typename T::ValueType > T2 value

int strncmp(const char *str1, const char *str2, size_t count)

int strcmp(const char *str1, const char *str2)

std::istream & in(std::istream &in_, double &x_)

#define PCRE2_CONFIG_NEWLINE

#define PCRE2_ERROR_HEAPLIMIT

#define PCRE2_ERROR_NOMATCH

#define PCRE2_ERROR_UTF8_ERR21

#define PCRE2_MATCH_INVALID_UTF

#define PCRE2_NEWLINE_ANYCRLF

#define PCRE2_ERROR_UTF8_ERR1

#define PCRE2_EXTRA_ASCII_BSD

#define pcre2_match_context

#define PCRE2_ERROR_DEPTHLIMIT

#define PCRE2_EXTRA_MATCH_WORD

#define PCRE2_ERROR_JIT_STACKLIMIT

#define PCRE2_EXTRA_CASELESS_RESTRICT

#define PCRE2_ERROR_MATCHLIMIT

#define PCRE2_EXTRA_MATCH_LINE

#define PCRE2_JIT_COMPLETE

#define PCRE2_NEWLINE_CRLF

#define PCRE2_EXTRA_ASCII_DIGIT

#define PCRE2_NEWLINE_NUL

#define pcre2_callout_block

#define PCRE2_NEWLINE_ANY

#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK

#define pcre2_compile_context

#define PCRE2_CONFIG_VERSION

PCRE2_EXPORT pcre2_code *PCRE2_CALL_CONVENTION pcre2_compile(PCRE2_SPTR pattern, PCRE2_SIZE patlen, uint32_t options, int *errorptr, PCRE2_SIZE *erroroffset, pcre2_compile_context *ccontext)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_code_free(pcre2_code *code)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_config(uint32_t what, void *where)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_depth_limit(pcre2_match_context *mcontext, uint32_t limit)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_match_context_free(pcre2_match_context *mcontext)

PCRE2_EXPORT pcre2_match_context *PCRE2_CALL_CONVENTION pcre2_match_context_create(pcre2_general_context *gcontext)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_newline(pcre2_compile_context *ccontext, uint32_t newline)

PCRE2_EXPORT pcre2_compile_context *PCRE2_CALL_CONVENTION pcre2_compile_context_create(pcre2_general_context *gcontext)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_heap_limit(pcre2_match_context *mcontext, uint32_t limit)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_match_limit(pcre2_match_context *mcontext, uint32_t limit)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_compile_context_free(pcre2_compile_context *ccontext)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_callout(pcre2_match_context *mcontext, int(*callout)(pcre2_callout_block *, void *), void *callout_data)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_compile_extra_options(pcre2_compile_context *ccontext, uint32_t options)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_set_character_tables(pcre2_compile_context *ccontext, const uint8_t *tables)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_get_error_message(int enumber, PCRE2_UCHAR *buffer, PCRE2_SIZE size)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_jit_compile(pcre2_code *code, uint32_t options)

PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION pcre2_jit_free_unused_memory(pcre2_general_context *gcontext)

PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION pcre2_jit_stack_free(pcre2_jit_stack *jit_stack)

PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION pcre2_jit_stack_assign(pcre2_match_context *mcontext, pcre2_jit_callback callback, void *callback_data)

PCRE2_EXP_DEFN pcre2_jit_stack *PCRE2_CALL_CONVENTION pcre2_jit_stack_create(size_t startsize, size_t maxsize, pcre2_general_context *gcontext)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_maketables_free(pcre2_general_context *gcontext, const uint8_t *tables)

PCRE2_EXPORT const uint8_t *PCRE2_CALL_CONVENTION pcre2_maketables(pcre2_general_context *gcontext)

static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length, PCRE2_SIZE start_offset, uint32_t options, pcre2_match_data *match_data, pcre2_match_context *mcontext)

PCRE2_EXPORT pcre2_match_data *PCRE2_CALL_CONVENTION pcre2_match_data_create(uint32_t oveccount, pcre2_general_context *gcontext)

PCRE2_EXPORT PCRE2_SIZE *PCRE2_CALL_CONVENTION pcre2_get_ovector_pointer(pcre2_match_data *match_data)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_match_data_free(pcre2_match_data *match_data)

PCRE2_EXPORT PCRE2_SIZE PCRE2_CALL_CONVENTION pcre2_get_startchar(pcre2_match_data *match_data)

static int before_context

static patstr * exclude_dir_patterns

#define N_GROUP_SEPARATOR

static BOOL syntax_check_output_text(PCRE2_SPTR string, BOOL callout)

static patstr * include_dir_patterns_last

static BOOL is_file_tty(FILE *f)

const int utf8_table1_size

static PCRE2_SIZE read_one_line(char *buffer, PCRE2_SIZE length, FILE *f)

static uint32_t depth_limit

static BOOL is_stdout_tty(void)

static const char * stdin_name

static int ord2utf8(uint32_t value)

static patstr * exclude_patterns_last

directory_type * opendirectory(char *filename)

struct omdatastr omdatastr

struct fndatastr fndatastr

static char * main_buffer

static fnstr * include_from_last

static patstr * include_patterns

static int printname_colon

static omdatastr only_matching_data

static BOOL case_restrict

static BOOL omit_zero_count

static fnstr * file_lists

static int printname_hyphen

static fndatastr exclude_from_data

static const char * locale

static patstr * add_pattern(char *s, PCRE2_SIZE patlen, patstr *after)

int main(int argc, char **argv)

static void pcre2grep_exit(int rc)

static const char * dee_option

static void free_pattern_chain(patstr *pc)

static patstr * exclude_dir_patterns_last

static fnstr * pattern_files

static BOOL compile_pattern(patstr *p, int options, int fromfile, const char *fromtext, int count)

static omstr * only_matching_last

static const char * group_separator

static fndatastr file_lists_data

static char * ordin(int n)

static int handle_option(int letter, int options)

static int only_matching_count

static uint32_t match_limit

static uint32_t offset_size

static PCRE2_SIZE max_bufthird

static unsigned long int counts_printed

static uint32_t capture_max

static int match_data_toggle

void closedirectory(directory_type *dir)

static patstr * include_dir_patterns

static PCRE2_SIZE heap_limit

static patdatastr match_patdata

static unsigned long int total_count

static void do_after_lines(unsigned long int lastmatchnumber, char *lastmatchrestart, char *endptr, const char *printname)

static PCRE2_SIZE bufsize

static BOOL hyphenpending

static PCRE2_SIZE * offsets_pair[2]

static fndatastr pattern_files_data

static uint32_t extra_options

static fnstr * file_lists_last

static BOOL display_output_text(PCRE2_SPTR string, BOOL callout, PCRE2_SPTR subject, PCRE2_SIZE *ovector, PCRE2_SIZE capture_top)

static void * emulated_memmove(void *d, const void *s, size_t n)

int isregfile(char *filename)

static BOOL line_buffered

struct patdatastr patdatastr

static pcre2_match_context * match_context

static omstr * only_matching

static BOOL resource_error

static const char * printname_nl

static int strcmpic(const char *str1, const char *str2)

static uint8_t utf8_buffer[8]

#define DEFAULT_CAPTURE_MAX

static BOOL test_incexc(char *path, patstr *ip, patstr *ep)

static int pcre2grep(void *handle, int frtype, const char *filename, const char *printname)

static patdatastr include_patdata

static const uint8_t * character_tables

static fnstr * include_from

static patdatastr exclude_patdata

static void print_match(const void *buf, int length)

static void write_final_newline(void)

struct option_item option_item

static BOOL read_pattern_file(char *name, patstr **patptr, patstr **patlastptr)

static PCRE2_SIZE * offsets

static int grep_or_recurse(char *pathname, BOOL dir_recurse, BOOL only_one_at_top)

static const char * output_text

static patstr ** incexlist[4]

static const char * incexname[4]

static const char * DEE_option

static const char * newlines[]

static char * previous_line(char *p, char *startptr)

static PCRE2_SIZE fill_buffer(void *handle, int frtype, char *buffer, PCRE2_SIZE length, BOOL input_line_buffered)

static pcre2_match_data * match_data

static fnstr * pattern_files_last

static patstr * exclude_patterns

#define N_NO_GROUP_SEPARATOR

static fnstr * exclude_from_last

static omstr * add_number(int n, omstr *after)

static char * end_of_line(char *p, char *endptr, int *lenptr)

static const char * om_separator

static void free_file_chain(fnstr *fn)

static patstr * patterns_last

static const char * newline_arg

static patstr * include_patterns_last

static fnstr * exclude_from

static uint32_t pcre2_options

static fndatastr include_from_data

int isdirectory(char *filename)

static PCRE2_SIZE bufthird

static patdatastr exclude_dir_patdata

static const char * colour_option

char * readdirectory(directory_type *dir)

static char * parse_grep_colors(const char *gc)

#define FWRITE_IGNORE(a, b, c, d)

static BOOL match_patterns(char *matchptr, PCRE2_SIZE length, unsigned int options, PCRE2_SIZE startoffset, int *mrc)

static long int decode_number(char *option_data, option_item *op, BOOL longop)

static pcre2_match_data * match_data_pair[2]

static patdatastr include_dir_patdata

static pcre2_compile_context * compile_context

static int decode_dollar_escape(PCRE2_SPTR begin, PCRE2_SPTR string, BOOL callout, uint32_t *value, PCRE2_SPTR *last)

static BOOL show_total_count

static const char * colour_string

static option_item optionlist[]

static PCRE2_JIT_STACK * jit_stack

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

#define PCRE2GREP_BUFSIZE

#define PCRE2GREP_MAX_BUFSIZE

CRef< objects::CObjectManager > om

static Uint4 letter(char c)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4