Re: stupid patch of pg_dumplo

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: andrea gelmini <bungle(at)linux(dot)it>
Cc: pgsql-patches(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: stupid patch of pg_dumplo
Date: 2001-11-12 10:51:23
Message-ID: 20011112115123.A8938@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Mon, Nov 12, 2001 at 10:46:37AM +0100, andrea gelmini wrote:
> > Please correct your patch and I mean will no problem add it to
> > official code.
> ok, tell me if this is good.

It seems good now.

I unsure if now is good time add it into 7.2 when we are in the beta
time. But it's simple, short patch into contrib. Bruce?

Karel

> how to lost one day on a stupid problem
>
> pgLO->port = strdup(optarg);

> and...
> the light...
>
> getopt_long(argc, argv, "?aehou:p:qd:l:t:irs:w"
>
> i put 'o' without ':'

:-) One good thing: you are now better C programmer that know how
works 'getopt' stuff.

> -----
>
> Common subdirectories: pg_dumplo.orig/CVS and pg_dumplo/CVS
> diff -c pg_dumplo.orig/main.c pg_dumplo/main.c
> *** pg_dumplo.orig/main.c Thu Oct 25 16:23:33 2001
> --- pg_dumplo/main.c Mon Nov 12 16:25:56 2001
> ***************
> *** 56,61 ****
> --- 56,62 ----
> pgLO->user = NULL;
> pgLO->db = NULL;
> pgLO->host = NULL;
> + pgLO->port = NULL;
> pgLO->space = NULL;
> pgLO->index = NULL;
> pgLO->remove = FALSE;
> ***************
> *** 81,86 ****
> --- 82,88 ----
> {"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,100 ****
> {NULL, 0, 0, 0}
> };
>
> ! while ((arg = getopt_long(argc, argv, "?aehu: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)
> {
> #endif
> switch (arg)
> --- 93,102 ----
> {NULL, 0, 0, 0}
> };
>
> ! 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, "?aeho:u:p:qd:l:t:irs:w")) != -1)
> {
> #endif
> switch (arg)
> ***************
> *** 109,114 ****
> --- 111,119 ----
> case 't':
> pgLO->host = strdup(optarg);
> break;
> + case 'o':
> + pgLO->port = strdup(optarg);
> + break;
> case 'p':
> pwd = strdup(optarg);
> break;
> ***************
> *** 173,179 ****
> /*
> * Make connection
> */
> ! pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
> pgLO->user, pwd);
>
> if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> --- 178,184 ----
> /*
> * Make connection
> */
> ! pgLO->conn = PQsetdbLogin(pgLO->host, pgLO->port, NULL, NULL, pgLO->db,
> pgLO->user, pwd);
>
> if (PQstatus(pgLO->conn) == CONNECTION_BAD)
> ***************
> *** 279,284 ****
> --- 284,290 ----
> "-p --password=<password> password for connection to server\n"
> "-d --db=<database> database name\n"
> "-t --host=<hostname> server hostname\n"
> + "-o --port=<port> database server port (default: 5432)\n"
> "-s --space=<dir> 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,300 ****
> --- 301,307 ----
> "-p <password> password for connection to server\n"
> "-d <database> database name\n"
> "-t <hostname> server hostname\n"
> + "-o <port> database server port (default: 5432)\n"
> "-s <dir> 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 -c pg_dumplo.orig/pg_dumplo.h pg_dumplo/pg_dumplo.h
> *** pg_dumplo.orig/pg_dumplo.h Tue Nov 6 13:17:39 2001
> --- pg_dumplo/pg_dumplo.h Mon Nov 12 14:04:48 2001
> ***************
> *** 51,56 ****
> --- 51,57 ----
> *user,
> *db,
> *host,
> + *port,
> *space;
> FILE *index;
> int counter,
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2001-11-12 16:44:21 Re: stupid patch of pg_dumplo
Previous Message andrea gelmini 2001-11-12 09:46:37 Re: stupid patch of pg_dumplo