Commit 53907d37 authored by oai's avatar oai

fix command line processing crash

parent aae10bf0
......@@ -39,9 +39,8 @@ int processoption(paramdef_t *cfgoptions, char *value)
{
int argok=1;
char *tmpval = value;
int ret =0;
int optisset;
char defbool[2]="1";
if (value == NULL) {
argok=0;
} else if ( value[0] == '-') {
......@@ -51,11 +50,11 @@ int optisset;
if (argok == 0) {
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
return 0;
} else { /* boolean value */
tmpval = "1";
}
}
}
} else { /* boolean value */
tmpval = defbool;
}
printf("cc 0x%08x, %i\n",tmpval,argok);
switch(cfgoptions->type)
{
case TYPE_STRING:
......@@ -128,7 +127,7 @@ char *cfgpath;
j=0;
p++;
c--;
while (c >= 0 && *p != NULL) {
while (c > 0 && *p != NULL) {
if (strcmp(*p, "-h") == 0 || strcmp(*p, "--help") == 0 ) {
config_printhelp(cfgoptions,numoptions);
}
......@@ -143,13 +142,19 @@ char *cfgpath;
}
if ( ((strlen(*p) == 2) && (strcmp(*p + 1,cfgpath) == 0)) ||
((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) {
p++;
c--;
j = processoption(&(cfgoptions[i]), *p);
if ( j== 0) {
c++;
p--;
if (c > 1) {
p++;
c--;
j = processoption(&(cfgoptions[i]), *p);
if ( j== 0) {
c++;
p--;
}
} else {
j = processoption(&(cfgoptions[i]), NULL);
}
}
}
p++;
......
......@@ -613,7 +613,8 @@ typedef enum {
REMOTE_IF5 =1,
REMOTE_MBP_IF5 =2,
REMOTE_IF4p5 =3,
MAX_RU_IF_TYPES =4
REMOTE_IF1pp =4,
MAX_RU_IF_TYPES =5
} RU_if_south_t;
typedef struct RU_t_s{
......
......@@ -625,17 +625,12 @@ void *l2l1_task(void *arg) {
static void get_options(void) {
int CC_id;
int clock_src;
int tddflag;
char *loopfile=NULL;
int dumpframe;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
if (tddflag > 0) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
frame_parms[CC_id]->frame_type = TDD;
}
if (strlen(in_path) > 0) {
opt_type = OPT_PCAP;
......@@ -650,6 +645,9 @@ static void get_options(void) {
if (UE_flag > 0) {
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
if (loopfile != NULL) {
......@@ -676,6 +674,10 @@ static void get_options(void) {
UE_scan=0;
}
if (tddflag > 0) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
frame_parms[CC_id]->frame_type = TDD;
}
if (frame_parms[0]->N_RB_DL !=0) {
if ( frame_parms[0]->N_RB_DL < 6 ) {
......
......@@ -155,7 +155,7 @@ extern int16_t dlsch_demod_shift;
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, uptr:&(downlink_frequency[0][0]), defuintval:2680000000, TYPE_UINT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&chain_offset, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, 0, i8ptr:&do_forms, defintval:0, TYPE_INT8, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \
{"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \
{"U" , CONFIG_HLP_UE, PARAMFLAG_BOOL, i8ptr:&UE_flag, defintval:0, TYPE_INT8, 0}, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment