Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
30
Issues
30
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
22b5ce1c
Commit
22b5ce1c
authored
Jan 16, 2017
by
Alessandro Rubini
Committed by
Grzegorz Daniluk
Feb 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd_ptp: parse all arguments
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
ff422c33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
cmd_ptp.c
shell/cmd_ptp.c
+16
-5
No files found.
shell/cmd_ptp.c
View file @
22b5ce1c
...
...
@@ -33,7 +33,7 @@ static char *is_mode[] = {[WRC_MODE_GM] = "gm", [WRC_MODE_MASTER] = "master",
static
int
cmd_ptp
(
const
char
*
args
[])
{
int
i
;
int
i
,
j
,
ret
;
struct
subcmd
*
c
;
...
...
@@ -45,10 +45,21 @@ static int cmd_ptp(const char *args[])
return
0
;
}
for
(
i
=
0
,
c
=
subcmd
;
i
<
ARRAY_SIZE
(
subcmd
);
i
++
,
c
++
)
if
(
!
strcasecmp
(
args
[
0
],
c
->
name
))
return
c
->
fun
(
c
->
arg
);
return
-
EINVAL
;
for
(
j
=
0
;
args
[
j
];
j
++
)
{
for
(
i
=
0
,
c
=
subcmd
;
i
<
ARRAY_SIZE
(
subcmd
);
i
++
,
c
++
)
{
if
(
!
strcasecmp
(
args
[
j
],
c
->
name
))
{
ret
=
c
->
fun
(
c
->
arg
);
if
(
ret
<
0
)
return
ret
;
break
;
}
}
if
(
i
==
ARRAY_SIZE
(
subcmd
))
{
pp_printf
(
"Unknown subcommand
\"
%s
\"\n
"
,
args
[
j
]);
return
-
EINVAL
;
}
}
return
0
;
}
DEFINE_WRC_COMMAND
(
ptp
)
=
{
...
...
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