+2019-01-05 Bruno Haible <bruno@clisp.org>
+
+ argp: Don't pass an invalid argument to dgettext().
+ Reported by He X <xw897002528@gmail.com>.
+ * lib/argp.h (struct argp): Clarify that the args_doc field may be NULL.
+ * lib/argp-help.c (argp_args_usage): Don't pass a NULL args_doc to
+ dgettext().
+
2018-12-22 Paul Eggert <eggert@cs.ucla.edu>
stdioext: port to newer 32-bit Android
char *our_level = *levels;
int multiple = 0;
const struct argp_child *child = argp->children;
- const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
+ const char *tdoc =
+ argp->args_doc ? dgettext (argp->argp_domain, argp->args_doc) : NULL;
const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
+ const char *nl = NULL;
if (fdoc)
{
extern "C" {
#endif
+/* Glibc documentation:
+ https://www.gnu.org/software/libc/manual/html_node/Argp.html */
+
/* A description of a particular option. A pointer to an array of
these is passed in the OPTIONS field of an argp structure. Each option
entry can correspond to one long option and/or one short option; more
ARGP_KEY_ definitions below. */
argp_parser_t parser;
- /* A string describing what other arguments are wanted by this program. It
- is only used by argp_usage to print the "Usage:" message. If it
- contains newlines, the strings separated by them are considered
+ /* If non-NULL, a string describing what other arguments are wanted by this
+ program. It is only used by argp_usage to print the "Usage:" message.
+ If it contains newlines, the strings separated by them are considered
alternative usage patterns, and printed on separate lines (lines after
the first are prefix by " or: " instead of "Usage:"). */
const char *args_doc;