X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=t%2Fsrc%2Fupdate.c;h=d9f02a24651577a2145b3b543bf70dbd23ca88eb;hb=cf73759d92858885e4e71f6fc85f6d4478593958;hp=cc983768e6fef906efe39661fac83cd8d42b1642;hpb=26f6997a399d4e68ea4a9cea87c8c277fb06b709;p=gedcom-parse.git diff --git a/t/src/update.c b/t/src/update.c index cc98376..d9f02a2 100644 --- a/t/src/update.c +++ b/t/src/update.c @@ -44,6 +44,7 @@ void show_help () printf("Options:\n"); printf(" -h Show this help text\n"); printf(" -q No output to standard output\n"); + printf(" -o File to generate output to (def. testgedcom.out)\n"); } int test_xref_functions() @@ -135,6 +136,7 @@ int test_xref_functions() int main(int argc, char* argv[]) { int result; + char* outfilename = NULL; if (argc > 1) { int i; @@ -146,6 +148,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 { printf ("Unrecognized option: %s\n", argv[i]); show_help(); @@ -158,10 +171,11 @@ int main(int argc, char* argv[]) setlocale(LC_ALL, ""); gedcom_set_message_handler(gedcom_message_handler); - output_open(); + output_open(outfilename); result = gedcom_new_model(); - result |= test_xref_functions(); + if (result == 0) + result |= test_xref_functions(); if (result == 0) { output(1, "Test succeeded\n"); }