summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2009-09-06 06:48:50 +0000
committerpjd <pjd@FreeBSD.org>2009-09-06 06:48:50 +0000
commite091741877a1c75a79aafbf68b0cca9ff4ccd623 (patch)
tree8c17859e4cd4b5a94d093d553b6025de82eb32b3 /sbin
parent5b9cf14b541867aeeeabf34edade1a0f5c528580 (diff)
downloadFreeBSD-src-e091741877a1c75a79aafbf68b0cca9ff4ccd623.zip
FreeBSD-src-e091741877a1c75a79aafbf68b0cca9ff4ccd623.tar.gz
For any given subcommand allow to specify multi-line usage (separated by \n).
Submitted by: Mel Flynn
Diffstat (limited to 'sbin')
-rw-r--r--sbin/geom/core/geom.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 8949b73..ef95788 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -98,11 +98,21 @@ usage_command(struct g_command *cmd, const char *prefix)
struct g_option *opt;
unsigned i;
- fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name);
if (cmd->gc_usage != NULL) {
- fprintf(stderr, " %s\n", cmd->gc_usage);
+ char *pos, *ptr, *sptr;
+
+ sptr = ptr = strdup(cmd->gc_usage);
+ while ((pos = strsep(&ptr, "\n")) != NULL) {
+ if (*pos == '\0')
+ continue;
+ fprintf(stderr, "%s %s %s %s\n", prefix, comm,
+ cmd->gc_name, pos);
+ }
+ free(sptr);
return;
}
+
+ fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name);
if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0)
fprintf(stderr, " [-v]");
for (i = 0; ; i++) {
OpenPOWER on IntegriCloud