From owner-freebsd-geom@FreeBSD.ORG Sat Sep 5 20:25:09 2009 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 942911065693; Sat, 5 Sep 2009 20:25:09 +0000 (UTC) (envelope-from mel.flynn+fbsd.fs@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 5B1368FC1A; Sat, 5 Sep 2009 20:25:09 +0000 (UTC) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 593867E818; Sat, 5 Sep 2009 12:25:20 -0800 (AKDT) From: Mel Flynn To: freebsd-fs@freebsd.org Date: Sat, 5 Sep 2009 22:25:05 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA3; KDE/4.2.4; i386; ; ) References: <200909030000.11961.mel.flynn+fbsd.fs@mailing.thruhere.net> <200909052111.27667.mel.flynn+fbsd.fs@mailing.thruhere.net> <20090905192251.GJ1665@garage.freebsd.pl> In-Reply-To: <20090905192251.GJ1665@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_iksoKYVobZGJI9m" Message-Id: <200909052225.06185.mel.flynn+fbsd.fs@mailing.thruhere.net> Cc: Pawel Jakub Dawidek , freebsd-geom@freebsd.org Subject: Re: Patch to allow gmirror to set priority of a disk X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Sep 2009 20:25:09 -0000 --Boundary-00=_iksoKYVobZGJI9m Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Saturday 05 September 2009 21:22:51 Pawel Jakub Dawidek wrote: > And tech core geom(8) utility to split usage based on \n. > usage_command() function from sbin/geom/core/geom.c would have to be > modified. If you agree with this idea, would you also like to work on > this? Yes and see attached. Since utility exists after displaying usage, I didn't take the trouble of freeing ptr, but if this is preferred then I'll add the line. % geom mirror foo geom: Unknown command: foo. usage: geom mirror activate [-v] name prov ... geom mirror clear [-v] prov ... geom mirror configure[-adfFhnv] [-b balance] [-s slice] name geom mirror configure -p priority name prov -- Mel --Boundary-00=_iksoKYVobZGJI9m Content-Type: text/plain; charset="UTF-8"; name="geom-core.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="geom-core.txt" Index: sbin/geom/core/geom.c =================================================================== --- sbin/geom/core/geom.c (revision 196868) +++ sbin/geom/core/geom.c (working copy) @@ -98,11 +98,23 @@ 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; + + ptr = strdup(cmd->gc_usage); + while ((pos = strchr(ptr, '\n')) != NULL) { + *pos = '\0'; + fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); + fprintf(stderr, "%s\n", ptr); + ptr = pos + 1; + } + /* Tail or no \n at all */ + fprintf(stderr, "%s %s %s", prefix, comm, cmd->gc_name); + fprintf(stderr, " %s\n", ptr); 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++) { --Boundary-00=_iksoKYVobZGJI9m--