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 22 const char* name = prg.name != null ? 23 23 prg.name : _k_internal_binary_name; 24 24 25 25 const char* msg [] = { 26 26 name, " v", prg.version, "\n\n", 27 27 prg.desc, "\n\n", 28 28 "usage: ", _k_internal_binary_name, 29 - prg.optc == 0 ? null : " [-", 29 + prg.optc == 0 ? null : " [-", null, 30 30 }; 31 31 32 32 if (!kokay(c = ksbufwrite(out, msg))) return c; 33 33 34 34 u8 longest_opt = 0; 35 35 u8 opt_lens [prg.optc]; 36 36 for (sz i = 0; i != prg.optc; ++ i) {