Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
7128c73a
Commit
7128c73a
authored
Feb 13, 2017
by
Bernhard Nortmann
Browse files
fel: Support "-h" and "--help" options
Closes #96 Signed-off-by:
Bernhard Nortmann
<
bernhard.nortmann@web.de
>
parent
3eb76358
Changes
1
Show whitespace changes
Inline
Side-by-side
fel.c
View file @
7128c73a
...
...
@@ -970,18 +970,10 @@ static void select_by_sid(const char *sid_arg, int *busnum, int *devnum)
free
(
list
);
}
int
main
(
int
argc
,
char
**
argv
)
{
bool
uboot_autostart
=
false
;
/* flag for "uboot" command = U-Boot autostart */
bool
pflag_active
=
false
;
/* -p switch, causing "write" to output progress */
bool
device_list
=
false
;
/* -l switch, prints device list and exits */
feldev_handle
*
handle
;
int
busnum
=
-
1
,
devnum
=
-
1
;
char
*
sid_arg
=
NULL
;
if
(
argc
<=
1
)
{
void
usage
(
const
char
*
cmd
)
{
puts
(
"sunxi-fel "
VERSION
"
\n
"
);
printf
(
"Usage: %s [options] command arguments... [command...]
\n
"
" -h, --help Print this usage summary and exit
\n
"
" -v, --verbose Verbose logging
\n
"
" -p, --progress
\"
write
\"
transfers show a progress bar
\n
"
" -l, --list Enumerate all (USB) FEL devices and exit
\n
"
...
...
@@ -1020,14 +1012,27 @@ int main(int argc, char **argv)
" sid Retrieve and output 128-bit SID key
\n
"
" clear address length Clear memory
\n
"
" fill address length value Fill memory
\n
"
,
argv
[
0
]
);
,
cmd
);
exit
(
0
);
}
}
int
main
(
int
argc
,
char
**
argv
)
{
bool
uboot_autostart
=
false
;
/* flag for "uboot" command = U-Boot autostart */
bool
pflag_active
=
false
;
/* -p switch, causing "write" to output progress */
bool
device_list
=
false
;
/* -l switch, prints device list and exits */
feldev_handle
*
handle
;
int
busnum
=
-
1
,
devnum
=
-
1
;
char
*
sid_arg
=
NULL
;
if
(
argc
<=
1
)
usage
(
argv
[
0
]);
/* process all "prefix"-type arguments first */
while
(
argc
>
1
)
{
if
(
strcmp
(
argv
[
1
],
"--verbose"
)
==
0
||
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
if
(
strcmp
(
argv
[
1
],
"--help"
)
==
0
||
strcmp
(
argv
[
1
],
"-h"
)
==
0
)
usage
(
argv
[
0
]);
else
if
(
strcmp
(
argv
[
1
],
"--verbose"
)
==
0
||
strcmp
(
argv
[
1
],
"-v"
)
==
0
)
verbose
=
true
;
else
if
(
strcmp
(
argv
[
1
],
"--progress"
)
==
0
||
strcmp
(
argv
[
1
],
"-p"
)
==
0
)
pflag_active
=
true
;
...
...
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