From f1672e50c7f73cbdb1d9817e126c41a3db6d93ce Mon Sep 17 00:00:00 2001 From: Gui Hecheng Date: Wed, 16 Jul 2014 11:59:46 +0800 Subject: btrfs-progs: use check_argc_* to check arg number for all tools Since this patch: btrfs-progs: move the check_argc_* functions into utils.c All tools including the independent tools(e.g. btrfs-image, btrfs-convert) can share the convenience of the check_argc_* functions, so this patch adopt the argc check functions globally. Signed-off-by: Gui Hecheng Signed-off-by: David Sterba --- btrfs-crc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'btrfs-crc.c') diff --git a/btrfs-crc.c b/btrfs-crc.c index 1990534a..723e0b7a 100644 --- a/btrfs-crc.c +++ b/btrfs-crc.c @@ -20,6 +20,7 @@ #include #include #include "crc32c.h" +#include "utils.h" void usage(void) { @@ -62,13 +63,13 @@ int main(int argc, char **argv) } } + set_argv0(argv); str = argv[optind]; if (!loop) { - if (optind >= argc) { - fprintf(stderr, "not enough arguments\n"); + if (check_argc_min(argc - optind, 1)) return 255; - } + printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str); return 0; } -- cgit v1.2.3