8 printf("gedcom-parse test program for libgedcom\n");
10 printf(" -h Show this help text\n");
11 printf(" -nc Disable compatibility mode\n");
12 printf(" -fi Fail immediately on errors\n");
13 printf(" -fd Deferred fail on errors, but parse completely\n");
14 printf(" -fn No fail on errors\n");
15 printf(" -dg Debug setting: only libgedcom debug messages\n");
16 printf(" -da Debug setting: libgedcom + yacc debug messages\n");
19 int main(int argc, char* argv[])
21 MECHANISM mech = IMMED_FAIL;
22 int compat_enabled = 1;
26 for (i=1; i<argc; i++) {
27 if (!strncmp(argv[i], "-da", 4))
29 else if (!strncmp(argv[i], "-dg", 4))
31 else if (!strncmp(argv[i], "-fi", 4))
33 else if (!strncmp(argv[i], "-fd", 4))
35 else if (!strncmp(argv[i], "-fn", 4))
37 else if (!strncmp(argv[i], "-nc", 4))
39 else if (!strncmp(argv[i], "-h", 3)) {
44 printf ("Unrecognized option: %s\n", argv[i]);
50 gedcom_set_debug_level(debug_level);
51 gedcom_set_compat_handling(compat_enabled);
52 gedcom_set_error_handling(mech);
53 if (gedcom_parse() == 0) {
54 printf("Parse succeeded\n");
58 printf("Parse failed\n");
63 int gedcom_warning(char* s, ...)
69 fprintf(stderr, "Warning on line %d: ", line_no);
70 res = vfprintf(stderr, s, ap);
71 fprintf(stderr, "\n");
77 int gedcom_error(char* s, ...)
83 fprintf(stderr, "Error on line %d: ", line_no);
84 res = vfprintf(stderr, s, ap);
85 fprintf(stderr, "\n");