summaryrefslogtreecommitdiff
path: root/btrfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'btrfs.c')
-rw-r--r--btrfs.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/btrfs.c b/btrfs.c
index f8b87af2..e83349cb 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -22,6 +22,7 @@
#include "crc32c.h"
#include "commands.h"
#include "version.h"
+#include "utils.h"
static const char * const btrfs_cmd_group_usage[] = {
"btrfs [--help] [--version] <group> [<group>...] <command> [<args>]",
@@ -31,8 +32,6 @@ static const char * const btrfs_cmd_group_usage[] = {
static const char btrfs_cmd_group_info[] =
"Use --help as an argument for information on a specific group or command.";
-static char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";
-
static inline const char *skip_prefix(const char *str, const char *prefix)
{
size_t len = strlen(prefix);
@@ -125,14 +124,6 @@ static void handle_help_options_next_level(const struct cmd_struct *cmd,
}
}
-static void fixup_argv0(char **argv, const char *token)
-{
- int len = strlen(argv0_buf);
-
- snprintf(argv0_buf + len, sizeof(argv0_buf) - len, " %s", token);
- argv[0] = argv0_buf;
-}
-
int handle_command_group(const struct cmd_group *grp, int argc,
char **argv)
@@ -154,36 +145,6 @@ int handle_command_group(const struct cmd_group *grp, int argc,
return cmd->fn(argc, argv);
}
-int check_argc_exact(int nargs, int expected)
-{
- if (nargs < expected)
- fprintf(stderr, "%s: too few arguments\n", argv0_buf);
- if (nargs > expected)
- fprintf(stderr, "%s: too many arguments\n", argv0_buf);
-
- return nargs != expected;
-}
-
-int check_argc_min(int nargs, int expected)
-{
- if (nargs < expected) {
- fprintf(stderr, "%s: too few arguments\n", argv0_buf);
- return 1;
- }
-
- return 0;
-}
-
-int check_argc_max(int nargs, int expected)
-{
- if (nargs > expected) {
- fprintf(stderr, "%s: too many arguments\n", argv0_buf);
- return 1;
- }
-
- return 0;
-}
-
static const struct cmd_group btrfs_cmd_group;
static const char * const cmd_help_usage[] = {