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

Eitan Adler eadler at FreeBSD.org
Sat Jul 5 03:25:27 UTC 2014


Author: eadler
Date: Sat Jul  5 03:25:26 2014
New Revision: 268278
URL: http://svnweb.freebsd.org/changeset/base/268278

Log:
  units: Support start of line comments with '#'
  	Modern GNU units(1) supports comments anywhere with '#' but take the easy route for now and at least support start of line # comments.

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	Sat Jul  5 03:17:57 2014	(r268277)
+++ head/usr.bin/units/units.1	Sat Jul  5 03:25:26 2014	(r268278)
@@ -149,7 +149,7 @@ The
 program will not detect infinite loops that could be caused
 by careless unit definitions.
 Comments in the unit definition file
-begin with a '/' character at the beginning of a line.
+begin with a '#' or '/' character at the beginning of a line.
 .Pp
 Prefixes are defined in the same was as standard units, but with
 a trailing dash at the end of the prefix name.

Modified: head/usr.bin/units/units.c
==============================================================================
--- head/usr.bin/units/units.c	Sat Jul  5 03:17:57 2014	(r268277)
+++ head/usr.bin/units/units.c	Sat Jul  5 03:25:26 2014	(r268278)
@@ -166,7 +166,7 @@ readunits(const char *userfile)
 			break;
 		linenum++;
 		lineptr = line;
-		if (*lineptr == '/')
+		if (*lineptr == '/' || *lineptr == '#')
 			continue;
 		lineptr += strspn(lineptr, " \n\t");
 		len = strcspn(lineptr, " \n\t");


More information about the svn-src-head mailing list