Message ID | 1392261398-6197-1-git-send-email-guihc.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Thu, Feb 13, 2014 at 11:16:35AM +0800, Gui Hecheng wrote: > --- a/cmds-receive.c > +++ b/cmds-receive.c > @@ -951,10 +951,8 @@ int cmd_receive(int argc, char **argv) > } > } > > - if (optind + 1 != argc) { > - fprintf(stderr, "ERROR: receive needs path to subvolume\n"); > - return 1; > - } > + if (optind + 1 != argc) FYI, I've replaced this with check_argc_exact > + usage(cmd_receive_usage); > > tomnt = argv[optind]; > -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/cmds-receive.c b/cmds-receive.c index cce37a7..72d9cc8 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -951,10 +951,8 @@ int cmd_receive(int argc, char **argv) } } - if (optind + 1 != argc) { - fprintf(stderr, "ERROR: receive needs path to subvolume\n"); - return 1; - } + if (optind + 1 != argc) + usage(cmd_receive_usage); tomnt = argv[optind]; diff --git a/cmds-send.c b/cmds-send.c index fc9a01e..e44770f 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -571,11 +571,8 @@ int cmd_send(int argc, char **argv) } } - if (optind == argc) { - fprintf(stderr, "ERROR: send needs path to snapshot\n"); - ret = 1; - goto out; - } + if (optind == argc) + usage(cmd_send_usage); if (outname != NULL) { send.dump_fd = creat(outname, 0600);
To be consistent with the other cmds, replace the warning msg with usage() when send/receive are used without any args. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> --- cmds-receive.c | 6 ++---- cmds-send.c | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-)