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");
30 int main(int argc, char* argv[])
32 MECHANISM mech = IMMED_FAIL;
33 int compat_enabled = 1;
35 char* file_name = NULL;
39 for (i=1; i<argc; i++) {
40 if (!strncmp(argv[i], "-da", 4))
42 else if (!strncmp(argv[i], "-dg", 4))
44 else if (!strncmp(argv[i], "-fi", 4))
46 else if (!strncmp(argv[i], "-fd", 4))
48 else if (!strncmp(argv[i], "-fn", 4))
50 else if (!strncmp(argv[i], "-nc", 4))
52 else if (!strncmp(argv[i], "-h", 3)) {
56 else if (strncmp(argv[i], "-", 1)) {
61 printf ("Unrecognized option: %s\n", argv[i]);
69 printf("No file name given\n");
74 gedcom_set_debug_level(debug_level);
75 gedcom_set_compat_handling(compat_enabled);
76 gedcom_set_error_handling(mech);
78 if (gedcom_parse_file(file_name) == 0) {
79 printf("Parse succeeded\n");
83 printf("Parse failed\n");