diff options
author | 2006-05-27 21:10:53 +0000 | |
---|---|---|
committer | 2006-05-27 21:10:53 +0000 | |
commit | 287609c081c96e6b97e7a07d8c27a35f60f28ecc (patch) | |
tree | 571074301ad7a0ff616813ed774450993aef66b4 | |
parent | document modp3072. (diff) | |
download | wireguard-openbsd-287609c081c96e6b97e7a07d8c27a35f60f28ecc.tar.xz wireguard-openbsd-287609c081c96e6b97e7a07d8c27a35f60f28ecc.zip |
handle comments and leading spaces correctly
in CVSROOT/config
-rw-r--r-- | usr.bin/cvs/config.c | 16 |
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); |