37 |
|
|
38 |
#define LOOPREPEAT 50000 |
#define LOOPREPEAT 50000 |
39 |
|
|
40 |
|
#define BUFFER_SIZE 30000 |
41 |
|
#define DBUFFER_SIZE 1024 |
42 |
|
|
43 |
|
|
44 |
static FILE *outfile; |
static FILE *outfile; |
45 |
static int log_store = 0; |
static int log_store = 0; |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
static int utf8_table1[] = { |
static const int utf8_table1[] = { |
57 |
0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff}; |
0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff}; |
58 |
|
|
59 |
static int utf8_table2[] = { |
static const int utf8_table2[] = { |
60 |
0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; |
0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc}; |
61 |
|
|
62 |
static int utf8_table3[] = { |
static const int utf8_table3[] = { |
63 |
0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01}; |
0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01}; |
64 |
|
|
65 |
|
|
390 |
#endif |
#endif |
391 |
int debug = 0; |
int debug = 0; |
392 |
int done = 0; |
int done = 0; |
393 |
unsigned char buffer[30000]; |
|
394 |
unsigned char dbuffer[1024]; |
unsigned char *buffer; |
395 |
|
unsigned char *dbuffer; |
396 |
|
|
397 |
|
/* Get buffers from malloc() so that Electric Fence will check their misuse |
398 |
|
when I am debugging. */ |
399 |
|
|
400 |
|
buffer = malloc(BUFFER_SIZE); |
401 |
|
dbuffer = malloc(DBUFFER_SIZE); |
402 |
|
|
403 |
/* Static so that new_malloc can use it. */ |
/* Static so that new_malloc can use it. */ |
404 |
|
|
528 |
use_utf8 = 0; |
use_utf8 = 0; |
529 |
|
|
530 |
if (infile == stdin) printf(" re> "); |
if (infile == stdin) printf(" re> "); |
531 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break; |
if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL) break; |
532 |
if (infile != stdin) fprintf(outfile, "%s", (char *)buffer); |
if (infile != stdin) fprintf(outfile, "%s", (char *)buffer); |
533 |
fflush(outfile); |
fflush(outfile); |
534 |
|
|
559 |
} |
} |
560 |
if (*pp != 0) break; |
if (*pp != 0) break; |
561 |
|
|
562 |
len = sizeof(buffer) - (pp - buffer); |
len = BUFFER_SIZE - (pp - buffer); |
563 |
if (len < 256) |
if (len < 256) |
564 |
{ |
{ |
565 |
fprintf(outfile, "** Expression too long - missing delimiter?\n"); |
fprintf(outfile, "** Expression too long - missing delimiter?\n"); |
658 |
|
|
659 |
if (rc != 0) |
if (rc != 0) |
660 |
{ |
{ |
661 |
(void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); |
(void)regerror(rc, &preg, (char *)buffer, BUFFER_SIZE); |
662 |
fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer); |
fprintf(outfile, "Failed: POSIX code %d: %s\n", rc, buffer); |
663 |
goto SKIP_DATA; |
goto SKIP_DATA; |
664 |
} |
} |
699 |
{ |
{ |
700 |
for (;;) |
for (;;) |
701 |
{ |
{ |
702 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) |
if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL) |
703 |
{ |
{ |
704 |
done = 1; |
done = 1; |
705 |
goto CONTINUE; |
goto CONTINUE; |
931 |
callout_fail_id = -1; |
callout_fail_id = -1; |
932 |
|
|
933 |
if (infile == stdin) printf("data> "); |
if (infile == stdin) printf("data> "); |
934 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) |
if (fgets((char *)buffer, BUFFER_SIZE, infile) == NULL) |
935 |
{ |
{ |
936 |
done = 1; |
done = 1; |
937 |
goto CONTINUE; |
goto CONTINUE; |
1144 |
|
|
1145 |
if (rc != 0) |
if (rc != 0) |
1146 |
{ |
{ |
1147 |
(void)regerror(rc, &preg, (char *)buffer, sizeof(buffer)); |
(void)regerror(rc, &preg, (char *)buffer, BUFFER_SIZE); |
1148 |
fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer); |
fprintf(outfile, "No match: POSIX code %d: %s\n", rc, buffer); |
1149 |
} |
} |
1150 |
else |
else |