25 main(
int argc,
char *argv[])
29 static struct option long_options[] = {
45 char *dropuser = NULL;
52 bool interactive =
false;
65 while ((
c =
getopt_long(argc, argv,
"eh:ip:U:wW", long_options, &optindex)) != -1)
108 pg_log_error(
"too many command-line arguments (first is \"%s\")",
114 if (dropuser == NULL)
118 dropuser =
simple_prompt(
"Enter name of role to drop: ",
true);
130 printf(
_(
"Role \"%s\" will be permanently removed.\n"), dropuser);
173 printf(
_(
" -e, --echo show the commands being sent to the server\n"));
174 printf(
_(
" -i, --interactive prompt before deleting anything, and prompt for\n"
175 " role name if not specified\n"));
176 printf(
_(
" -V, --version output version information, then exit\n"));
177 printf(
_(
" --if-exists don't report error if user doesn't exist\n"));
178 printf(
_(
" -?, --help show this help, then exit\n"));
179 printf(
_(
"\nConnection options:\n"));
180 printf(
_(
" -h, --host=HOSTNAME database server host or socket directory\n"));
181 printf(
_(
" -p, --port=PORT database server port\n"));
182 printf(
_(
" -U, --username=USERNAME user name to connect as (not the one to drop)\n"));
183 printf(
_(
" -w, --no-password never prompt for password\n"));
184 printf(
_(
" -W, --password force password prompt\n"));
185 printf(
_(
"\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
186 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
bool yesno_prompt(const char *question)
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
PGconn * connectMaintenanceDatabase(ConnParams *cparams, const char *progname, bool echo)
int main(int argc, char *argv[])
static void help(const char *progname)
char * PQerrorMessage(const PGconn *conn)
void PQfinish(PGconn *conn)
ExecStatusType PQresultStatus(const PGresult *res)
PGresult * PQexec(PGconn *conn, const char *query)
char * pg_strdup(const char *in)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp)
PGDLLIMPORT char * optarg
const char * get_progname(const char *argv0)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
char * simple_prompt(const char *prompt, bool echo)
const char * fmtId(const char *rawid)
enum trivalue prompt_password