|
|
|
|
@ -587,6 +587,91 @@ int yon_ubl_window_init(char *app_title, char *app_description, char *locale, ch
|
|
|
|
|
template_app_information.app_locale=locale;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments, int *arguments_size, char *additional_options_output){
|
|
|
|
|
(*arguments_size)=0;
|
|
|
|
|
int option_index=0;
|
|
|
|
|
int show_help=0;
|
|
|
|
|
int debug_mode=0;
|
|
|
|
|
{
|
|
|
|
|
struct option long_options[] = {
|
|
|
|
|
{"help", 0, 0, 'h'},
|
|
|
|
|
{"version", 0, 0, 'V'},
|
|
|
|
|
{"lock-help", 0,0, 1},
|
|
|
|
|
{"lock-save", 0,0, 2},
|
|
|
|
|
{"lock-save-local", 0,0, 3},
|
|
|
|
|
{"lock-save-global", 0,0, 4},
|
|
|
|
|
{"lock-load-global", 0,0, 5},
|
|
|
|
|
{"lock-load-local", 0,0, 6},
|
|
|
|
|
{"socket-id", 1, 0, 's'},
|
|
|
|
|
{"socket-ext-id", 1,0, 'e'},
|
|
|
|
|
{"socket-trd-id", 1,0, 't'},
|
|
|
|
|
{"clear-config", 0,0, 'c'},
|
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
config_str unregistered_arguments=NULL;
|
|
|
|
|
for (int i=1;i<argc;i++){
|
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:c",long_options,&option_index);
|
|
|
|
|
switch(argument){
|
|
|
|
|
case 'h':
|
|
|
|
|
show_help=1;
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
case 'V':
|
|
|
|
|
printf("%s\n",VERSION_LABEL);
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'e':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->save_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
if(optarg)
|
|
|
|
|
template_config->load_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'c': if (system(remove_config_dir_command)){};
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
template_config->lock_help=1;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
template_config->lock_load_global=1;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
template_config->lock_load_global=1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
char *unfound = optarg;
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(unregistered_arguments,arguments_size,yon_char_unite(argv[i],!yon_char_is_empty(unfound)?"=":"",!yon_char_is_empty(unfound)?unfound:"",NULL));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
(*unfound_arguments)=unregistered_arguments;
|
|
|
|
|
if (show_help&&!template_config->lock_help){
|
|
|
|
|
printf("%s\n",HELP_LABEL(additional_options_output));
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (getuid()!=0){
|
|
|
|
|
template_config->lock_load_global=1;
|
|
|
|
|
template_config->lock_save_global=1;
|
|
|
|
|
template_config->lock_save_local=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template_main_window *yon_ubl_window_setup(){
|
|
|
|
|
textdomain (template_ui_LocaleName);
|
|
|
|
|
setlocale(LC_ALL,"");
|
|
|
|
|
|