Commit 7b32c3fb authored by Niels Möller's avatar Niels Möller
Browse files

* src/argp/argp-parse.c (parser_init): Added cast to void * to

STORAGE macro.
(__argp_usage, __option_is_short, __option_is_end ): Replicated
definitons from argp.h.

Rev: src/argp/argp-parse.c:1.3
parent d175f265
......@@ -513,7 +513,7 @@ parser_init (struct parser *parser, const struct argp *argp,
#define CLEN (szs.num_child_inputs * sizeof (void *))
#define LLEN ((szs.long_len + 1) * sizeof (struct option))
#define SLEN (szs.short_len + 1)
#define STORAGE(offset) (((char *) parser->storage) + (offset))
#define STORAGE(offset) ((void *) (((char *) parser->storage) + (offset)))
parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
if (! parser->storage)
......@@ -959,3 +959,29 @@ __argp_input (const struct argp *argp, const struct argp_state *state)
#ifdef weak_alias
weak_alias (__argp_input, _argp_input)
#endif
/* Defined here, in case a user is not inlining the definitions in
* argp.h */
void
__argp_usage (__const struct argp_state *__state) __THROW
{
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
}
int
__option_is_short (__const struct argp_option *__opt) __THROW
{
if (__opt->flags & OPTION_DOC)
return 0;
else
{
int __key = __opt->key;
return __key > 0 && isprint (__key);
}
}
int
__option_is_end (__const struct argp_option *__opt) __THROW
{
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment