Differences From Artifact [51bd833f89]:
- File mod/kcli/usage.fn.c — part of check-in [927371b674] at 2019-10-31 03:44:25 on branch trunk — add usage display for parameters and command line switches for kcli_set, the structure used to define command line syntax for the parser; add more string & buffer functions (user: lexi, size: 2496) [annotate] [blame] [check-ins using]
To Artifact [a2f98072f0]:
- File mod/kcli/usage.fn.c — part of check-in [6aeac330ce] at 2020-01-31 05:58:38 on branch trunk — Add a final terminating null to first message in kcli_usage. This was causing the shared library build to segfault. Not perfect, as if there are no options, there will be two nulls, but two is better than none. (user: glowpelt, size: 2502) [annotate] [blame] [check-ins using]
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
const char* name = prg.name != null ? prg.name : _k_internal_binary_name; const char* msg [] = { name, " v", prg.version, "\n\n", prg.desc, "\n\n", "usage: ", _k_internal_binary_name, prg.optc == 0 ? null : " [-", }; if (!kokay(c = ksbufwrite(out, msg))) return c; u8 longest_opt = 0; u8 opt_lens [prg.optc]; for (sz i = 0; i != prg.optc; ++ i) { |
| |
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
const char* name = prg.name != null ?
prg.name : _k_internal_binary_name;
const char* msg [] = {
name, " v", prg.version, "\n\n",
prg.desc, "\n\n",
"usage: ", _k_internal_binary_name,
prg.optc == 0 ? null : " [-", null,
};
if (!kokay(c = ksbufwrite(out, msg))) return c;
u8 longest_opt = 0;
u8 opt_lens [prg.optc];
for (sz i = 0; i != prg.optc; ++ i) {
|