linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] btrfs-progs: use usage() to replace the warning msg on no-arg usage
@ 2014-02-13  3:16 Gui Hecheng
  2014-02-13  3:16 ` [PATCH 2/4] btrfs-progs: remove a dead break before usage() Gui Hecheng
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Gui Hecheng @ 2014-02-13  3:16 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Gui Hecheng

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(-)

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-17  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-13  3:16 [PATCH 1/4] btrfs-progs: use usage() to replace the warning msg on no-arg usage Gui Hecheng
2014-02-13  3:16 ` [PATCH 2/4] btrfs-progs: remove a dead break before usage() Gui Hecheng
2014-02-13  3:16 ` [PATCH 3/4] btrfs-progs: cleanup nonsense ret value assignment Gui Hecheng
2014-02-13  3:16 ` [PATCH 4/4] btrfs-progs: fix fsck leaks on error returns Gui Hecheng
2014-02-14 17:30   ` David Sterba
2014-02-17  1:16     ` Gui Hecheng
2014-02-14 17:57 ` [PATCH 1/4] btrfs-progs: use usage() to replace the warning msg on no-arg usage David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).