summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2012-02-08 21:29:56 -0500
committerChris Mason <chris.mason@oracle.com>2012-02-08 21:29:56 -0500
commitf01d6a8cc87e8aad49416e57290138d7bf18434a (patch)
tree998a605d752543d50dfb10ba2806995dbabdb909
parent5fd54bc94b6cdf78706b0f078b4abee2cbae8651 (diff)
parent08b51bd731467ac8da182d69c827a8a5c7877079 (diff)
downloadbtrfs-progs-f01d6a8cc87e8aad49416e57290138d7bf18434a.tar.gz
Merge branch 'for-chris' of git://github.com/idryomov/btrfs-progs
-rw-r--r--btrfs.c8
-rw-r--r--cmds-balance.c7
-rw-r--r--cmds-device.c6
-rw-r--r--cmds-filesystem.c6
-rw-r--r--cmds-inspect.c6
-rw-r--r--cmds-scrub.c6
-rw-r--r--cmds-subvolume.c6
-rw-r--r--commands.h2
-rw-r--r--help.c9
9 files changed, 39 insertions, 17 deletions
diff --git a/btrfs.c b/btrfs.c
index 76f725a..88238d6 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -22,8 +22,10 @@
#include "commands.h"
#include "version.h"
-static const char btrfs_cmd_group_usage[] =
- "btrfs [--help] [--version] <group> [<group>...] <command> [<args>]";
+static const char * const btrfs_cmd_group_usage[] = {
+ "btrfs [--help] [--version] <group> [<group>...] <command> [<args>]",
+ NULL
+};
static const char btrfs_cmd_group_info[] =
"Use --help as an argument for information on a specific group or command.";
@@ -225,7 +227,7 @@ static int handle_options(int *argc, char ***argv)
} else {
fprintf(stderr, "Unknown option: %s\n", arg);
fprintf(stderr, "usage: %s\n",
- btrfs_cmd_group.usagestr);
+ btrfs_cmd_group.usagestr[0]);
exit(129);
}
diff --git a/cmds-balance.c b/cmds-balance.c
index 5fb2fda..38a7426 100644
--- a/cmds-balance.c
+++ b/cmds-balance.c
@@ -29,8 +29,11 @@
#include "commands.h"
-static const char balance_cmd_group_usage[] =
- "btrfs [filesystem] balance [<command>] [options] <path>";
+static const char * const balance_cmd_group_usage[] = {
+ "btrfs [filesystem] balance <command> [options] <path>",
+ "btrfs [filesystem] balance <path>",
+ NULL
+};
static const char balance_cmd_group_info[] =
"'btrfs filesystem balance' command is deprecated, please use\n"
diff --git a/cmds-device.c b/cmds-device.c
index 51089ba..db625a6 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -39,8 +39,10 @@ struct btrfs_ioctl_vol_args { char name[BTRFS_VOL_NAME_MAX]; };
static inline int ioctl(int fd, int define, void *arg) { return 0; }
#endif
-static const char device_cmd_group_usage[] =
- "btrfs device <command> [<args>]";
+static const char * const device_cmd_group_usage[] = {
+ "btrfs device <command> [<args>]",
+ NULL
+};
static const char * const cmd_add_dev_usage[] = {
"btrfs device add <device> [<device>...] <path>",
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index a2efb93..1f53d1c 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -34,8 +34,10 @@
#include "commands.h"
#include "btrfslabel.h"
-static const char filesystem_cmd_group_usage[] =
- "btrfs filesystem [<group>] <command> [<args>]";
+static const char * const filesystem_cmd_group_usage[] = {
+ "btrfs filesystem [<group>] <command> [<args>]",
+ NULL
+};
static const char * const cmd_df_usage[] = {
"btrfs filesystem df <path>",
diff --git a/cmds-inspect.c b/cmds-inspect.c
index 6cf565d..2f0228f 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -28,8 +28,10 @@
/* btrfs-list.c */
char *path_for_root(int fd, u64 root);
-static const char inspect_cmd_group_usage[] =
- "btrfs inspect-internal <command> <args>";
+static const char * const inspect_cmd_group_usage[] = {
+ "btrfs inspect-internal <command> <args>",
+ NULL
+};
static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
{
diff --git a/cmds-scrub.c b/cmds-scrub.c
index af855ba..c4503f4 100644
--- a/cmds-scrub.c
+++ b/cmds-scrub.c
@@ -40,8 +40,10 @@
#include "commands.h"
-static const char scrub_cmd_group_usage[] =
- "btrfs scrub <command> [options] <path>|<device>";
+static const char * const scrub_cmd_group_usage[] = {
+ "btrfs scrub <command> [options] <path>|<device>",
+ NULL
+};
#define SCRUB_DATA_FILE "/var/lib/btrfs/scrub.status"
#define SCRUB_PROGRESS_SOCKET_PATH "/var/lib/btrfs/scrub.progress"
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 68ebd40..950fa8f 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -33,8 +33,10 @@
int list_subvols(int fd, int print_parent, int get_default);
int find_updated_files(int fd, u64 root_id, u64 oldest_gen);
-static const char subvolume_cmd_group_usage[] =
- "btrfs subvolume <command> <args>";
+static const char * const subvolume_cmd_group_usage[] = {
+ "btrfs subvolume <command> <args>",
+ NULL
+};
/*
* test if path is a directory
diff --git a/commands.h b/commands.h
index de2c75c..a303a50 100644
--- a/commands.h
+++ b/commands.h
@@ -51,7 +51,7 @@ struct cmd_struct {
};
struct cmd_group {
- const char *usagestr;
+ const char * const *usagestr;
const char *infostr;
const struct cmd_struct commands[];
diff --git a/help.c b/help.c
index 932bdf2..6d04293 100644
--- a/help.c
+++ b/help.c
@@ -162,9 +162,16 @@ static void usage_command_group_internal(const struct cmd_group *grp, int full,
void usage_command_group(const struct cmd_group *grp, int full, int err)
{
+ const char * const *usagestr = grp->usagestr;
FILE *outf = err ? stderr : stdout;
- fprintf(outf, "usage: %s\n\n", grp->usagestr);
+ if (usagestr && *usagestr) {
+ fprintf(outf, "usage: %s\n", *usagestr++);
+ while (*usagestr)
+ fprintf(outf, " or: %s\n", *usagestr++);
+ }
+
+ fputc('\n', outf);
usage_command_group_internal(grp, full, outf);
fputc('\n', outf);