X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=t%2Fsrc%2Fgomtest.c;h=07cc066e1a9fc448a95229fbfcc8fe64400efb01;hb=d7e1e0c33172af1165d3059f67d51ec099fa4e02;hp=ad165fb1ac5d56decb329209984c26c3fbda89c7;hpb=26f6997a399d4e68ea4a9cea87c8c277fb06b709;p=gedcom-parse.git diff --git a/t/src/gomtest.c b/t/src/gomtest.c index ad165fb..07cc066 100644 --- a/t/src/gomtest.c +++ b/t/src/gomtest.c @@ -24,6 +24,7 @@ #include "gom.h" #include "output.h" #include "dump_gom.h" +#include "portability.h" #include #include #include "gedcom.h" @@ -41,6 +42,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 +56,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 +81,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,8 +117,8 @@ int main(int argc, char* argv[]) gedcom_set_error_handling(mech); gedcom_set_message_handler(gedcom_message_handler); - output_open(); - output(0, "\n=== Parsing file %s\n", file_name); + output_open(outfilename); + output(0, "\n=== Parsing file %s\n", simple_base_name(file_name)); result = gom_parse_file(file_name); if (result == 0) { output(1, "Parse succeeded\n");