changeset 5634:df0a8c05ca58

(__argp_help): Create a fake struct argp_state and pass it to _help, otherwise the latter coredumps trying to dereference state.root_argp.
author Sergey Poznyakoff <gray@gnu.org.ua>
date Wed, 02 Feb 2005 23:26:56 +0000
parents 1b5ce9ca3c59
children c86fa81615ac
files lib/argp-help.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/argp-help.c
+++ b/lib/argp-help.c
@@ -1669,7 +1669,10 @@
 void __argp_help (const struct argp *argp, FILE *stream,
 		  unsigned flags, char *name)
 {
-  _help (argp, 0, stream, flags, name);
+  struct argp_state state;
+  memset (&state, 0, sizeof state);
+  state.root_argp = argp;
+  _help (argp, &state, stream, flags, name);
 }
 #ifdef weak_alias
 weak_alias (__argp_help, argp_help)