Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
card10
openocd
Commits
18a5a46b
Commit
18a5a46b
authored
Jan 02, 2011
by
Jon Povey
Committed by
Øyvind Harboe
Jan 02, 2011
Browse files
svf: fix USAGE and related error reporting
Signed-off-by:
Jon Povey
<
jon.povey@racelogic.co.uk
>
parent
093ec665
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/svf/svf.c
View file @
18a5a46b
...
@@ -315,8 +315,6 @@ COMMAND_HANDLER(handle_svf_command)
...
@@ -315,8 +315,6 @@ COMMAND_HANDLER(handle_svf_command)
{
{
#define SVF_MIN_NUM_OF_OPTIONS 1
#define SVF_MIN_NUM_OF_OPTIONS 1
#define SVF_MAX_NUM_OF_OPTIONS 5
#define SVF_MAX_NUM_OF_OPTIONS 5
#define USAGE [-tap device.tap] <file> [quiet] [progress]
#define PRINT_USAGE command_print(CMD_CTX, "svf USAGE")
int
command_num
=
0
;
int
command_num
=
0
;
int
ret
=
ERROR_OK
;
int
ret
=
ERROR_OK
;
long
long
time_measure_ms
;
long
long
time_measure_ms
;
...
@@ -330,8 +328,7 @@ COMMAND_HANDLER(handle_svf_command)
...
@@ -330,8 +328,7 @@ COMMAND_HANDLER(handle_svf_command)
if
((
CMD_ARGC
<
SVF_MIN_NUM_OF_OPTIONS
)
||
(
CMD_ARGC
>
SVF_MAX_NUM_OF_OPTIONS
))
if
((
CMD_ARGC
<
SVF_MIN_NUM_OF_OPTIONS
)
||
(
CMD_ARGC
>
SVF_MAX_NUM_OF_OPTIONS
))
{
{
PRINT_USAGE
;
return
ERROR_COMMAND_SYNTAX_ERROR
;
return
ERROR_FAIL
;
}
}
// parse command line
// parse command line
...
@@ -359,10 +356,9 @@ COMMAND_HANDLER(handle_svf_command)
...
@@ -359,10 +356,9 @@ COMMAND_HANDLER(handle_svf_command)
else
if
((
svf_fd
=
fopen
(
CMD_ARGV
[
i
],
"r"
))
==
NULL
)
else
if
((
svf_fd
=
fopen
(
CMD_ARGV
[
i
],
"r"
))
==
NULL
)
{
{
int
err
=
errno
;
int
err
=
errno
;
PRINT_USAGE
;
command_print
(
CMD_CTX
,
"open(
\"
%s
\"
): %s"
,
CMD_ARGV
[
i
],
strerror
(
err
));
command_print
(
CMD_CTX
,
"open(
\"
%s
\"
): %s"
,
CMD_ARGV
[
i
],
strerror
(
err
));
// no need to free anything now
// no need to free anything now
return
ERROR_
FAIL
;
return
ERROR_
COMMAND_SYNTAX_ERROR
;
}
}
else
else
{
{
...
@@ -372,8 +368,7 @@ COMMAND_HANDLER(handle_svf_command)
...
@@ -372,8 +368,7 @@ COMMAND_HANDLER(handle_svf_command)
if
(
svf_fd
==
NULL
)
if
(
svf_fd
==
NULL
)
{
{
PRINT_USAGE
;
return
ERROR_COMMAND_SYNTAX_ERROR
;
return
ERROR_FAIL
;
}
}
// get time
// get time
...
@@ -1712,7 +1707,7 @@ static const struct command_registration svf_command_handlers[] = {
...
@@ -1712,7 +1707,7 @@ static const struct command_registration svf_command_handlers[] = {
.
handler
=
handle_svf_command
,
.
handler
=
handle_svf_command
,
.
mode
=
COMMAND_EXEC
,
.
mode
=
COMMAND_EXEC
,
.
help
=
"Runs a SVF file."
,
.
help
=
"Runs a SVF file."
,
.
usage
=
"
USAGE
"
,
.
usage
=
"
svf [-tap device.tap] <file> [quiet] [progress]
"
,
},
},
COMMAND_REGISTRATION_DONE
COMMAND_REGISTRATION_DONE
};
};
...
...
Write
Preview
Supports
Markdown
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