]> granicus.if.org Git - postgresql/commitdiff
Support long option for --pgdata in pg_verify_checksums
authorMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2018 12:33:48 +0000 (14:33 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2018 12:33:48 +0000 (14:33 +0200)
Author: Daniel Gustafsson <daniel@yesql.se>

doc/src/sgml/ref/pg_verify_checksums.sgml
src/bin/pg_verify_checksums/pg_verify_checksums.c

index 3416955ec9410ed536e15c95e614a29302d5159f..c4c15a46bacab7886307a71a49f36bf41053a947 100644 (file)
@@ -23,7 +23,7 @@ PostgreSQL documentation
   <cmdsynopsis>
    <command>pg_verify_checksums</command>
    <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>
  </refsynopsisdiv>
 
@@ -45,6 +45,7 @@ PostgreSQL documentation
 
      <varlistentry>
       <term><option>-D <replaceable>directory</replaceable></option></term>
+      <term><option>--pgdata=<replaceable>directory</replaceable></option></term>
       <listitem>
        <para>
         Specifies the directory where the database cluster is stored.
index 845d5aba27e5ee182837f6460e396eb2817cf5f8..48e754822cdf00fbeed730d6f03802d500b01095 100644 (file)
@@ -41,11 +41,11 @@ usage()
        printf(_("Usage:\n"));
        printf(_("  %s [OPTION] [DATADIR]\n"), progname);
        printf(_("\nOptions:\n"));
-       printf(_(" [-D] DATADIR    data directory\n"));
-       printf(_("  -r relfilenode check only relation with specified relfilenode\n"));
-       printf(_("  -d             debug output, listing all checked blocks\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(_("  -r relfilenode         check only relation with specified relfilenode\n"));
+       printf(_("  -d                     debug output, listing all checked blocks\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"));
@@ -205,8 +205,14 @@ scan_directory(char *basedir, char *subdir)
 int
 main(int argc, char *argv[])
 {
+       static struct option long_options[] = {
+               {"pgdata", required_argument, NULL, 'D'},
+               {NULL, 0, NULL, 0}
+       };
+
        char       *DataDir = NULL;
        int                     c;
+       int                     option_index;
        bool            crc_ok;
 
        set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verify_checksums"));
@@ -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)
                {