Gui Hecheng
2014-Feb-13 03:16 UTC
[PATCH 1/4] 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 <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
--
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