From d7a343d5ce984f5a76f3a7a54dfbf19bb355660f Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 12 Nov 2001 17:44:14 +0000 Subject: [PATCH] Add port number to pg_dumplo. andrea gelmini --- contrib/pg_dumplo/main.c | 15 +++++++++++---- contrib/pg_dumplo/pg_dumplo.h | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/contrib/pg_dumplo/main.c b/contrib/pg_dumplo/main.c index 45f5dc6312..78456e1234 100644 --- a/contrib/pg_dumplo/main.c +++ b/contrib/pg_dumplo/main.c @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- * pg_dumplo * - * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.9 2001/10/25 05:49:19 momjian Exp $ + * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.10 2001/11/12 17:44:14 momjian Exp $ * * Karel Zak 1999-2000 * ------------------------------------------------------------------------- @@ -56,6 +56,7 @@ main(int argc, char **argv) pgLO->user = NULL; pgLO->db = NULL; pgLO->host = NULL; + pgLO->port = NULL; pgLO->space = NULL; pgLO->index = NULL; pgLO->remove = FALSE; @@ -81,6 +82,7 @@ main(int argc, char **argv) {"pwd", required_argument, 0, 'p'}, {"db", required_argument, 0, 'd'}, {"host", required_argument, 0, 'h'}, + {"port", required_argument, 0, 'o'}, {"space", required_argument, 0, 's'}, {"import", no_argument, 0, 'i'}, {"export", no_argument, 0, 'e'}, @@ -91,10 +93,10 @@ main(int argc, char **argv) {NULL, 0, 0, 0} }; - while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1) + while ((arg = getopt_long(argc, argv, "?aeho:u:p:qd:l:t:irs:w", l_opt, &l_index)) != -1) { #else - while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1) + while ((arg = getopt(argc, argv, "?aeho:u:p:qd:l:t:irs:w")) != -1) { #endif switch (arg) @@ -109,6 +111,9 @@ main(int argc, char **argv) case 't': pgLO->host = strdup(optarg); break; + case 'o': + pgLO->port = strdup(optarg); + break; case 'p': pwd = strdup(optarg); break; @@ -173,7 +178,7 @@ main(int argc, char **argv) /* * Make connection */ - pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db, + pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db, pgLO->user, pwd); if (PQstatus(pgLO->conn) == CONNECTION_BAD) @@ -279,6 +284,7 @@ usage() "-p --password= password for connection to server\n" "-d --db= database name\n" "-t --host= server hostname\n" + "-o --port= database server port (default: 5432)\n" "-s --space= directory with dump tree (for export/import)\n" "-i --import import large obj dump tree to DB\n" "-e --export export (dump) large obj to dump tree\n" @@ -295,6 +301,7 @@ usage() "-p password for connection to server\n" "-d database name\n" "-t server hostname\n" + "-o database server port (default: 5432)\n" "-s directory with dump tree (for export/import)\n" "-i import large obj dump tree to DB\n" "-e export (dump) large obj to dump tree\n" diff --git a/contrib/pg_dumplo/pg_dumplo.h b/contrib/pg_dumplo/pg_dumplo.h index cbced20ec8..68a5e86061 100644 --- a/contrib/pg_dumplo/pg_dumplo.h +++ b/contrib/pg_dumplo/pg_dumplo.h @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- * pg_dumplo * - * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.7 2001/11/05 17:46:23 momjian Exp $ + * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.8 2001/11/12 17:44:14 momjian Exp $ * * Karel Zak 1999-2000 * ------------------------------------------------------------------------- @@ -51,6 +51,7 @@ typedef struct *user, *db, *host, + *port, *space; FILE *index; int counter, -- 2.40.0