| OLD | NEW |
| 1 /* | 1 /* |
| 2 * testRegexp.c: simple module for testing regular expressions | 2 * testRegexp.c: simple module for testing regular expressions |
| 3 * | 3 * |
| 4 * See Copyright for the status of this software. | 4 * See Copyright for the status of this software. |
| 5 * | 5 * |
| 6 * Daniel Veillard <veillard@redhat.com> | 6 * Daniel Veillard <veillard@redhat.com> |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "libxml.h" | 9 #include "libxml.h" |
| 10 #ifdef LIBXML_AUTOMATA_ENABLED | 10 #ifdef LIBXML_AUTOMATA_ENABLED |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 fclose(input); | 63 fclose(input); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 ret = 0; | 66 ret = 0; |
| 67 | 67 |
| 68 while (fgets(expr, 4500, input) != NULL) { | 68 while (fgets(expr, 4500, input) != NULL) { |
| 69 if (expr[0] == '#') | 69 if (expr[0] == '#') |
| 70 continue; | 70 continue; |
| 71 len = strlen(expr); | 71 len = strlen(expr); |
| 72 len--; | 72 len--; |
| 73 » while ((len >= 0) && | 73 » while ((len >= 0) && |
| 74 ((expr[len] == '\n') || (expr[len] == '\t') || | 74 ((expr[len] == '\n') || (expr[len] == '\t') || |
| 75 (expr[len] == '\r') || (expr[len] == ' '))) len--; | 75 (expr[len] == '\r') || (expr[len] == ' '))) len--; |
| 76 » expr[len + 1] = 0; | 76 » expr[len + 1] = 0; |
| 77 if (len >= 0) { | 77 if (len >= 0) { |
| 78 if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) { | 78 if ((am != NULL) && (expr[0] == 't') && (expr[1] == ' ')) { |
| 79 char *ptr = &expr[2]; | 79 char *ptr = &expr[2]; |
| 80 int from, to; | 80 int from, to; |
| 81 | 81 |
| 82 from = scanNumber(&ptr); | 82 from = scanNumber(&ptr); |
| 83 if (*ptr != ' ') { | 83 if (*ptr != ' ') { |
| 84 xmlGenericError(xmlGenericErrorContext, | 84 xmlGenericError(xmlGenericErrorContext, |
| 85 "Bad line %s\n", expr); | 85 "Bad line %s\n", expr); |
| 86 break; | 86 break; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return(0); | 300 return(0); |
| 301 } | 301 } |
| 302 | 302 |
| 303 #else | 303 #else |
| 304 #include <stdio.h> | 304 #include <stdio.h> |
| 305 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { | 305 int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { |
| 306 printf("%s : Automata support not compiled in\n", argv[0]); | 306 printf("%s : Automata support not compiled in\n", argv[0]); |
| 307 return(0); | 307 return(0); |
| 308 } | 308 } |
| 309 #endif /* LIBXML_AUTOMATA_ENABLED */ | 309 #endif /* LIBXML_AUTOMATA_ENABLED */ |
| OLD | NEW |