diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-03-24 21:14:20 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-03-24 21:49:53 -0400 |
commit | e22b27f0cb3ee03ee300d431997f5944ccf2d7b3 (patch) | |
tree | 54216b0125eddd13eb2aa220b4fd7d27a9ace45f /src | |
parent | 496d56670af44a2a578c15195c36f797e29cff24 (diff) | |
download | postgresql-e22b27f0cb3ee03ee300d431997f5944ccf2d7b3.tar.gz postgresql-e22b27f0cb3ee03ee300d431997f5944ccf2d7b3.zip |
Add long options to pg_resetwal and pg_controldata
We were running out of good single-letter options for some upcoming
pg_resetwal functionality, so add long options to create more
possibilities. Add to pg_controldata as well for symmetry.
based on patch by Bossart, Nathan <bossartn@amazon.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_controldata/pg_controldata.c | 13 | ||||
-rw-r--r-- | src/bin/pg_resetwal/pg_resetwal.c | 43 |
2 files changed, 38 insertions, 18 deletions
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index f9dc854b4a9..0dbf8e2f6b6 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -34,9 +34,9 @@ usage(const char *progname) printf(_("Usage:\n")); printf(_(" %s [OPTION] [DATADIR]\n"), progname); printf(_("\nOptions:\n")); - printf(_(" [-D] DATADIR data directory\n")); - printf(_(" -V, --version output version information, then exit\n")); - printf(_(" -?, --help show this help, then exit\n")); + printf(_(" [-D,--pgdata=]DATADIR data directory\n")); + printf(_(" -V, --version output version information, then exit\n")); + printf(_(" -?, --help show this help, then exit\n")); printf(_("\nIf no data directory (DATADIR) is specified, " "the environment variable PGDATA\nis used.\n\n")); printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n")); @@ -85,6 +85,11 @@ wal_level_str(WalLevel wal_level) int main(int argc, char *argv[]) { + static struct option long_options[] = { + {"pgdata", required_argument, NULL, 'D'}, + {NULL, 0, NULL, 0} + }; + ControlFileData *ControlFile; bool crc_ok; char *DataDir = NULL; @@ -118,7 +123,7 @@ main(int argc, char *argv[]) } } - while ((c = getopt(argc, argv, "D:")) != -1) + while ((c = getopt_long(argc, argv, "D:", long_options, NULL)) != -1) { switch (c) { diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index c99e7a8db1e..ba3b8b4d6b7 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -88,6 +88,20 @@ static void usage(void); int main(int argc, char *argv[]) { + static struct option long_options[] = { + {"commit-timestamp-ids", required_argument, NULL, 'c'}, + {"pgdata", required_argument, NULL, 'D'}, + {"epoch", required_argument, NULL, 'e'}, + {"force", no_argument, NULL, 'f'}, + {"next-wal-file", required_argument, NULL, 'l'}, + {"multixact-ids", required_argument, NULL, 'm'}, + {"dry-run", no_argument, NULL, 'n'}, + {"next-oid", required_argument, NULL, 'o'}, + {"multixact-offset", required_argument, NULL, 'O'}, + {"next-transaction-id", required_argument, NULL, 'x'}, + {NULL, 0, NULL, 0} + }; + int c; bool force = false; bool noupdate = false; @@ -117,7 +131,7 @@ main(int argc, char *argv[]) } - while ((c = getopt(argc, argv, "c:D:e:fl:m:no:O:x:")) != -1) + while ((c = getopt_long(argc, argv, "c:D:e:fl:m:no:O:x:", long_options, NULL)) != -1) { switch (c) { @@ -1251,18 +1265,19 @@ usage(void) printf(_("%s resets the PostgreSQL write-ahead log.\n\n"), progname); printf(_("Usage:\n %s [OPTION]... DATADIR\n\n"), progname); printf(_("Options:\n")); - printf(_(" -c XID,XID set oldest and newest transactions bearing commit timestamp\n")); - printf(_(" (zero in either value means no change)\n")); - printf(_(" [-D] DATADIR data directory\n")); - printf(_(" -e XIDEPOCH set next transaction ID epoch\n")); - printf(_(" -f force update to be done\n")); - printf(_(" -l WALFILE force minimum WAL starting location for new write-ahead log\n")); - printf(_(" -m MXID,MXID set next and oldest multitransaction ID\n")); - printf(_(" -n no update, just show what would be done (for testing)\n")); - printf(_(" -o OID set next OID\n")); - printf(_(" -O OFFSET set next multitransaction offset\n")); - printf(_(" -V, --version output version information, then exit\n")); - printf(_(" -x XID set next transaction ID\n")); - printf(_(" -?, --help show this help, then exit\n")); + printf(_(" -c, --commit-timestamp-ids=XID,XID\n" + " set oldest and newest transactions bearing\n" + " commit timestamp (zero means no change)\n")); + printf(_(" [-D, --pgdata=]DATADIR data directory\n")); + printf(_(" -e, --epoch=XIDEPOCH set next transaction ID epoch\n")); + printf(_(" -f, --force force update to be done\n")); + printf(_(" -l, --next-wal-file=WALFILE set minimum starting location for new WAL\n")); + printf(_(" -m, --multixact-ids=MXID,MXID set next and oldest multitransaction ID\n")); + printf(_(" -n, --dry-run no update, just show what would be done\n")); + printf(_(" -o, --next-oid=OID set next OID\n")); + printf(_(" -O, --multixact-offset=OFFSET set next multitransaction offset\n")); + printf(_(" -V, --version output version information, then exit\n")); + printf(_(" -x, --next-transaction-id=XID set next transaction ID\n")); + printf(_(" -?, --help show this help, then exit\n")); printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n")); } |