Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group