@@ -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)
205205int
206206main (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