This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
[PATCH] 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, Petr Baudis <pasky at suse dot cz>
- Date: Wed, 1 Jan 2014 12:38:35 +0000
- Subject: [PATCH] nscd: list all tables in usage()
- Authentication-results: sourceware.org; auth=none
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 | 4 ++++
nscd/nscd.c | 24 +++++++++++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c2c47d8..a9c7ddb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-01 Sami Kerola <kerolasa@iki.fi>
+
+ * nscd/nscd.c: Improve usage() output.
+
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..ed7da7a 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -442,15 +442,33 @@ 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, *p, *tp = NULL;
switch (key)
{
case ARGP_KEY_HELP_EXTRA:
+ {
+ dbtype cnt;
+ size_t len;
+ tables = xmalloc (sizeof (dbnames) + 1);
+ p = tables;
+ for (cnt = 0; cnt < lastdb; cnt++)
+ {
+ len = strlen (dbnames[cnt]);
+ memcpy (p, dbnames[cnt], len);
+ p += len;
+ *p++ = ' ';
+ }
+ *p = '\0';
+ }
+
/* We print some extra information. */
if (asprintf (&tp, gettext ("\
+TABLE names are: %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;
--
1.8.5.2