summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/config.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-27 21:10:54 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-27 21:10:54 +0000
commit1eb9fd71553082f78f1496eead72aac6c99c16c2 (patch)
tree5ab1f9a8c2422c99d85b2799523043858d80f89b /usr.bin/cvs/config.c
parentc9ad015d3a86446c5f5d984daa0c8984f4622fa7 (diff)
handle comments and leading spaces correctly
in CVSROOT/config
Diffstat (limited to 'usr.bin/cvs/config.c')
-rw-r--r--usr.bin/cvs/config.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/cvs/config.c b/usr.bin/cvs/config.c
index 99da5009a3f..a9c6dd45695 100644
--- a/usr.bin/cvs/config.c
+++ b/usr.bin/cvs/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.1 2006/05/27 18:04:46 joris Exp $ */
+/* $OpenBSD: config.c,v 1.2 2006/05/27 21:10:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -30,7 +30,7 @@ cvs_parse_configfile(void)
FILE *fp;
size_t len;
const char *errstr;
- char *buf, *lbuf, *opt, *val, fpath[MAXPATHLEN];
+ char *p, *buf, *lbuf, *opt, *val, fpath[MAXPATHLEN];
i = snprintf(fpath, sizeof(fpath), "%s/%s", current_cvsroot->cr_dir,
CVS_PATH_CONFIG);
@@ -51,7 +51,17 @@ cvs_parse_configfile(void)
buf = lbuf;
}
- opt = buf;
+ p = buf;
+ while (*p == ' ')
+ p++;
+
+ if (p[0] == '#' || p[0] == '\0') {
+ if (lbuf != NULL)
+ xfree(lbuf);
+ continue;
+ }
+
+ opt = p;
if ((val = strrchr(opt, '=')) == NULL)
fatal("cvs_parse_configfile: bad option '%s'", opt);