summaryrefslogtreecommitdiffstats
path: root/sbin/geom/core
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-05-22 16:57:39 +0000
committerpjd <pjd@FreeBSD.org>2004-05-22 16:57:39 +0000
commitb0a9931e9aa9b53d692be08975171b0be6990e3a (patch)
treec9e7c8f55564999d21e164054b0f78ed44fd51fb /sbin/geom/core
parenta08266267ee34fb4f993b271afb0a9b5fbd4df42 (diff)
downloadFreeBSD-src-b0a9931e9aa9b53d692be08975171b0be6990e3a.zip
FreeBSD-src-b0a9931e9aa9b53d692be08975171b0be6990e3a.tar.gz
Add standard command "help" to print usage.
Diffstat (limited to 'sbin/geom/core')
-rw-r--r--sbin/geom/core/geom.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 613eb41..963b1bc 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -60,11 +60,13 @@ static void (*usage)(const char *name);
static struct g_command *find_command(const char *cmdstr, int all);
static int std_available(const char *name);
+static void std_help(struct gctl_req *req, unsigned flags);
static void std_list(struct gctl_req *req, unsigned flags);
static void std_load(struct gctl_req *req, unsigned flags);
static void std_unload(struct gctl_req *req, unsigned flags);
struct g_command std_commands[] = {
+ { "help", 0, std_help, G_NULL_OPTS },
{ "list", 0, std_list, G_NULL_OPTS },
{ "load", G_FLAG_VERBOSE | G_FLAG_LOADKLD, std_load, G_NULL_OPTS },
{ "unload", G_FLAG_VERBOSE, std_unload, G_NULL_OPTS },
@@ -110,8 +112,8 @@ geom_usage(void)
{
if (class_name == NULL) {
- errx(EXIT_FAILURE, "usage: %s <class name> <command> "
- "[options]", "geom");
+ errx(EXIT_FAILURE, "usage: %s <class> <command> [options]",
+ "geom");
} else {
const char *prefix;
unsigned i;
@@ -597,6 +599,13 @@ show_one(struct gprovider *pp)
printf("\n");
}
+static void
+std_help(struct gctl_req *req __unused, unsigned flags __unused)
+{
+
+ geom_usage();
+}
+
static int
std_list_available(void)
{
@@ -743,7 +752,9 @@ static int
std_available(const char *name)
{
- if (strcmp(name, "list") == 0)
+ if (strcmp(name, "help") == 0)
+ return (1);
+ else if (strcmp(name, "list") == 0)
return (std_list_available());
else if (strcmp(name, "load") == 0)
return (std_load_available());
OpenPOWER on IntegriCloud