Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangjie
OpenXG-RAN
Commits
33b2d11f
Commit
33b2d11f
authored
Aug 16, 2016
by
Frédéric Leroy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(conf2uedata): clarify error message when config file does not exists
parent
fe2193ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
+28
-16
openair3/NAS/TOOLS/conf2uedata.c
openair3/NAS/TOOLS/conf2uedata.c
+28
-15
openair3/NAS/TOOLS/conf2uedata.h
openair3/NAS/TOOLS/conf2uedata.h
+0
-1
No files found.
openair3/NAS/TOOLS/conf2uedata.c
View file @
33b2d11f
...
...
@@ -7,10 +7,12 @@
#include "utils.h"
char
*
make_filename
(
const
char
*
output_dir
,
const
char
*
filename
,
int
ueid
);
int
get_config_from_file
(
const
char
*
filename
,
config_t
*
config
);
int
main
(
int
argc
,
char
**
argv
)
{
int
rc
=
EXIT_SUCCESS
;
int
option
;
const
char
*
conf_file
=
NULL
;
while
((
option
=
getopt
(
argc
,
argv
,
options
))
!=
-
1
)
{
switch
(
option
)
{
case
'c'
:
...
...
@@ -42,26 +44,17 @@ int main(int argc, char**argv) {
_display_usage
();
return
EXIT_FAILURE
;
}
else
if
(
parse_data
)
{
int
ret
;
int
ue_nb
=
0
;
config_t
cfg
;
config_setting_t
*
root_setting
=
NULL
;
config_setting_t
*
ue_setting
=
NULL
;
config_setting_t
*
all_plmn_setting
=
NULL
;
char
user
[
10
];
config_init
(
&
cfg
);
if
(
conf_file
!=
NULL
)
{
/* Read the file. If there is an error, report it and exit. */
if
(
!
config_read_file
(
&
cfg
,
conf_file
))
{
fprintf
(
stderr
,
"%s:%d - %s
\n
"
,
config_error_file
(
&
cfg
),
config_error_line
(
&
cfg
),
config_error_text
(
&
cfg
));
config_destroy
(
&
cfg
);
return
(
EXIT_FAILURE
);
}
}
else
{
config_destroy
(
&
cfg
);
perror
(
"ERROR
\t
: config_read failed"
);
exit
(
EXIT_FAILURE
);
}
config_t
cfg
;
ret
=
get_config_from_file
(
conf_file
,
&
cfg
);
if
(
ret
==
EXIT_FAILURE
)
{
exit
(
1
);
}
root_setting
=
config_root_setting
(
&
cfg
);
ue_nb
=
config_setting_length
(
root_setting
)
-
1
;
all_plmn_setting
=
config_setting_get_member
(
root_setting
,
PLMN
);
...
...
@@ -112,6 +105,26 @@ int main(int argc, char**argv) {
}
int
get_config_from_file
(
const
char
*
filename
,
config_t
*
config
)
{
config_init
(
config
);
if
(
filename
==
NULL
)
{
// XXX write error message ?
exit
(
EXIT_FAILURE
);
}
/* Read the file. If there is an error, report it and exit. */
if
(
!
config_read_file
(
config
,
filename
))
{
fprintf
(
stderr
,
"Cant read config file '%s': %s
\n
"
,
filename
,
config_error_text
(
config
));
if
(
config_error_type
(
config
)
==
CONFIG_ERR_PARSE
)
{
fprintf
(
stderr
,
"This is line %d
\n
"
,
config_error_line
(
config
));
}
config_destroy
(
config
);
return
(
EXIT_FAILURE
);
}
return
EXIT_SUCCESS
;
}
void
gen_usim_data
(
int
user_id
)
{
usim_data_t
usim_data
=
{
};
memset
(
&
usim_data
,
0
,
sizeof
(
usim_data_t
));
...
...
openair3/NAS/TOOLS/conf2uedata.h
View file @
33b2d11f
...
...
@@ -98,7 +98,6 @@ const char options[]="c:o:h";
unsigned
char
parse_data
=
FALSE
;
unsigned
char
print_data
=
FALSE
;
unsigned
char
output
=
FALSE
;
const
char
*
conf_file
=
NULL
;
const
char
*
output_dir
=
NULL
;
const
char
*
imsi
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment