improve to libusefull_macros v0.3.2

This commit is contained in:
2025-04-28 13:07:13 +03:00
parent 3090f2c85e
commit 7b4ecde5fb
17 changed files with 87 additions and 76 deletions

View File

@@ -61,7 +61,7 @@ static glob_pars G = {
* Define command line options by filling structure:
* name has_arg flag val type argptr help
*/
static myoption cmdlnopts[] = {
static sl_option_t cmdlnopts[] = {
// common options
{"maxexp", NEED_ARG, NULL, 0, arg_double, APTR(&G.maxexp), _("maximal exposition time (ms), default: 500")},
{"minexp", NEED_ARG, NULL, 0, arg_double, APTR(&G.minexp), _("minimal exposition time (ms), default: 0.001")},
@@ -106,13 +106,13 @@ glob_pars *parse_args(int argc, char **argv){
char helpstring[1024], *hptr = helpstring;
snprintf(hptr, hlen, "Usage: %%s [args]\n\n\tWhere args are:\n");
// format of help: "Usage: progname [args]\n"
change_helpstring(helpstring);
sl_helpstring(helpstring);
// parse arguments
parseargs(&argc, &argv, cmdlnopts);
if(help) showhelp(-1, cmdlnopts);
sl_parseargs(&argc, &argv, cmdlnopts);
if(help) sl_showhelp(-1, cmdlnopts);
if(argc > 0){
WARNX("Extra parameters!");
showhelp(-1, cmdlnopts);
sl_showhelp(-1, cmdlnopts);
}
return &G;
}