Commit 741ee9dc authored by Magnus Hagander's avatar Magnus Hagander

Support long option for --pgdata in pg_verify_checksums

Author: Daniel Gustafsson <daniel@yesql.se>
parent d73300a2
...@@ -23,7 +23,7 @@ PostgreSQL documentation ...@@ -23,7 +23,7 @@ PostgreSQL documentation
<cmdsynopsis> <cmdsynopsis>
<command>pg_verify_checksums</command> <command>pg_verify_checksums</command>
<arg choice="opt"><replaceable class="parameter">option</replaceable></arg> <arg choice="opt"><replaceable class="parameter">option</replaceable></arg>
<arg choice="opt"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg> <arg choice="opt"><arg choice="opt"><option>-D</option></arg><arg choice="opt"><option>--pgdata</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
</cmdsynopsis> </cmdsynopsis>
</refsynopsisdiv> </refsynopsisdiv>
...@@ -45,6 +45,7 @@ PostgreSQL documentation ...@@ -45,6 +45,7 @@ PostgreSQL documentation
<varlistentry> <varlistentry>
<term><option>-D <replaceable>directory</replaceable></option></term> <term><option>-D <replaceable>directory</replaceable></option></term>
<term><option>--pgdata=<replaceable>directory</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies the directory where the database cluster is stored. Specifies the directory where the database cluster is stored.
......
...@@ -41,7 +41,7 @@ usage() ...@@ -41,7 +41,7 @@ usage()
printf(_("Usage:\n")); printf(_("Usage:\n"));
printf(_(" %s [OPTION] [DATADIR]\n"), progname); printf(_(" %s [OPTION] [DATADIR]\n"), progname);
printf(_("\nOptions:\n")); printf(_("\nOptions:\n"));
printf(_(" [-D] DATADIR data directory\n")); printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
printf(_(" -r relfilenode check only relation with specified relfilenode\n")); printf(_(" -r relfilenode check only relation with specified relfilenode\n"));
printf(_(" -d debug output, listing all checked blocks\n")); printf(_(" -d debug output, listing all checked blocks\n"));
printf(_(" -V, --version output version information, then exit\n")); printf(_(" -V, --version output version information, then exit\n"));
...@@ -205,8 +205,14 @@ scan_directory(char *basedir, char *subdir) ...@@ -205,8 +205,14 @@ scan_directory(char *basedir, char *subdir)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
static struct option long_options[] = {
{"pgdata", required_argument, NULL, 'D'},
{NULL, 0, NULL, 0}
};
char *DataDir = NULL; char *DataDir = NULL;
int c; int c;
int option_index;
bool crc_ok; bool crc_ok;
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verify_checksums")); set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verify_checksums"));
...@@ -227,7 +233,7 @@ main(int argc, char *argv[]) ...@@ -227,7 +233,7 @@ main(int argc, char *argv[])
} }
} }
while ((c = getopt(argc, argv, "D:r:d")) != -1) while ((c = getopt_long(argc, argv, "D:r:d", long_options, &option_index)) != -1)
{ {
switch (c) switch (c)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment