Re: pg_dump.options.diff

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: pg_dump.options.diff
Date: 2003-01-02 10:52:32
Message-ID: nj581v0j7ilphbc1mafp7kf5ankoju9jah@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Thu, 2 Jan 2003 01:44:21 -0500, "Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca> wrote:
>Either way, something has to be donw about this...

Just another way to do it:

#if defined(HAVE_GETOPT_LONG)
#define PARMPREFIX '='
#else
#define PARMPREFIX ' '
#endif

static void
explain_option(char *shortform, char *longform, char *parm, char *desc)
{
int pos = 0;

printf(" -%s", shortform);
pos += 3 + strlen(shortform);

#if defined(HAVE_GETOPT_LONG)
printf(", --%s", longform);
pos += 4 + strlen(longform);
#endif

if (parm) {
printf("%c%s", PARMPREFIX, parm);
pos += 1 + strlen(parm);
}/*if*/

printf("%*c", 27 - pos, ' ');
printf("%s\n", desc);
}/*explain_option*/

#define xo explain_option
xo("f", "file", "FILENAME", "output file name");
xo("F", "format", "c|t|p", "output file format (custom, tar, plain text)");
xo("i", "ignore-version", NULL, "proceed even when server version mismatches\n"
" pg_dump version");
xo("v", "verbose", NULL, "verbose mode");
xo("Z", "compress", "0-9", "compression level for compressed formats");

This is only a quick hack, I didn't care for _() and
explain_option() could be smarter about multi line descriptions,
but you get the idea ...

Servus
Manfred

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paesold 2003-01-02 12:29:07 Autocommit off and transaction isolation level
Previous Message Daniel Kalchev 2003-01-02 08:53:22 Re: [HACKERS] Cast your vote ...

Browse pgsql-patches by date

  From Date Subject
Next Message Michael Paesold 2003-01-02 12:29:07 Autocommit off and transaction isolation level
Previous Message Serguei Mokhov 2003-01-02 08:58:19 Re: more adequate usage msg: pg_controldata.diff