@@ -36,9 +36,7 @@ char *password = NULL;
36
36
bool verbose = false;
37
37
bool quiet = false;
38
38
39
- #ifndef PGUT_NO_PROMPT
40
- YesNo prompt_password = DEFAULT ;
41
- #endif
39
+ bool prompt_password = false;
42
40
43
41
/* Database connections */
44
42
static PGcancel * volatile cancel_conn = NULL ;
@@ -76,10 +74,8 @@ static pgut_option default_options[] =
76
74
{ 'b' , 'q' , "quiet" , & quiet , SOURCE_CMDLINE },
77
75
{ 's' , 'U' , "username" , & username , SOURCE_CMDLINE },
78
76
{ 'b' , 'v' , "verbose" , & verbose , SOURCE_CMDLINE },
79
- #ifndef PGUT_NO_PROMPT
80
- { 'Y' , 'w' , "no-password" , & prompt_password , SOURCE_CMDLINE },
81
- { 'y' , 'W' , "password" , & prompt_password , SOURCE_CMDLINE },
82
- #endif
77
+ { 'B' , 'w' , "no-password" , & prompt_password , SOURCE_CMDLINE },
78
+ { 'b' , 'W' , "password" , & prompt_password , SOURCE_CMDLINE },
83
79
{ 0 }
84
80
};
85
81
@@ -98,8 +94,6 @@ option_has_arg(char type)
98
94
{
99
95
case 'b' :
100
96
case 'B' :
101
- case 'y' :
102
- case 'Y' :
103
97
return no_argument ;
104
98
default :
105
99
return required_argument ;
@@ -225,24 +219,6 @@ assign_option(pgut_option *opt, const char *optarg, pgut_optsrc src)
225
219
return ;
226
220
message = "a time" ;
227
221
break ;
228
- case 'y' :
229
- case 'Y' :
230
- if (optarg == NULL )
231
- {
232
- * (YesNo * ) opt -> var = (opt -> type == 'y' ? YES : NO );
233
- return ;
234
- }
235
- else
236
- {
237
- bool value ;
238
- if (parse_bool (optarg , & value ))
239
- {
240
- * (YesNo * ) opt -> var = (value ? YES : NO );
241
- return ;
242
- }
243
- }
244
- message = "a boolean" ;
245
- break ;
246
222
default :
247
223
elog (ERROR , "invalid option type: %c" , opt -> type );
248
224
return ; /* keep compiler quiet */
@@ -867,7 +843,6 @@ parse_pair(const char buffer[], char key[], char value[])
867
843
return true;
868
844
}
869
845
870
- #ifndef PGUT_NO_PROMPT
871
846
/*
872
847
* Ask the user for a password; 'username' is the username the
873
848
* password is for, if one has been explicitly specified.
@@ -902,7 +877,6 @@ prompt_for_password(const char *username)
902
877
}
903
878
#endif
904
879
}
905
- #endif
906
880
907
881
PGconn *
908
882
pgut_connect (const char * dbname )
@@ -912,10 +886,8 @@ pgut_connect(const char *dbname)
912
886
if (interrupted && !in_cleanup )
913
887
elog (ERROR , "interrupted" );
914
888
915
- #ifndef PGUT_NO_PROMPT
916
- if (prompt_password == YES )
889
+ if (prompt_password )
917
890
prompt_for_password (username );
918
- #endif
919
891
920
892
/* Start the connection. Loop until we have a password if requested by backend. */
921
893
for (;;)
@@ -925,14 +897,12 @@ pgut_connect(const char *dbname)
925
897
if (PQstatus (conn ) == CONNECTION_OK )
926
898
return conn ;
927
899
928
- #ifndef PGUT_NO_PROMPT
929
- if (conn && PQconnectionNeedsPassword (conn ) && prompt_password != NO )
900
+ if (conn && PQconnectionNeedsPassword (conn ) && prompt_password )
930
901
{
931
902
PQfinish (conn );
932
903
prompt_for_password (username );
933
904
continue ;
934
905
}
935
- #endif
936
906
elog (ERROR , "could not connect to database %s: %s" ,
937
907
dbname , PQerrorMessage (conn ));
938
908
@@ -1384,10 +1354,8 @@ help(bool details)
1384
1354
printf (" -h, --host=HOSTNAME database server host or socket directory\n" );
1385
1355
printf (" -p, --port=PORT database server port\n" );
1386
1356
printf (" -U, --username=USERNAME user name to connect as\n" );
1387
- #ifndef PGUT_NO_PROMPT
1388
1357
printf (" -w, --no-password never prompt for password\n" );
1389
1358
printf (" -W, --password force password prompt\n" );
1390
- #endif
1391
1359
}
1392
1360
1393
1361
printf ("\nGeneric options:\n" );
0 commit comments