[PATCH] nscd: list all tables in usage()

Mike Frysinger vapier@gentoo.org
Thu Jan 2 11:13:00 GMT 2014


On Wednesday 01 January 2014 15:20:07 Sami Kerola wrote:
> --- a/nscd/nscd.c
> +++ b/nscd/nscd.c
>
>  more_help (int key, const char *text, void *input)
>  {
> -  char *tp = NULL;
> +  char *tables, *tp = NULL;
>    switch (key)

while you're here, could you add a newline above the switch statement too ?

>      {
>      case ARGP_KEY_HELP_EXTRA:
> +      {
> +	dbtype cnt;
> +
> +	tables = xcalloc (1, sizeof (dbnames) + 1);

you could keep the malloc ... just manually set the first byte to '\0'.  either 
is OK though.

> +	for (cnt = 0; cnt < lastdb; cnt++)
> +	  {
> +            strcat (tables, dbnames[cnt]);
> +	    strcat (tables, " ");
> +	  }
> +      }

hmm, is indentation correct with that first strcat ?  seems like it should be a 
tab and then four spaces.

> +
>        /* We print some extra information.  */
>        if (asprintf (&tp, gettext ("\
> +TABLE names are: %s\n\

how about:
	Supported tables:\n%s\n

that seems to match the style we have in `getent --help`.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-help/attachments/20140102/0d30f772/attachment.sig>


More information about the Libc-help mailing list