diff options
author | Bruce Momjian <bruce@momjian.us> | 2011-11-29 16:34:45 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2011-11-29 16:34:45 -0500 |
commit | 8b08deb0d1ee04a82130e640e48e302a3456817a (patch) | |
tree | 408b6fb90a1bb00ade40bf715315238dbc0e9eca /src/bin/pg_dump/dumputils.c | |
parent | b60f37bf44c248189ed8e4d925cd8e45308d54f8 (diff) | |
download | postgresql-8b08deb0d1ee04a82130e640e48e302a3456817a.tar.gz postgresql-8b08deb0d1ee04a82130e640e48e302a3456817a.zip |
Simplify the pg_dump/pg_restore error reporting macros, and allow
pg_dumpall to use the same memory allocation functions as the others.
Diffstat (limited to 'src/bin/pg_dump/dumputils.c')
-rw-r--r-- | src/bin/pg_dump/dumputils.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 92b9d28e7f1..39601e6a5fc 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -23,6 +23,7 @@ int quote_all_identifiers = 0; +const char *progname; #define supports_grant_options(version) ((version) >= 70400) @@ -1211,3 +1212,33 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer, appendPQExpBuffer(buffer, ";\n"); } } + + +void +write_msg(const char *modulename, const char *fmt,...) +{ + va_list ap; + + va_start(ap, fmt); + if (modulename) + fprintf(stderr, "%s: [%s] ", progname, _(modulename)); + else + fprintf(stderr, "%s: ", progname); + vfprintf(stderr, _(fmt), ap); + va_end(ap); +} + + +void +exit_horribly(const char *modulename, const char *fmt,...) +{ + va_list ap; + + va_start(ap, fmt); + write_msg(modulename, fmt, ap); + va_end(ap); + + exit(1); +} + + |