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