svn commit: r265904 - head/usr.bin/units

Eitan Adler eadler at FreeBSD.org
Mon May 12 06:14:14 UTC 2014


Author: eadler
Date: Mon May 12 06:14:14 2014
New Revision: 265904
URL: http://svnweb.freebsd.org/changeset/base/265904

Log:
  units(1): unbreak -f option, fix some style, increase compatibility.
  
  - Unbreak the -f option: it was missing a ':'
  - gunits -V spits out more information than just its version: attempt to do so
    as well.

Modified:
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.c
==============================================================================
--- head/usr.bin/units/units.c	Mon May 12 05:44:55 2014	(r265903)
+++ head/usr.bin/units/units.c	Mon May 12 06:14:14 2014	(r265904)
@@ -80,7 +80,6 @@ static bool verbose = false;
 static const char * havestr;
 static const char * wantstr;
 
-
 static int	 addsubunit(char *product[], char *toadd);
 static int	 addunit(struct unittype *theunit, const char *toadd, int flip, int quantity);
 static void	 cancelunit(struct unittype * theunit);
@@ -719,7 +718,7 @@ main(int argc, char **argv)
 
 	quiet = false;
 	readfile = false;
-	while ((optchar = getopt(argc, argv, "fqvUV:")) != -1) {
+	while ((optchar = getopt(argc, argv, "f:qvUV")) != -1) {
 		switch (optchar) {
 		case 'f':
 			readfile = true;
@@ -734,6 +733,9 @@ main(int argc, char **argv)
 		case 'v':
 			verbose = true;
 			break;
+		case 'V':
+			fprintf(stderr, "FreeBSD units\n");
+			/* FALLTHROUGH */
 		case 'U':
 			if (access(UNITSFILE, F_OK) == 0)
 				printf("%s\n", UNITSFILE);
@@ -741,10 +743,6 @@ main(int argc, char **argv)
 				printf("Units data file not found");
 			exit(0);
 			break;
-		case 'V':
-			fprintf(stderr, "FreeBSD units\n");
-			usage();
-			break;
 		default:
 			usage();
 		}


More information about the svn-src-head mailing list