fixed for new vesrion of usefull_macros

This commit is contained in:
2026-01-26 16:54:50 +03:00
parent 50cbaea550
commit a80347643f
25 changed files with 107 additions and 103 deletions

View File

@@ -46,7 +46,7 @@ static glob_pars const Gdefault = {
* 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
{"help", NO_ARGS, NULL, 'h', arg_int, APTR(&help), _("show this help")},
{"port", NEED_ARG, NULL, 'P', arg_string, APTR(&G.port), _("port to connect (default: " DEFAULT_PORT ")")},
@@ -73,13 +73,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){
fprintf(stderr, "Undefined extra parameters!\n");
showhelp(-1, cmdlnopts);
sl_showhelp(-1, cmdlnopts);
G.rest_pars_num = argc;
G.rest_pars = MALLOC(char *, argc);
for (i = 0; i < argc; i++)

View File

@@ -36,7 +36,7 @@ void signals(int sig){
signal(sig, SIG_IGN);
DBG("Get signal %d, quit.\n", sig);
}
restore_console();
sl_restore_con();
exit(sig);
}
@@ -45,7 +45,7 @@ void iffound_default(pid_t pid){
}
int main(int argc, char *argv[]){
initial_setup();
sl_init();
char *self = strdup(argv[0]);
GP = parse_args(argc, argv);
DBG("here");
@@ -66,7 +66,7 @@ int main(int argc, char *argv[]){
signal(SIGQUIT, signals); // ctrl+\ - quit
signal(SIGTSTP, SIG_IGN); // ignore ctrl+Z
DBG("here");
setup_con();
sl_setup_con();
/*
if(GP->rest_pars_num){
for(int i = 0; i < GP->rest_pars_num; ++i)