Mercurial > hg > dmlib
diff src/dmargs.h @ 2400:01c6a5261962
Sync commandline argument help printing/handling changes from th-libs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 12 Jan 2020 19:25:52 +0200 |
parents | c801995cbb13 |
children | 263093248f26 |
line wrap: on
line diff
--- a/src/dmargs.h Sun Jan 12 03:41:02 2020 +0200 +++ b/src/dmargs.h Sun Jan 12 19:25:52 2020 +0200 @@ -35,20 +35,26 @@ typedef struct { int id; ///< Option ID (should be unique for each option) - char o_short; ///< Short option name (one character) - char *o_long; ///< Long option name + char o_short; ///< Short option name (one character, can be 0 for none) + char *o_long; ///< Long option name (can be NULL for none) +#ifdef DM_USE_OPT_ARG + char *o_arg; ///< Option argument name (can be NULL for none/default) +#endif char *desc; ///< Option description int flags; ///< Flags (see OPT_*) } DMOptArg; -BOOL dmArgsProcess(int argc, char *argv[], - const DMOptArg *opts, const int nopts, - BOOL (*handle_option)(int id, char *, char *), - BOOL (*handle_other)(char *), const int flags); +BOOL dmArgsProcess(int argc, char *argv[], + const DMOptArg *opts, const int nopts, + BOOL (*handle_option)(int id, char *, char *), + BOOL (*handle_other)(char *), const int flags); -void dmArgsPrintHelp(FILE *, const DMOptArg *opts, - const int nopts, const int flags); +void dmArgsPrintHelp(FILE *fh, const DMOptArg *opts, + const int nopts, const int flags); + +void dmPrintWrap(FILE *fh, const char *str, + const int spad, const int rpad, const int width); #ifdef __cplusplus }