Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d7a343d

Browse files
committed
Add port number to pg_dumplo.
andrea gelmini
1 parent 611afd9 commit d7a343d

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

contrib/pg_dumplo/main.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -------------------------------------------------------------------------
22
* pg_dumplo
33
*
4-
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.9 2001/10/25 05:49:19 momjian Exp $
4+
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.10 2001/11/12 17:44:14 momjian Exp $
55
*
66
* Karel Zak 1999-2000
77
* -------------------------------------------------------------------------
@@ -56,6 +56,7 @@ main(int argc, char **argv)
5656
pgLO->user = NULL;
5757
pgLO->db = NULL;
5858
pgLO->host = NULL;
59+
pgLO->port = NULL;
5960
pgLO->space = NULL;
6061
pgLO->index = NULL;
6162
pgLO->remove = FALSE;
@@ -81,6 +82,7 @@ main(int argc, char **argv)
8182
{"pwd", required_argument, 0, 'p'},
8283
{"db", required_argument, 0, 'd'},
8384
{"host", required_argument, 0, 'h'},
85+
{"port", required_argument, 0, 'o'},
8486
{"space", required_argument, 0, 's'},
8587
{"import", no_argument, 0, 'i'},
8688
{"export", no_argument, 0, 'e'},
@@ -91,10 +93,10 @@ main(int argc, char **argv)
9193
{NULL, 0, 0, 0}
9294
};
9395

94-
while ((arg = getopt_long(argc, argv, "?aehu:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
96+
while ((arg = getopt_long(argc, argv, "?aeho:u:p:qd:l:t:irs:w", l_opt, &l_index)) != -1)
9597
{
9698
#else
97-
while ((arg = getopt(argc, argv, "?aehu:p:qd:l:t:irs:w")) != -1)
99+
while ((arg = getopt(argc, argv, "?aeho:u:p:qd:l:t:irs:w")) != -1)
98100
{
99101
#endif
100102
switch (arg)
@@ -109,6 +111,9 @@ main(int argc, char **argv)
109111
case 't':
110112
pgLO->host = strdup(optarg);
111113
break;
114+
case 'o':
115+
pgLO->port = strdup(optarg);
116+
break;
112117
case 'p':
113118
pwd = strdup(optarg);
114119
break;
@@ -173,7 +178,7 @@ main(int argc, char **argv)
173178
/*
174179
* Make connection
175180
*/
176-
pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
181+
pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
177182
pgLO->user, pwd);
178183

179184
if (PQstatus(pgLO->conn) == CONNECTION_BAD)
@@ -279,6 +284,7 @@ usage()
279284
"-p --password=<password> password for connection to server\n"
280285
"-d --db=<database> database name\n"
281286
"-t --host=<hostname> server hostname\n"
287+
"-o --port=<port> database server port (default: 5432)\n"
282288
"-s --space=<dir> directory with dump tree (for export/import)\n"
283289
"-i --import import large obj dump tree to DB\n"
284290
"-e --export export (dump) large obj to dump tree\n"
@@ -295,6 +301,7 @@ usage()
295301
"-p <password> password for connection to server\n"
296302
"-d <database> database name\n"
297303
"-t <hostname> server hostname\n"
304+
"-o <port> database server port (default: 5432)\n"
298305
"-s <dir> directory with dump tree (for export/import)\n"
299306
"-i import large obj dump tree to DB\n"
300307
"-e export (dump) large obj to dump tree\n"

contrib/pg_dumplo/pg_dumplo.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -------------------------------------------------------------------------
22
* pg_dumplo
33
*
4-
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.7 2001/11/05 17:46:23 momjian Exp $
4+
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/pg_dumplo.h,v 1.8 2001/11/12 17:44:14 momjian Exp $
55
*
66
* Karel Zak 1999-2000
77
* -------------------------------------------------------------------------
@@ -51,6 +51,7 @@ typedef struct
5151
*user,
5252
*db,
5353
*host,
54+
*port,
5455
*space;
5556
FILE *index;
5657
int counter,

0 commit comments

Comments
 (0)