Better handling of comments in portal.conf ... # now only introduces

a comment at beginning of line, or after whitespace.   This allows #
to be used as data otherwhere in the line (there is no escape mechanism).
This commit is contained in:
kre 2019-05-23 04:34:25 +00:00
parent de0c485250
commit 4ab11b0d22
2 changed files with 12 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.13 2019/05/23 02:39:06 kre Exp $ */
/* $NetBSD: conf.c,v 1.14 2019/05/23 04:34:25 kre Exp $ */
/*
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: conf.c,v 1.13 2019/05/23 02:39:06 kre Exp $");
__RCSID("$NetBSD: conf.c,v 1.14 2019/05/23 04:34:25 kre Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -152,22 +152,20 @@ palloc(char *cline, int lno, const char *conf_file)
path *p;
char **ap;
/*
* Implement comment chars
*/
s = strchr(cline, '#');
if (s)
*s = 0;
/*
* Do a pass through the string to count the number
* of arguments
* of arguments. Stop if we encounter a comment.
*/
c = 0;
key = strdup(cline);
for (s = key; s != NULL; ) {
char *val;
if (*s == '#') { /* '#" at beginning of word */
cline[s-key] = '\0'; /* delete comment -> EOL */
break;
}
while ((val = strsep(&s, " \t\n")) != NULL && *val == '\0')
;
if (val)

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mount_portal.8,v 1.22 2017/07/03 21:33:41 wiz Exp $
.\" $NetBSD: mount_portal.8,v 1.23 2019/05/23 04:34:25 kre Exp $
.\"
.\" Copyright (c) 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
.\"
.\" @(#)mount_portal.8 8.3 (Berkeley) 3/27/94
.\"
.Dd December 5, 2009
.Dd May 23, 2019
.Dt MOUNT_PORTAL 8
.Os
.Sh NAME
@ -122,7 +122,8 @@ Each rule takes one line and consists of two or more
whitespace separated fields.
A hash
.Pq Dq #
character causes the remainder of a line to be ignored.
character at beginning of the line, or after whitespace,
causes the remainder of a line to be ignored.
Blank lines are ignored.
.Pp
The first field is a pathname prefix to match