Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
c9ef451e
Commit
c9ef451e
authored
Feb 05, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/wrsw_hal: add -f parameter to pass dot-config location
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
97b47560
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
hal_main.c
userspace/wrsw_hal/hal_main.c
+14
-4
No files found.
userspace/wrsw_hal/hal_main.c
View file @
c9ef451e
...
...
@@ -27,6 +27,7 @@
static
int
daemon_mode
=
0
;
static
hal_cleanup_callback_t
cleanup_cb
[
MAX_CLEANUP_CALLBACKS
];
static
char
*
logfilename
;
static
char
*
dotconfigname
=
"/wr/etc/dot-config"
;
struct
hal_shmem_header
*
hal_shmem
;
...
...
@@ -84,11 +85,15 @@ static int hal_init(void)
memset
(
cleanup_cb
,
0
,
sizeof
(
cleanup_cb
));
line
=
libwr_cfg_read_file
(
"/wr/etc/dot-config"
);
/* FIXME: accept -f */
pr_info
(
"Using file %s as dot-config
\n
"
,
dotconfigname
);
line
=
libwr_cfg_read_file
(
dotconfigname
);
if
(
line
==
-
1
)
pr_error
(
"Unable to read dot-config or error in line 1
\n
"
);
pr_error
(
"Unable to read dot-config file %s or error in line"
"1
\n
"
,
dotconfigname
);
else
if
(
line
)
pr_error
(
"Error in dot-config, error in line %d
\n
"
,
-
line
);
pr_error
(
"Error in dot-config file %s, error in line %d
\n
"
,
dotconfigname
,
-
line
);
shw_sfp_read_db
();
...
...
@@ -170,7 +175,7 @@ static void hal_parse_cmdline(int argc, char *argv[])
{
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"dhqvl:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"dhqvl:
f:
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'd'
:
daemon_mode
=
1
;
...
...
@@ -188,6 +193,11 @@ static void hal_parse_cmdline(int argc, char *argv[])
case
'q'
:
break
;
/* done in wrs_msg_init() */
case
'v'
:
break
;
/* done in wrs_msg_init() */
case
'f'
:
/* custom dot-config file */
dotconfigname
=
optarg
;
break
;
default:
fprintf
(
stderr
,
"Unrecognized option. Call %s -h for help.
\n
"
,
...
...
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