summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2008-07-09 07:37:54 +0000
committersobomax <sobomax@FreeBSD.org>2008-07-09 07:37:54 +0000
commit5bc4fd4e149da9385f22cc4c7ae7fc4a8dd72d9a (patch)
tree1cff26bf605a9ca9dd7b13afe15fd31087596d21 /usr.sbin
parentff979b5cea30b5068c1d722c7af63a90143b58c4 (diff)
downloadFreeBSD-src-5bc4fd4e149da9385f22cc4c7ae7fc4a8dd72d9a.zip
FreeBSD-src-5bc4fd4e149da9385f22cc4c7ae7fc4a8dd72d9a.tar.gz
Allow comment to be placed at the end of a configuration line.
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/syslogd/syslog.conf.514
-rw-r--r--usr.sbin/syslogd/syslogd.c11
2 files changed, 25 insertions, 0 deletions
diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5
index 7275fe6..d85e73f 100644
--- a/usr.sbin/syslogd/syslog.conf.5
+++ b/usr.sbin/syslogd/syslog.conf.5
@@ -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
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 7ca7061..b4e5d41 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -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));
OpenPOWER on IntegriCloud