diff --git a/src/bin/pg_test_timing/pg_test_timing.c b/src/bin/pg_test_timing/pg_test_timing.c index 6e2fd1a..254cc25 100644 --- a/src/bin/pg_test_timing/pg_test_timing.c +++ b/src/bin/pg_test_timing/pg_test_timing.c @@ -62,6 +62,7 @@ handle_args(int argc, char *argv[]) } } + bool has_options = false; while ((option = getopt_long(argc, argv, "d:", long_options, &optindex)) != -1) { @@ -69,6 +70,7 @@ handle_args(int argc, char *argv[]) { case 'd': test_duration = atoi(optarg); + has_options = true; break; default: @@ -89,6 +91,15 @@ handle_args(int argc, char *argv[]) exit(1); } + if (!has_options && argc > 1) + { + fprintf(stderr, _("%s: illegal option --\n"), + progname); + fprintf(stderr, _("Try \"%s --help\" for more information.\n"), + progname); + exit(1); + } + if (test_duration > 0) { printf(ngettext("Testing timing overhead for %d second.\n",