Skip to content

Commit f35d0d7

Browse files
committed
Code cleanup. Delete -W option
1 parent e2eed71 commit f35d0d7

File tree

3 files changed

+17
-46
lines changed

3 files changed

+17
-46
lines changed

catalog.c

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -479,58 +479,37 @@ pgBackupWriteIni(pgBackup *backup)
479479
static pgBackup *
480480
read_backup_from_file(const char *path)
481481
{
482-
pgBackup *backup;
482+
pgBackup *backup = pgut_new(pgBackup);
483483
char *backup_mode = NULL;
484484
char *start_lsn = NULL;
485485
char *stop_lsn = NULL;
486486
char *status = NULL;
487487
char *parent_backup = NULL;
488-
int i;
489488

490489
pgut_option options[] =
491490
{
492-
{'s', 0, "backup-mode", NULL, SOURCE_FILE_STRICT},
493-
{'u', 0, "timelineid", NULL, SOURCE_FILE_STRICT},
494-
{'s', 0, "start-lsn", NULL, SOURCE_FILE_STRICT},
495-
{'s', 0, "stop-lsn", NULL, SOURCE_FILE_STRICT},
496-
{'t', 0, "start-time", NULL, SOURCE_FILE_STRICT},
497-
{'t', 0, "end-time", NULL, SOURCE_FILE_STRICT},
498-
{'U', 0, "recovery-xid", NULL, SOURCE_FILE_STRICT},
499-
{'t', 0, "recovery-time", NULL, SOURCE_FILE_STRICT},
500-
{'I', 0, "data-bytes", NULL, SOURCE_FILE_STRICT},
501-
{'u', 0, "block-size", NULL, SOURCE_FILE_STRICT},
502-
{'u', 0, "xlog-block-size", NULL, SOURCE_FILE_STRICT},
503-
{'u', 0, "checksum_version", NULL, SOURCE_FILE_STRICT},
504-
{'u', 0, "stream", NULL, SOURCE_FILE_STRICT},
505-
{'s', 0, "status", NULL, SOURCE_FILE_STRICT},
506-
{'s', 0, "parent_backup", NULL, SOURCE_FILE_STRICT},
491+
{'s', 0, "backup-mode", &backup_mode, SOURCE_FILE_STRICT},
492+
{'u', 0, "timelineid", &backup->tli, SOURCE_FILE_STRICT},
493+
{'s', 0, "start-lsn", &start_lsn, SOURCE_FILE_STRICT},
494+
{'s', 0, "stop-lsn", &stop_lsn, SOURCE_FILE_STRICT},
495+
{'t', 0, "start-time", &backup->start_time, SOURCE_FILE_STRICT},
496+
{'t', 0, "end-time", &backup->end_time, SOURCE_FILE_STRICT},
497+
{'U', 0, "recovery-xid", &backup->recovery_xid, SOURCE_FILE_STRICT},
498+
{'t', 0, "recovery-time", &backup->recovery_time, SOURCE_FILE_STRICT},
499+
{'I', 0, "data-bytes", &backup->data_bytes, SOURCE_FILE_STRICT},
500+
{'u', 0, "block-size", &backup->block_size, SOURCE_FILE_STRICT},
501+
{'u', 0, "xlog-block-size", &backup->wal_block_size, SOURCE_FILE_STRICT},
502+
{'u', 0, "checksum_version", &backup->checksum_version, SOURCE_FILE_STRICT},
503+
{'u', 0, "stream", &backup->stream, SOURCE_FILE_STRICT},
504+
{'s', 0, "status", &status, SOURCE_FILE_STRICT},
505+
{'s', 0, "parent_backup", &parent_backup, SOURCE_FILE_STRICT},
507506
{0}
508507
};
509508

510509
if (access(path, F_OK) != 0)
511510
return NULL;
512511

513-
backup = pgut_new(pgBackup);
514512
init_backup(backup);
515-
516-
i = 0;
517-
options[i++].var = &backup_mode;
518-
options[i++].var = &backup->tli;
519-
options[i++].var = &start_lsn;
520-
options[i++].var = &stop_lsn;
521-
options[i++].var = &backup->start_time;
522-
options[i++].var = &backup->end_time;
523-
options[i++].var = &backup->recovery_xid;
524-
options[i++].var = &backup->recovery_time;
525-
options[i++].var = &backup->data_bytes;
526-
options[i++].var = &backup->block_size;
527-
options[i++].var = &backup->wal_block_size;
528-
options[i++].var = &backup->checksum_version;
529-
options[i++].var = &backup->stream;
530-
options[i++].var = &status;
531-
options[i++].var = &parent_backup;
532-
Assert(i == lengthof(options) - 1);
533-
534513
pgut_readopt(path, options, ERROR);
535514

536515
if (backup_mode)

pgut/pgut.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ const char *username = NULL;
3535
char *password = NULL;
3636
bool verbose = false;
3737
bool quiet = false;
38-
39-
bool prompt_password = false;
38+
bool prompt_password = true;
4039

4140
/* Database connections */
4241
static PGcancel *volatile cancel_conn = NULL;
@@ -75,7 +74,6 @@ static pgut_option default_options[] =
7574
{ 's', 'U', "username" , &username, SOURCE_CMDLINE },
7675
{ 'b', 'v', "verbose" , &verbose, SOURCE_CMDLINE },
7776
{ 'B', 'w', "no-password" , &prompt_password, SOURCE_CMDLINE },
78-
{ 'b', 'W', "password" , &prompt_password, SOURCE_CMDLINE },
7977
{ 0 }
8078
};
8179

@@ -882,13 +880,9 @@ PGconn *
882880
pgut_connect(const char *dbname)
883881
{
884882
PGconn *conn;
885-
886883
if (interrupted && !in_cleanup)
887884
elog(ERROR, "interrupted");
888885

889-
if (prompt_password)
890-
prompt_for_password(username);
891-
892886
/* Start the connection. Loop until we have a password if requested by backend. */
893887
for (;;)
894888
{

pgut/pgut.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ extern char *password;
8686
extern bool verbose;
8787
extern bool quiet;
8888

89-
extern bool prompt_password;
90-
9189
extern bool interrupted;
9290

9391
extern void help(bool details);

0 commit comments

Comments
 (0)