Allow comment to be placed at the end of a configuration line.

MFC after:	2 weeks
This commit is contained in:
Maxim Sobolev 2008-07-09 07:37:54 +00:00
parent 6c6c706891
commit 7e1535c571
2 changed files with 25 additions and 0 deletions

View File

@ -406,6 +406,20 @@ normally the superuser.
Blank lines and lines whose first non-blank character is a hash
.Pq Dq #
character are ignored.
If
.Ql #
is placed in the middle of the line, the
.Ql #
character and the rest of the line after it is ignored.
To prevent special meaning, the
.Ql #
character may be escaped with
.Ql \e ;
in this case preceding
.Ql \e
is removed and
.Ql #
is treated as an ordinary character.
.Sh IMPLEMENTATION NOTES
The
.Dq kern

View File

@ -1662,6 +1662,17 @@ init(int signo)
prog[i] = 0;
continue;
}
for (p = cline + 1; *p != '\0'; p++) {
if (*p != '#')
continue;
if (*(p - 1) == '\\') {
strcpy(p - 1, p);
p--;
continue;
}
*p = '\0';
break;
}
for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--)
cline[i] = '\0';
f = (struct filed *)calloc(1, sizeof(*f));