*** pgsql/src/bin/scripts/dropdb.c 2009/02/25 13:03:07 1.25 --- pgsql/src/bin/scripts/dropdb.c 2009/02/26 16:02:39 1.26 *************** *** 5,11 **** * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.24 2009/01/01 17:23:55 momjian Exp $ * *------------------------------------------------------------------------- */ --- 5,11 ---- * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * ! * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.25 2009/02/25 13:03:07 petere Exp $ * *------------------------------------------------------------------------- */ *************** main(int argc, char *argv[]) *** 25,30 **** --- 25,31 ---- {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, *************** main(int argc, char *argv[]) *** 40,46 **** char *host = NULL; char *port = NULL; char *username = NULL; ! bool password = false; bool echo = false; bool interactive = false; --- 41,47 ---- char *host = NULL; char *port = NULL; char *username = NULL; ! enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool interactive = false; *************** main(int argc, char *argv[]) *** 54,60 **** handle_help_version_opts(argc, argv, "dropdb", help); ! while ((c = getopt_long(argc, argv, "h:p:U:Weqi", long_options, &optindex)) != -1) { switch (c) { --- 55,61 ---- handle_help_version_opts(argc, argv, "dropdb", help); ! while ((c = getopt_long(argc, argv, "h:p:U:wWeqi", long_options, &optindex)) != -1) { switch (c) { *************** main(int argc, char *argv[]) *** 67,74 **** case 'U': username = optarg; break; case 'W': ! password = true; break; case 'e': echo = true; --- 68,78 ---- case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': ! prompt_password = TRI_YES; break; case 'e': echo = true; *************** main(int argc, char *argv[]) *** 114,120 **** fmtId(dbname)); conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres", ! host, port, username, password, progname); if (echo) printf("%s", sql.data); --- 118,124 ---- fmtId(dbname)); conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres", ! host, port, username, prompt_password, progname); if (echo) printf("%s", sql.data); *************** help(const char *progname) *** 148,153 **** --- 152,158 ---- printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nReport bugs to .\n")); }