summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/dumputils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/dumputils.c')
-rw-r--r--src/bin/pg_dump/dumputils.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c
index b662ad107e5..623c250eb89 100644
--- a/src/bin/pg_dump/dumputils.c
+++ b/src/bin/pg_dump/dumputils.c
@@ -17,7 +17,6 @@
#include <ctype.h>
#include "dumputils.h"
-#include "pg_backup.h"
#include "parser/keywords.h"
@@ -1231,6 +1230,37 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
/*
+ * Parse a --section=foo command line argument.
+ *
+ * Set or update the bitmask in *dumpSections according to arg.
+ * dumpSections is initialised as DUMP_UNSECTIONED by pg_dump and
+ * pg_restore so they can know if this has even been called.
+ */
+void
+set_dump_section(const char *arg, int *dumpSections)
+{
+ /* if this is the first call, clear all the bits */
+ if (*dumpSections == DUMP_UNSECTIONED)
+ *dumpSections = 0;
+
+ if (strcmp(arg,"pre-data") == 0)
+ *dumpSections |= DUMP_PRE_DATA;
+ else if (strcmp(arg,"data") == 0)
+ *dumpSections |= DUMP_DATA;
+ else if (strcmp(arg,"post-data") == 0)
+ *dumpSections |= DUMP_POST_DATA;
+ else
+ {
+ fprintf(stderr, _("%s: unknown section name \"%s\")\n"),
+ progname, arg);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
+ progname);
+ exit_nicely(1);
+ }
+}
+
+
+/*
* Write a printf-style message to stderr.
*
* The program name is prepended, if "progname" has been set.
@@ -1279,35 +1309,6 @@ exit_horribly(const char *modulename, const char *fmt,...)
exit_nicely(1);
}
-/*
- * Set the bitmask in dumpSections according to the first argument.
- * dumpSections is initialised as DUMP_UNSECTIONED by pg_dump and
- * pg_restore so they can know if this has even been called.
- */
-
-void
-set_section (const char *arg, int *dumpSections)
-{
- /* if this is the first, clear all the bits */
- if (*dumpSections == DUMP_UNSECTIONED)
- *dumpSections = 0;
-
- if (strcmp(arg,"pre-data") == 0)
- *dumpSections |= DUMP_PRE_DATA;
- else if (strcmp(arg,"data") == 0)
- *dumpSections |= DUMP_DATA;
- else if (strcmp(arg,"post-data") == 0)
- *dumpSections |= DUMP_POST_DATA;
- else
- {
- fprintf(stderr, _("%s: unknown section name \"%s\")\n"),
- progname, arg);
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
- progname);
- exit_nicely(1);
- }
-}
-
/* Register a callback to be run when exit_nicely is invoked. */
void
on_exit_nicely(on_exit_nicely_callback function, void *arg)