Commit 4737d7e3 authored by matt mooney's avatar matt mooney Committed by Greg Kroah-Hartman

staging: usbip: userspace: usbip: modify command failure

When a bad option is given, display a message stating such and output
usage. When a bad command is given, output command help.
Signed-off-by: default avatarmatt mooney <mfm@muteddisk.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 25567a39
...@@ -125,13 +125,13 @@ static int usbip_version(int argc, char *argv[]) ...@@ -125,13 +125,13 @@ static int usbip_version(int argc, char *argv[])
(void) argc; (void) argc;
(void) argv; (void) argv;
printf("%s\n", usbip_version_string); printf(PROGNAME " (%s)\n", usbip_version_string);
return 0; return 0;
} }
static int run_command(const struct command *cmd, int argc, char *argv[]) static int run_command(const struct command *cmd, int argc, char *argv[])
{ {
dbg("running command: `%s'\n", cmd->name); dbg("running command: `%s'", cmd->name);
return cmd->fn(argc, argv); return cmd->fn(argc, argv);
} }
...@@ -163,8 +163,11 @@ int main(int argc, char *argv[]) ...@@ -163,8 +163,11 @@ int main(int argc, char *argv[])
usbip_use_syslog = 1; usbip_use_syslog = 1;
openlog("", LOG_PID, LOG_USER); openlog("", LOG_PID, LOG_USER);
break; break;
case '?':
printf("usbip: invalid option\n");
default: default:
goto err_out; usbip_usage();
goto out;
} }
} }
...@@ -180,8 +183,8 @@ int main(int argc, char *argv[]) ...@@ -180,8 +183,8 @@ int main(int argc, char *argv[])
} }
} }
err_out: /* invalid command */
usbip_usage(); usbip_help(0, NULL);
out: out:
return (rc > -1 ? EXIT_SUCCESS : EXIT_FAILURE); return (rc > -1 ? EXIT_SUCCESS : EXIT_FAILURE);
} }
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