1 /* This program is free software; you can redistribute it and/or modify *
2 * it under the terms of the GNU General Public License as published by *
3 * the Free Software Foundation; either version 2 of the License, or *
4 * (at your option) any later version. *
6 (C) 2001 by The Genes Development Team
7 Original author: Peter Verthez (Peter.Verthez@advalvas.be)
18 printf("gedcom-parse test program for libgedcom\n\n");
19 printf("Usage: gedcom-parse [options] file\n");
21 printf(" -h Show this help text\n");
22 printf(" -nc Disable compatibility mode\n");
23 printf(" -fi Fail immediately on errors\n");
24 printf(" -fd Deferred fail on errors, but parse completely\n");
25 printf(" -fn No fail on errors\n");
26 printf(" -dg Debug setting: only libgedcom debug messages\n");
27 printf(" -da Debug setting: libgedcom + yacc debug messages\n");
28 printf(" -2 Run the test parse 2 times instead of once\n");
29 printf(" -3 Run the test parse 3 times instead of once\n");
32 int main(int argc, char* argv[])
34 MECHANISM mech = IMMED_FAIL;
35 int compat_enabled = 1;
39 char* file_name = NULL;
43 for (i=1; i<argc; i++) {
44 if (!strncmp(argv[i], "-da", 4))
46 else if (!strncmp(argv[i], "-dg", 4))
48 else if (!strncmp(argv[i], "-fi", 4))
50 else if (!strncmp(argv[i], "-fd", 4))
52 else if (!strncmp(argv[i], "-fn", 4))
54 else if (!strncmp(argv[i], "-nc", 4))
56 else if (!strncmp(argv[i], "-h", 3)) {
60 else if (!strncmp(argv[i], "-2", 3)) {
63 else if (!strncmp(argv[i], "-3", 3)) {
66 else if (strncmp(argv[i], "-", 1)) {
71 printf ("Unrecognized option: %s\n", argv[i]);
79 printf("No file name given\n");
84 gedcom_set_debug_level(debug_level);
85 gedcom_set_compat_handling(compat_enabled);
86 gedcom_set_error_handling(mech);
88 while (run_times-- > 0) {
89 result |= gedcom_parse_file(file_name);
92 printf("Parse succeeded\n");
96 printf("Parse failed\n");