<cmdsynopsis>
<command>pg_controldata</command>
<arg choice="opt"><replaceable class="parameter">option</replaceable></arg>
- <arg choice="opt"><replaceable class="parameter">datadir</replaceable></arg>
+ <arg choice="opt"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<arg choice="opt"><option>-m</option> <replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></arg>
<arg choice="opt"><option>-O</option> <replaceable class="parameter">mxoff</replaceable></arg>
<arg choice="opt"><option>-l</option> <replaceable class="parameter">xlogfile</replaceable></arg>
- <arg choice="plain"><replaceable>datadir</replaceable></arg>
+ <arg choice="req"><arg choice="opt"><option>-D</option></arg> <replaceable class="parameter">datadir</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
{
printf(_("%s displays control information of a PostgreSQL database cluster.\n\n"), progname);
printf(_("Usage:\n"));
- printf(_(" %s [OPTION] [DATADIR]\n"), progname);
+ printf(_(" %s [OPTION] [[-D] DATADIR]\n"), progname);
printf(_("\nOptions:\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
MultiXactId set_oldestmxid = 0;
char *endptr;
char *endptr2;
- char *DataDir;
+ char *DataDir = NULL;
int fd;
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_resetxlog"));
}
- while ((c = getopt(argc, argv, "fl:m:no:O:x:e:")) != -1)
+ while ((c = getopt(argc, argv, "D:fl:m:no:O:x:e:")) != -1)
{
switch (c)
{
+ case 'D':
+ DataDir = optarg;
+ break;
+
case 'f':
force = true;
break;
}
}
- if (optind == argc)
+ if (DataDir == NULL && optind == argc)
{
fprintf(stderr, _("%s: no data directory specified\n"), progname);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
}
+ if (DataDir == NULL)
+ DataDir = argv[optind];
/*
* Don't allow pg_resetxlog to be run as root, to avoid overwriting the
}
#endif
- DataDir = argv[optind];
-
if (chdir(DataDir) < 0)
{
fprintf(stderr, _("%s: could not change directory to \"%s\": %s\n"),
usage(void)
{
printf(_("%s resets the PostgreSQL transaction log.\n\n"), progname);
- printf(_("Usage:\n %s [OPTION]... DATADIR\n\n"), progname);
+ printf(_("Usage:\n %s [OPTION]... {[-D] DATADIR}\n\n"), progname);
printf(_("Options:\n"));
printf(_(" -e XIDEPOCH set next transaction ID epoch\n"));
printf(_(" -f force update to be done\n"));