Agreed. I have changed handling of the --help and --version options in all apps
where it exhibits the problem described, with the exception for
pg_archivecleanup
where getopt is used instead of getopt_long. The separate patch will be proposed
to address it.
The patch is against current master. All tests pass.
I doubt that -V & -? are heavily tested:-) Patch works for me, though.
There seems to be other instances as well:
./src/interfaces/ecpg/preproc/ecpg.c: while ((c = getopt_long(argc, argv,
"vcio:I:tD:dC:r:h", ecpg_options, NULL)) != -1)
./src/bin/scripts/clusterdb.c: while ((c = getopt_long(argc, argv,
"h:p:U:wWeqd:at:v", long_options, &optindex)) != -1)
./src/bin/scripts/createdb.c: while ((c = getopt_long(argc, argv,
"h:p:U:wWeO:D:T:E:l:", long_options, &optindex)) != -1)
./src/bin/scripts/dropuser.c: while ((c = getopt_long(argc, argv, "h:p:U:wWei",
long_options, &optindex)) != -1)
./src/bin/scripts/pg_isready.c: while ((c = getopt_long(argc, argv,
"d:h:p:qt:U:", long_options, NULL)) != -1)
./src/bin/scripts/dropdb.c: while ((c = getopt_long(argc, argv, "h:p:U:wWei",
long_options, &optindex)) != -1)
./src/bin/scripts/vacuumdb.c: while ((c = getopt_long(argc, argv,
"h:p:U:wWeqd:zZFat:fvj:", long_options, &optindex)) != -1)
./src/bin/scripts/createuser.c: while ((c = getopt_long(argc, argv,
"h:p:U:g:wWedDsSaArRiIlLc:PE",
./src/bin/scripts/reindexdb.c: while ((c = getopt_long(argc, argv,
"h:p:U:wWeqS:d:ast:i:v", long_options, &optindex)) != -1)
./src/interfaces/ecpg/preproc/ecpg.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./src/timezone/zic.c: else if (strcmp(argv[k], "--help") == 0)
./src/backend/main/main.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./src/bin/pg_archivecleanup/pg_archivecleanup.c: if (strcmp(argv[1],
"--help") == 0 || strcmp(argv[1], "-?") == 0)
./src/bin/pg_upgrade/option.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./src/bin/pg_ctl/pg_ctl.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./src/bin/psql/startup.c: if ((strcmp(argv[1], "-?") == 0) || (argc == 2
&& (strcmp(argv[1], "--help") == 0)))
./src/bin/scripts/common.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
=> implementation shared by many C "scripts".
./src/bin/pg_config/pg_config.c: if (strcmp(argv[i], "--help") == 0 ||
strcmp(argv[i], "-?") == 0)
./contrib/oid2name/oid2name.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./contrib/pg_standby/pg_standby.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
./contrib/vacuumlo/vacuumlo.c: if (strcmp(argv[1], "--help") == 0 ||
strcmp(argv[1], "-?") == 0)
--
Fabien.