1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Simplify the pg_dump/pg_restore error reporting macros, and allow

pg_dumpall to use the same memory allocation functions as the others.
This commit is contained in:
Bruce Momjian
2011-11-29 16:34:45 -05:00
parent b60f37bf44
commit 8b08deb0d1
12 changed files with 54 additions and 92 deletions

View File

@ -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);
}