Skip to content

Commit

Permalink
staging: usbip: userspace: usbip: modify command failure
Browse files Browse the repository at this point in the history
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: matt mooney <mfm@muteddisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
matt mooney authored and Greg Kroah-Hartman committed Jul 6, 2011
1 parent 25567a3 commit 4737d7e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/staging/usbip/userspace/src/usbip.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ static int usbip_version(int argc, char *argv[])
(void) argc;
(void) argv;

printf("%s\n", usbip_version_string);
printf(PROGNAME " (%s)\n", usbip_version_string);
return 0;
}

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);
}

Expand Down Expand Up @@ -163,8 +163,11 @@ int main(int argc, char *argv[])
usbip_use_syslog = 1;
openlog("", LOG_PID, LOG_USER);
break;
case '?':
printf("usbip: invalid option\n");
default:
goto err_out;
usbip_usage();
goto out;
}
}

Expand All @@ -180,8 +183,8 @@ int main(int argc, char *argv[])
}
}

err_out:
usbip_usage();
/* invalid command */
usbip_help(0, NULL);
out:
return (rc > -1 ? EXIT_SUCCESS : EXIT_FAILURE);
}

0 comments on commit 4737d7e

Please sign in to comment.