Re: pg_dump.options.diff - Mailing list pgsql-hackers

From Manfred Koizar
Subject Re: pg_dump.options.diff
Date
Msg-id nj581v0j7ilphbc1mafp7kf5ankoju9jah@4ax.com
Whole thread Raw
In response to Re: pg_dump.options.diff  ("Serguei Mokhov" <mokhov@cs.concordia.ca>)
Responses Re: pg_dump.options.diff
List pgsql-hackers
On Thu, 2 Jan 2003 01:44:21 -0500, "Serguei Mokhov" <mokhov@cs.concordia.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_optionxo("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
levelfor 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 ...

ServusManfred


pgsql-hackers by date:

Previous
From: Daniel Kalchev
Date:
Subject: Re: Cast your vote ...
Next
From: "Michael Paesold"
Date:
Subject: Autocommit off and transaction isolation level