diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 98c75c1c148984a4bc900e4cd5ba23fedf056641..42ea7259c31963ff871c201b8215745086532223 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -41,11 +41,13 @@ char *tmpval = value; int optisset=0; char defbool[2]="1"; - if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) == 0) && value == NULL ) { /* not a boolean, argument required */ + if ( value == NULL) { + if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */ fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname); return 0; - } else { /* boolean value option without argument, set value to true*/ + } else { /* boolean value option without argument, set value to true*/ tmpval = defbool; + } } switch(cfgoptions->type) { @@ -124,8 +126,8 @@ char *cfgpath; if (strcmp(*p, "-h") == 0 || strcmp(*p, "--help") == 0 ) { config_printhelp(cfgoptions,numoptions); } - if (*p[0] == '-') { - + + if (*p[0] == '-') { for(int i=0;i<numoptions;i++) { if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) { continue; @@ -135,17 +137,17 @@ char *cfgpath; } else { sprintf(cfgpath,"%s",cfgoptions[i].optname); } + if ( ((strlen(*p) == 2) && (strcmp(*p + 1,cfgpath) == 0)) || ((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) { pp = *(p+1); - if ( ( pp != NULL ) && (pp[0]!= '-') ) { - p++; - c--; + if ( ( pp != NULL ) && (c>1) && (pp[0]!= '-') ) { + j += processoption(&(cfgoptions[i]), pp); } else { j += processoption(&(cfgoptions[i]), NULL); } - + break; } } /* for */ } /* if (*p[0] == '-') */ diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 60bcefad5ea74f0ecb9b0ca717dccfa491e2ebc3..8351d4d82c143bf05601638fcebe4e80e1f02039 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -109,14 +109,14 @@ char *atoken; uint32_t tmpflags=0; int i; - /* first parse the command line to look for the -O option */ opterr=0; - while ((i = getopt(argc, argv, "O:h")) != -1) { - if ( i == 'O' ) { - cfgparam = optarg; + for (i = 0;i<argc;i++) { + if (strlen(argv[i]) < 2) continue; + if ( argv[i][1] == 'O' && i < (argc -1)) { + cfgparam = argv[i+1]; } - if ( i == 'h' ) { + if ( argv[i][1] == 'h' ) { tmpflags = CONFIG_HELP; } } diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index 25fc6102f56f4a9d1d559a4f11cd21bbfe1b2ad0..ad2e355d528153d8591ba7f89065b7c6cdeae2a4 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -123,6 +123,11 @@ void config_printhelp(paramdef_t *params,int numparams) int config_get(paramdef_t *params,int numparams, char *prefix) { int ret= -1; + +if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { + fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n"); + return ret; +} configmodule_interface_t *cfgif = config_get_if(); if (cfgif != NULL) { ret = config_get_if()->get(params, numparams,prefix); diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 02b6598ab61ab8b926861645c69fb327e0b63b1c..7ce85f6d8a48c10034eb0b4d93409610bef5806a 100644 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -113,7 +113,11 @@ void log_getconfig(log_t *g_log) { paramdef_t logparams_verbosity[MAX_LOG_COMPONENTS]; paramdef_t logparams_logfile[MAX_LOG_COMPONENTS]; - config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX); + int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX); + if (ret <0) { + fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed"); + return; + } memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS); memset(logparams_verbosity,0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS); memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 69765e80c5470db39881e9f0c3deaf7d377c5cc5..5144e911d7b7a4241751a03b453ce1edd72d141c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -584,7 +584,7 @@ static void get_options(void) { if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { set_glog(glog_level, -1); } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { + if(config_isparamset(cmdline_logparams,CMDLINE_GLOGVERBO_IDX)) { set_glog(-1, glog_verbosity); } if (start_telnetsrv) { @@ -889,7 +889,6 @@ int main( int argc, char **argv ) if ( load_configmodule(argc,argv) == NULL) { exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); } - #ifdef DEBUG_CONSOLE setvbuf(stdout, NULL, _IONBF, 0); @@ -920,7 +919,6 @@ int main( int argc, char **argv ) } - #if T_TRACER T_init(T_port, T_wait, T_dont_fork); #endif