45 |
static int callout_fail_count; |
static int callout_fail_count; |
46 |
static int callout_fail_id; |
static int callout_fail_id; |
47 |
static int first_callout; |
static int first_callout; |
48 |
static int utf8; |
static int use_utf8; |
49 |
static size_t gotten_store; |
static size_t gotten_store; |
50 |
|
|
51 |
|
|
155 |
-6 to 0 => malformed UTF-8 character at offset = (-return) |
-6 to 0 => malformed UTF-8 character at offset = (-return) |
156 |
*/ |
*/ |
157 |
|
|
158 |
int |
static int |
159 |
utf82ord(unsigned char *buffer, int *vptr) |
utf82ord(unsigned char *buffer, int *vptr) |
160 |
{ |
{ |
161 |
int c = *buffer++; |
int c = *buffer++; |
213 |
|
|
214 |
while (length-- > 0) |
while (length-- > 0) |
215 |
{ |
{ |
216 |
if (utf8) |
if (use_utf8) |
217 |
{ |
{ |
218 |
int rc = utf82ord(p, &c); |
int rc = utf82ord(p, &c); |
219 |
|
|
270 |
|
|
271 |
if (callout_extra) |
if (callout_extra) |
272 |
{ |
{ |
|
int i; |
|
273 |
fprintf(f, "Callout %d: last capture = %d\n", |
fprintf(f, "Callout %d: last capture = %d\n", |
274 |
cb->callout_number, cb->capture_last); |
cb->callout_number, cb->capture_last); |
275 |
|
|
515 |
int do_showrest = 0; |
int do_showrest = 0; |
516 |
int erroroffset, len, delimiter; |
int erroroffset, len, delimiter; |
517 |
|
|
518 |
utf8 = 0; |
use_utf8 = 0; |
519 |
|
|
520 |
if (infile == stdin) printf(" re> "); |
if (infile == stdin) printf(" re> "); |
521 |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break; |
if (fgets((char *)buffer, sizeof(buffer), infile) == NULL) break; |
608 |
case 'S': do_study = 1; break; |
case 'S': do_study = 1; break; |
609 |
case 'U': options |= PCRE_UNGREEDY; break; |
case 'U': options |= PCRE_UNGREEDY; break; |
610 |
case 'X': options |= PCRE_EXTRA; break; |
case 'X': options |= PCRE_EXTRA; break; |
611 |
case '8': options |= PCRE_UTF8; utf8 = 1; break; |
case '8': options |= PCRE_UTF8; use_utf8 = 1; break; |
612 |
|
|
613 |
case 'L': |
case 'L': |
614 |
ppp = pp; |
ppp = pp; |
736 |
new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char); |
new_info(re, NULL, PCRE_INFO_LASTLITERAL, &need_char); |
737 |
new_info(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize); |
new_info(re, NULL, PCRE_INFO_NAMEENTRYSIZE, &nameentrysize); |
738 |
new_info(re, NULL, PCRE_INFO_NAMECOUNT, &namecount); |
new_info(re, NULL, PCRE_INFO_NAMECOUNT, &namecount); |
739 |
new_info(re, NULL, PCRE_INFO_NAMETABLE, &nametable); |
new_info(re, NULL, PCRE_INFO_NAMETABLE, (void *)&nametable); |
740 |
|
|
741 |
old_count = pcre_info(re, &old_options, &old_first_char); |
old_count = pcre_info(re, &old_options, &old_first_char); |
742 |
if (count < 0) fprintf(outfile, |
if (count < 0) fprintf(outfile, |
802 |
else |
else |
803 |
{ |
{ |
804 |
int ch = first_char & 255; |
int ch = first_char & 255; |
805 |
char *caseless = ((first_char & REQ_CASELESS) == 0)? |
const char *caseless = ((first_char & REQ_CASELESS) == 0)? |
806 |
"" : " (caseless)"; |
"" : " (caseless)"; |
807 |
if (isprint(ch)) |
if (isprint(ch)) |
808 |
fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless); |
fprintf(outfile, "First char = \'%c\'%s\n", ch, caseless); |
817 |
else |
else |
818 |
{ |
{ |
819 |
int ch = need_char & 255; |
int ch = need_char & 255; |
820 |
char *caseless = ((need_char & REQ_CASELESS) == 0)? |
const char *caseless = ((need_char & REQ_CASELESS) == 0)? |
821 |
"" : " (caseless)"; |
"" : " (caseless)"; |
822 |
if (isprint(ch)) |
if (isprint(ch)) |
823 |
fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless); |
fprintf(outfile, "Need char = \'%c\'%s\n", ch, caseless); |
972 |
c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W'); |
c = c * 16 + tolower(*pt) - ((isdigit(*pt))? '0' : 'W'); |
973 |
if (*pt == '}') |
if (*pt == '}') |
974 |
{ |
{ |
975 |
unsigned char buffer[8]; |
unsigned char buff8[8]; |
976 |
int ii, utn; |
int ii, utn; |
977 |
utn = ord2utf8(c, buffer); |
utn = ord2utf8(c, buff8); |
978 |
for (ii = 0; ii < utn - 1; ii++) *q++ = buffer[ii]; |
for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii]; |
979 |
c = buffer[ii]; /* Last byte */ |
c = buff8[ii]; /* Last byte */ |
980 |
p = pt + 1; |
p = pt + 1; |
981 |
break; |
break; |
982 |
} |
} |
1014 |
else if (isalnum(*p)) |
else if (isalnum(*p)) |
1015 |
{ |
{ |
1016 |
uschar name[256]; |
uschar name[256]; |
1017 |
uschar *pp = name; |
uschar *npp = name; |
1018 |
while (isalnum(*p)) *pp++ = *p++; |
while (isalnum(*p)) *npp++ = *p++; |
1019 |
*pp = 0; |
*npp = 0; |
1020 |
n = pcre_get_stringnumber(re, (char *)name); |
n = pcre_get_stringnumber(re, (char *)name); |
1021 |
if (n < 0) |
if (n < 0) |
1022 |
fprintf(outfile, "no parentheses with name \"%s\"\n", name); |
fprintf(outfile, "no parentheses with name \"%s\"\n", name); |
1067 |
else if (isalnum(*p)) |
else if (isalnum(*p)) |
1068 |
{ |
{ |
1069 |
uschar name[256]; |
uschar name[256]; |
1070 |
uschar *pp = name; |
uschar *npp = name; |
1071 |
while (isalnum(*p)) *pp++ = *p++; |
while (isalnum(*p)) *npp++ = *p++; |
1072 |
*pp = 0; |
*npp = 0; |
1073 |
n = pcre_get_stringnumber(re, (char *)name); |
n = pcre_get_stringnumber(re, (char *)name); |
1074 |
if (n < 0) |
if (n < 0) |
1075 |
fprintf(outfile, "no parentheses with name \"%s\"\n", name); |
fprintf(outfile, "no parentheses with name \"%s\"\n", name); |