comparison 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
comparison
equal deleted inserted replaced
2399:5d391c31ebc9 2400:01c6a5261962
33 /** Option argument structure 33 /** Option argument structure
34 */ 34 */
35 typedef struct 35 typedef struct
36 { 36 {
37 int id; ///< Option ID (should be unique for each option) 37 int id; ///< Option ID (should be unique for each option)
38 char o_short; ///< Short option name (one character) 38 char o_short; ///< Short option name (one character, can be 0 for none)
39 char *o_long; ///< Long option name 39 char *o_long; ///< Long option name (can be NULL for none)
40 #ifdef DM_USE_OPT_ARG
41 char *o_arg; ///< Option argument name (can be NULL for none/default)
42 #endif
40 char *desc; ///< Option description 43 char *desc; ///< Option description
41 int flags; ///< Flags (see OPT_*) 44 int flags; ///< Flags (see OPT_*)
42 } DMOptArg; 45 } DMOptArg;
43 46
44 47
45 BOOL dmArgsProcess(int argc, char *argv[], 48 BOOL dmArgsProcess(int argc, char *argv[],
46 const DMOptArg *opts, const int nopts, 49 const DMOptArg *opts, const int nopts,
47 BOOL (*handle_option)(int id, char *, char *), 50 BOOL (*handle_option)(int id, char *, char *),
48 BOOL (*handle_other)(char *), const int flags); 51 BOOL (*handle_other)(char *), const int flags);
49 52
50 void dmArgsPrintHelp(FILE *, const DMOptArg *opts, 53 void dmArgsPrintHelp(FILE *fh, const DMOptArg *opts,
51 const int nopts, const int flags); 54 const int nopts, const int flags);
55
56 void dmPrintWrap(FILE *fh, const char *str,
57 const int spad, const int rpad, const int width);
52 58
53 #ifdef __cplusplus 59 #ifdef __cplusplus
54 } 60 }
55 #endif 61 #endif
56 #endif // DMARGS_H 62 #endif // DMARGS_H