Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Jul 2014 03:25:27 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268278 - head/usr.bin/units
Message-ID:  <201407050325.s653PRqE066628@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407050325.s653PRqE066628>