diff options
author | eadler <eadler@FreeBSD.org> | 2014-07-05 03:25:26 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2014-07-05 03:25:26 +0000 |
commit | 839ea05fb71ade51e4935b2aab847fd9cd1c7d7d (patch) | |
tree | 8db8f934a02e237bc7caca333c27c50e0ee3cbd8 /usr.bin | |
parent | 739ad2052de5cad026c698e289008ba7492ba801 (diff) | |
download | FreeBSD-src-839ea05fb71ade51e4935b2aab847fd9cd1c7d7d.zip FreeBSD-src-839ea05fb71ade51e4935b2aab847fd9cd1c7d7d.tar.gz |
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.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/units/units.1 | 2 | ||||
-rw-r--r-- | usr.bin/units/units.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/units/units.1 b/usr.bin/units/units.1 index 4b73da4..a7173a5 100644 --- a/usr.bin/units/units.1 +++ b/usr.bin/units/units.1 @@ -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. diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index f8e4f11..94a976f 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -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"); |