bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argmatch: accept perfect matches in documented arglists


From: Bruno Haible
Subject: Re: argmatch: accept perfect matches in documented arglists
Date: Sun, 05 May 2019 16:28:21 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-145-generic; KDE/5.18.0; x86_64; ; )

Hi Akim,

> Is this what you have in mind?

OK, I now see where you are heading.

> +typedef struct argmatch_group

This type and the argmatch_usage function would go into argmatch.h or
in a new header file argmatch2.h or argmatch+.h, right?

> +static const char *const backup_docs[] =
> +{
> +  N_("never make backups (even if --backup is given)"),
> +  N_("make numbered backups"),
> +  N_("numbered if numbered backups exist, simple otherwise"),
> +  N_("always make simple backups"),
> +  NULL
> +};
> +
> +static const enum backup_type backup_doc_vals[] =
> +{
> +  no_backups,
> +  simple_backups,
> +  numbered_existing_backups,
> +  numbered_backups
> +};

This is hard to maintain. Better put things next to each other that
belong together. Namely, can you put the enum value and each docstring
into a single struct?

    { no_backups, N_("never make backups (even if --backup is given)") },
    { simple_backups, N_("make numbered backups") },
    { numbered_existing_backups, N_("numbered if numbered backups exist, simple 
otherwise") },
    { numbered_backups, N_("always make simple backups") },

> I'd be happy to check the output of argmatch_usage, but I don't think
> we have the equivalent of string streams in gnulib, do we?

If you are happy with a test that is executed on glibc platforms only,
you can use the open_memstream function [1]. Skip the tests on the other
platforms.

Bruno

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/open_memstream.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]