Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OAI-RAN-5G-sheduler_MaxTBS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAQ5G-PFC
OAI-RAN-5G-sheduler_MaxTBS
Commits
7ce0e45d
Commit
7ce0e45d
authored
7 years ago
by
oai
Browse files
Options
Downloads
Patches
Plain Diff
fix process_cmdline error,
parent
7e9bff37
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/config/config_cmdline.c
+27
-18
27 additions, 18 deletions
common/config/config_cmdline.c
with
27 additions
and
18 deletions
common/config/config_cmdline.c
+
27
−
18
View file @
7ce0e45d
...
...
@@ -37,27 +37,32 @@
int
processoption
(
paramdef_t
*
cfgoptions
,
char
*
value
)
{
int
optisset
=
0
;
int
noarg
=
0
;
if
((
cfgoptions
->
paramflags
&
PARAMFLAG_BOOL
)
==
0
)
{
if
(
value
==
NULL
)
{
noarg
=
1
;
}
else
if
(
value
[
0
]
==
'-'
)
{
noarg
=
1
;
}
if
(
noarg
==
1
)
{
int
argok
=
1
;
char
*
tmpval
=
value
;
int
ret
=
0
;
int
optisset
;
if
(
value
==
NULL
)
{
argok
=
0
;
}
else
if
(
value
[
0
]
==
'-'
)
{
argok
=
0
;
}
if
((
cfgoptions
->
paramflags
&
PARAMFLAG_BOOL
)
==
0
)
{
/* not a boolean, argument required */
if
(
argok
==
0
)
{
fprintf
(
stderr
,
"[CONFIG] command line, option %s requires an argument
\n
"
,
cfgoptions
->
optname
);
return
0
;
}
}
else
{
/* boolean value */
tmpval
=
"1"
;
}
}
switch
(
cfgoptions
->
type
)
{
case
TYPE_STRING
:
config_check_valptr
(
cfgoptions
,
(
char
**
)(
cfgoptions
->
strptr
),
sizeof
(
char
*
));
config_check_valptr
(
cfgoptions
,
cfgoptions
->
strptr
,
strlen
(
val
ue
+
1
));
sprintf
(
*
(
cfgoptions
->
strptr
),
"%s"
,
val
ue
);
printf_cmdl
(
"[CONFIG] %s set to %s from command line
\n
"
,
cfgoptions
->
optname
,
val
ue
);
config_check_valptr
(
cfgoptions
,
cfgoptions
->
strptr
,
strlen
(
tmp
val
+
1
));
sprintf
(
*
(
cfgoptions
->
strptr
),
"%s"
,
tmp
val
);
printf_cmdl
(
"[CONFIG] %s set to %s from command line
\n
"
,
cfgoptions
->
optname
,
tmp
val
);
optisset
=
1
;
break
;
...
...
@@ -70,13 +75,13 @@ int noarg=0;
case
TYPE_UINT8
:
case
TYPE_INT8
:
config_check_valptr
(
cfgoptions
,
(
char
**
)
&
(
cfgoptions
->
iptr
),
sizeof
(
int32_t
));
config_assign_int
(
cfgoptions
,
cfgoptions
->
optname
,(
int32_t
)
strtol
(
val
ue
,
NULL
,
0
));
config_assign_int
(
cfgoptions
,
cfgoptions
->
optname
,(
int32_t
)
strtol
(
tmp
val
,
NULL
,
0
));
optisset
=
1
;
break
;
case
TYPE_UINT64
:
case
TYPE_INT64
:
config_check_valptr
(
cfgoptions
,
(
char
**
)
&
(
cfgoptions
->
i64ptr
),
sizeof
(
uint64_t
));
*
(
cfgoptions
->
i64ptr
)
=
strtoll
(
val
ue
,
NULL
,
0
);
*
(
cfgoptions
->
i64ptr
)
=
strtoll
(
tmp
val
,
NULL
,
0
);
printf_cmdl
(
"[CONFIG] %s set to %lli from command line
\n
"
,
cfgoptions
->
optname
,
(
long
long
)
*
(
cfgoptions
->
i64ptr
));
optisset
=
1
;
break
;
...
...
@@ -86,7 +91,7 @@ int noarg=0;
break
;
case
TYPE_DOUBLE
:
config_check_valptr
(
cfgoptions
,
(
char
**
)
&
(
cfgoptions
->
dblptr
),
sizeof
(
double
));
*
(
cfgoptions
->
dblptr
)
=
strtof
(
val
ue
,
NULL
);
*
(
cfgoptions
->
dblptr
)
=
strtof
(
tmp
val
,
NULL
);
printf_cmdl
(
"[CONFIG] %s set to %lf from command line
\n
"
,
cfgoptions
->
optname
,
*
(
cfgoptions
->
dblptr
));
optisset
=
1
;
break
;
...
...
@@ -103,7 +108,7 @@ int noarg=0;
cfgoptions
->
paramflags
=
cfgoptions
->
paramflags
|
PARAMFLAG_PARAMSET
;
}
return
optisset
;
return
argok
;
}
int
config_process_cmdline
(
paramdef_t
*
cfgoptions
,
int
numoptions
,
char
*
prefix
)
...
...
@@ -139,8 +144,12 @@ char *cfgpath;
if
(
((
strlen
(
*
p
)
==
2
)
&&
(
strcmp
(
*
p
+
1
,
cfgpath
)
==
0
))
||
((
strlen
(
*
p
)
>
2
)
&&
(
strcmp
(
*
p
+
2
,
cfgpath
)
==
0
))
)
{
p
++
;
j
=+
processoption
(
&
(
cfgoptions
[
i
]),
*
p
);
c
--
;
j
=
processoption
(
&
(
cfgoptions
[
i
]),
*
p
);
if
(
j
==
0
)
{
c
++
;
p
--
;
}
}
}
p
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment