From c3dcb083d95591204aacb8fcc261fd11bcc1511d Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Thu, 13 Feb 2014 11:16:35 +0800 Subject: [PATCH] btrfs-progs: use usage() to replace the warning msg on no-arg usage 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 Signed-off-by: David Sterba Signed-off-by: Chris Mason --- cmds-receive.c | 6 ++---- cmds-send.c | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/cmds-receive.c b/cmds-receive.c index 2d55c539..d6cd3da4 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 (check_argc_exact(argc - optind, 1)) + usage(cmd_receive_usage); tomnt = argv[optind]; diff --git a/cmds-send.c b/cmds-send.c index 9d49ce9f..dcb66076 100644 --- a/cmds-send.c +++ b/cmds-send.c @@ -524,11 +524,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);