From owner-svn-src-all@FreeBSD.ORG Fri Jul 4 21:21:06 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D79458CE; Fri, 4 Jul 2014 21:21:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAF37239D; Fri, 4 Jul 2014 21:21:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s64LL6E8086635; Fri, 4 Jul 2014 21:21:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s64LL6Sn086632; Fri, 4 Jul 2014 21:21:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201407042121.s64LL6Sn086632@svn.freebsd.org> From: Eitan Adler Date: Fri, 4 Jul 2014 21:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268269 - head/usr.bin/units X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2014 21:21:06 -0000 Author: eadler Date: Fri Jul 4 21:21:05 2014 New Revision: 268269 URL: http://svnweb.freebsd.org/changeset/base/268269 Log: units(1): add long options Things brings additional compatibility with units 2.10 Discussed with: wblock (man page) Modified: head/usr.bin/units/units.1 head/usr.bin/units/units.c Modified: head/usr.bin/units/units.1 ============================================================================== --- head/usr.bin/units/units.1 Fri Jul 4 21:06:48 2014 (r268268) +++ head/usr.bin/units/units.1 Fri Jul 4 21:21:05 2014 (r268269) @@ -13,17 +13,19 @@ .Sh OPTIONS The following options are available: .Bl -tag -width indent -.It Fl f Ar filename +.It Fl f Ar filename No , Fl -file Ar filename Specify the name of the units data file to load. -.It Fl q +.It Fl q No , Fl -quiet Suppress prompting of the user for units and the display of statistics about the number of units loaded. -.It Fl U +.It Fl U No , Fl -unitsfile If the default unit file exists prints its location. If not, print .Qo Units data file not found .Qc -.It Fl V +.It Fl v No , Fl -verbose +Print the units in the conversion output. Be more verbose in general. +.It Fl V No , Fl -version Print the version number, usage, and then exit. .It Ar from-unit to-unit Allow a single unit conversion to be done directly from the command @@ -31,8 +33,6 @@ line. The program will not print prompts. It will print out the result of the single specified conversion. -.It Fl v -Print the units in the conversion output. Be more verbose in general. .El .Sh DESCRIPTION The Modified: head/usr.bin/units/units.c ============================================================================== --- head/usr.bin/units/units.c Fri Jul 4 21:06:48 2014 (r268268) +++ head/usr.bin/units/units.c Fri Jul 4 21:21:05 2014 (r268269) @@ -24,6 +24,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -702,6 +703,15 @@ usage(void) exit(3); } +static struct option longopts[] = { + {"file", required_argument, NULL, 'f'}, + {"quiet", no_argument, NULL, 'q'}, + {"verbose", no_argument, NULL, 'v'}, + {"unitsfile", no_argument, NULL, 'U'}, + {"version", no_argument, NULL, 'V'}, + { 0, 0, 0, 0 } +}; + int main(int argc, char **argv) @@ -718,7 +728,7 @@ main(int argc, char **argv) quiet = false; readfile = false; - while ((optchar = getopt(argc, argv, "f:qvUV")) != -1) { + while ((optchar = getopt_long(argc, argv, "+f:qvUV", longopts, NULL)) != -1) { switch (optchar) { case 'f': readfile = true;