summaryrefslogtreecommitdiff
path: root/src/bin/pg_controldata
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_controldata')
-rw-r--r--src/bin/pg_controldata/Makefile4
-rw-r--r--src/bin/pg_controldata/pg_controldata.c11
2 files changed, 9 insertions, 6 deletions
diff --git a/src/bin/pg_controldata/Makefile b/src/bin/pg_controldata/Makefile
index 2d5c5621318..4d9c1370fe7 100644
--- a/src/bin/pg_controldata/Makefile
+++ b/src/bin/pg_controldata/Makefile
@@ -15,11 +15,13 @@ subdir = src/bin/pg_controldata
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
+LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils
+
OBJS= pg_controldata.o $(WIN32RES)
all: pg_controldata
-pg_controldata: $(OBJS) | submake-libpgport
+pg_controldata: $(OBJS) | submake-libpgport submake-libpgfeutils
$(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
install: all installdirs
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index 9a17d0f9c0f..a674f52f0b8 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -25,6 +25,7 @@
#include "access/xlog_internal.h"
#include "catalog/pg_control.h"
#include "common/controldata_utils.h"
+#include "fe_utils/logging.h"
#include "pg_getopt.h"
#include "getopt_long.h"
@@ -107,8 +108,8 @@ main(int argc, char *argv[])
int i;
int WalSegSz;
+ pg_logging_init(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
-
progname = get_progname(argv[0]);
if (argc > 1)
@@ -150,8 +151,8 @@ main(int argc, char *argv[])
/* Complain if any arguments remain */
if (optind < argc)
{
- fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
- progname, argv[optind]);
+ pg_log_error("too many command-line arguments (first is \"%s\")",
+ argv[optind]);
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
progname);
exit(1);
@@ -159,13 +160,13 @@ main(int argc, char *argv[])
if (DataDir == NULL)
{
- fprintf(stderr, _("%s: no data directory specified\n"), progname);
+ pg_log_error("no data directory specified");
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
}
/* get a copy of the control file */
- ControlFile = get_controlfile(DataDir, progname, &crc_ok);
+ ControlFile = get_controlfile(DataDir, &crc_ok);
if (!crc_ok)
printf(_("WARNING: Calculated CRC checksum does not match value stored in file.\n"
"Either the file is corrupt, or it has a different layout than this program\n"