This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
[PATCH 1/2] nscd: list all tables in usage()
- From: Sami Kerola <kerolasa at iki dot fi>
- To: libc-help at sourceware dot org
- Cc: kerolasa at iki dot fi
- Date: Fri, 3 Jan 2014 21:00:56 +0000
- Subject: [PATCH 1/2] nscd: list all tables in usage()
- Authentication-results: sourceware.org; auth=none
- References: <201401030812 dot 18617 dot vapier at gentoo dot org> <1388695739-1248-1-git-send-email-kerolasa at iki dot fi> <201401020612 dot 59677 dot vapier at gentoo dot org> <1388607607-16716-1-git-send-email-kerolasa at iki dot fi> <1388695739-1248-1-git-send-email-kerolasa at iki dot fi>
On 3 January 2014 13:12, Mike Frysinger <vapier@gentoo.org> wrote:
> On Thursday 02 January 2014 15:48:59 Sami Kerola wrote:
>> + tables = xmalloc (1, sizeof (dbnames) + 1);
>
> pretty sure that doesn't compile :)
Oh dear, oh dear, oh dear. Here we ago again, there really should be a
note in the coding standard a programmer should always wear a programmer
hat, that gives electric shocks when a patch submission without testing
is thought, even subconsciously.
--->8----
From: Sami Kerola <kerolasa@iki.fi>
Date: Fri, 3 Jan 2014 19:48:51 +0000
Subject: [PATCH 1/2] nscd: list all tables in usage()
Usage output for option --invalidate=TABLE is not helpful without
list of tables. The list is also missing from nscd(8) manual which
made it pretty difficult to know what are the tables.
---
ChangeLog | 5 ++++-
nscd/nscd.c | 25 ++++++++++++++++++++++---
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 74ffbff..bac04e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-03 Sami Kerola <kerolasa@iki.fi>
+
+ * nscd/nscd.c: Improve usage() output.
+
2014-01-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/multiarch/strcasecmp-power7.S: Remove
@@ -86,7 +90,6 @@
* sysdeps/i386/fpu/libm-test-ulps: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
-
2014-01-01 Allan McRae <allan@archlinux.org>
* scripts/update-copyrights: Update configure input file suffix.
diff --git a/nscd/nscd.c b/nscd/nscd.c
index e7f04f8..63d9d83 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -442,19 +442,38 @@ parse_opt (int key, char *arg, struct argp_state *state)
static char *
more_help (int key, const char *text, void *input)
{
- char *tp = NULL;
+ char *tables, *tp = NULL;
+
switch (key)
{
case ARGP_KEY_HELP_EXTRA:
+ {
+ dbtype cnt;
+
+ tables = xmalloc (sizeof (dbnames) + 1);
+ for (cnt = 0; cnt < lastdb; cnt++)
+ {
+ strcat (tables, dbnames[cnt]);
+ strcat (tables, " ");
+ }
+ }
+
/* We print some extra information. */
if (asprintf (&tp, gettext ("\
+Supported tables:\n\
+%s\n\
+\n\
For bug reporting instructions, please see:\n\
-%s.\n"), REPORT_BUGS_TO) < 0)
- return NULL;
+%s.\n\
+"), tables, REPORT_BUGS_TO) < 0)
+ tp = NULL;
+ free (tables);
return tp;
+
default:
break;
}
+
return (char *) text;
}
--
1.8.5.2