Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 741ee9d

Browse files
committed
Support long option for --pgdata in pg_verify_checksums
Author: Daniel Gustafsson <daniel@yesql.se>
1 parent d73300a commit 741ee9d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

doc/src/sgml/ref/pg_verify_checksums.sgml

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PostgreSQL documentation
2323
<cmdsynopsis>
2424
<command>pg_verify_checksums</command>
2525
<arg choice="opt"><replaceable class="parameter">option</replaceable></arg>
26-
<arg choice="opt"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
26+
<arg choice="opt"><arg choice="opt"><option>-D</option></arg><arg choice="opt"><option>--pgdata</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
2727
</cmdsynopsis>
2828
</refsynopsisdiv>
2929

@@ -45,6 +45,7 @@ PostgreSQL documentation
4545

4646
<varlistentry>
4747
<term><option>-D <replaceable>directory</replaceable></option></term>
48+
<term><option>--pgdata=<replaceable>directory</replaceable></option></term>
4849
<listitem>
4950
<para>
5051
Specifies the directory where the database cluster is stored.

src/bin/pg_verify_checksums/pg_verify_checksums.c

+12-6
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ usage()
4141
printf(_("Usage:\n"));
4242
printf(_(" %s [OPTION] [DATADIR]\n"), progname);
4343
printf(_("\nOptions:\n"));
44-
printf(_(" [-D] DATADIR data directory\n"));
45-
printf(_(" -r relfilenode check only relation with specified relfilenode\n"));
46-
printf(_(" -d debug output, listing all checked blocks\n"));
47-
printf(_(" -V, --version output version information, then exit\n"));
48-
printf(_(" -?, --help show this help, then exit\n"));
44+
printf(_(" [-D, --pgdata=]DATADIR data directory\n"));
45+
printf(_(" -r relfilenode check only relation with specified relfilenode\n"));
46+
printf(_(" -d debug output, listing all checked blocks\n"));
47+
printf(_(" -V, --version output version information, then exit\n"));
48+
printf(_(" -?, --help show this help, then exit\n"));
4949
printf(_("\nIf no data directory (DATADIR) is specified, "
5050
"the environment variable PGDATA\nis used.\n\n"));
5151
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -205,8 +205,14 @@ scan_directory(char *basedir, char *subdir)
205205
int
206206
main(int argc, char *argv[])
207207
{
208+
static struct option long_options[] = {
209+
{"pgdata", required_argument, NULL, 'D'},
210+
{NULL, 0, NULL, 0}
211+
};
212+
208213
char *DataDir = NULL;
209214
int c;
215+
int option_index;
210216
bool crc_ok;
211217

212218
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verify_checksums"));
@@ -227,7 +233,7 @@ main(int argc, char *argv[])
227233
}
228234
}
229235

230-
while ((c = getopt(argc, argv, "D:r:d")) != -1)
236+
while ((c = getopt_long(argc, argv, "D:r:d", long_options, &option_index)) != -1)
231237
{
232238
switch (c)
233239
{

0 commit comments

Comments
 (0)