X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;ds=sidebyside;f=t%2Fsrc%2Fgomtest.c;h=942f703f44dec5bb5b70132a8b608aa502872f1f;hb=8b767bf5e44f07a29ed3ef77af27bf29f2db729a;hp=ad165fb1ac5d56decb329209984c26c3fbda89c7;hpb=26f6997a399d4e68ea4a9cea87c8c277fb06b709;p=gedcom-parse.git diff --git a/t/src/gomtest.c b/t/src/gomtest.c index ad165fb..942f703 100644 --- a/t/src/gomtest.c +++ b/t/src/gomtest.c @@ -41,6 +41,7 @@ void show_help () printf(" -dg Debug setting: only libgedcom debug messages\n"); printf(" -da Debug setting: libgedcom + yacc debug messages\n"); printf(" -q No output to standard output\n"); + printf(" -o File to generate output to (def. testgedcom.out)\n"); } void gedcom_message_handler(Gedcom_msg_type type, char *msg) @@ -54,6 +55,7 @@ int main(int argc, char* argv[]) int compat_enabled = 1; int debug_level = 0; int result = 0; + char* outfilename = NULL; char* file_name = NULL; if (argc > 1) { @@ -78,6 +80,17 @@ int main(int argc, char* argv[]) else if (!strncmp(argv[i], "-q", 3)) { output_set_quiet(1); } + else if (!strncmp(argv[i], "-o", 3)) { + i++; + if (i < argc) { + outfilename = argv[i]; + } + else { + printf ("Missing output file name\n"); + show_help(); + exit(1); + } + } else if (strncmp(argv[i], "-", 1)) { file_name = argv[i]; break; @@ -103,7 +116,7 @@ int main(int argc, char* argv[]) gedcom_set_error_handling(mech); gedcom_set_message_handler(gedcom_message_handler); - output_open(); + output_open(outfilename); output(0, "\n=== Parsing file %s\n", file_name); result = gom_parse_file(file_name); if (result == 0) {