From cbb7acface7115dfb17674a68086bc82a3b8fa11 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 22 Sep 2006 18:50:41 +0000 Subject: Rearrange yes/no prompting code so that the prompts always show the (possibly (un)translated) letters that are actually expected as input. Also reject invalid responses instead of silenty taken them as "no". with help from Bernd Helmle --- src/bin/scripts/createuser.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/bin/scripts/createuser.c') diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c index e671298fda2..a3f5747004e 100644 --- a/src/bin/scripts/createuser.c +++ b/src/bin/scripts/createuser.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.32 2006/06/01 00:15:36 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.33 2006/09/22 18:50:41 petere Exp $ * *------------------------------------------------------------------------- */ @@ -192,10 +192,7 @@ main(int argc, char *argv[]) if (superuser == 0) { - char *reply; - - reply = simple_prompt("Shall the new role be a superuser? (y/n) ", 1, true); - if (check_yesno_response(reply) == 1) + if (yesno_prompt("Shall the new role be a superuser?")) superuser = TRI_YES; else superuser = TRI_NO; @@ -210,10 +207,7 @@ main(int argc, char *argv[]) if (createdb == 0) { - char *reply; - - reply = simple_prompt("Shall the new role be allowed to create databases? (y/n) ", 1, true); - if (check_yesno_response(reply) == 1) + if (yesno_prompt("Shall the new role be allowed to create databases?")) createdb = TRI_YES; else createdb = TRI_NO; @@ -221,10 +215,7 @@ main(int argc, char *argv[]) if (createrole == 0) { - char *reply; - - reply = simple_prompt("Shall the new role be allowed to create more new roles? (y/n) ", 1, true); - if (check_yesno_response(reply) == 1) + if (yesno_prompt("Shall the new role be allowed to create more new roles?")) createrole = TRI_YES; else createrole = TRI_NO; -- cgit v1.2.3