Commit 7128c73a authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fel: Support "-h" and "--help" options



Closes #96
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 3eb76358
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment