Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/mount_portal Better handling of comments in portal.conf...
details: https://anonhg.NetBSD.org/src/rev/b2164b02811d
branches: trunk
changeset: 999170:b2164b02811d
user: kre <kre%NetBSD.org@localhost>
date: Thu May 23 04:34:25 2019 +0000
description:
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).
diffstat:
sbin/mount_portal/conf.c | 18 ++++++++----------
sbin/mount_portal/mount_portal.8 | 7 ++++---
2 files changed, 12 insertions(+), 13 deletions(-)
diffs (74 lines):
diff -r a021636b6226 -r b2164b02811d sbin/mount_portal/conf.c
--- a/sbin/mount_portal/conf.c Thu May 23 02:39:06 2019 +0000
+++ b/sbin/mount_portal/conf.c Thu May 23 04:34:25 2019 +0000
@@ -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>
@@ -153,21 +153,19 @@
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)
diff -r a021636b6226 -r b2164b02811d sbin/mount_portal/mount_portal.8
--- a/sbin/mount_portal/mount_portal.8 Thu May 23 02:39:06 2019 +0000
+++ b/sbin/mount_portal/mount_portal.8 Thu May 23 04:34:25 2019 +0000
@@ -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 @@
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
Home |
Main Index |
Thread Index |
Old Index