On Thu, 2 Jan 2003 01:44:21 -0500, "Serguei Mokhov" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to