diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2008-02-04 19:08:33 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2008-02-04 19:08:33 +0000 |
commit | a0b9240664bddddeedb1798fffa69d36acef975d (patch) | |
tree | 85f4d5c4505a2332a154ddbbeef53ddecfbf046e /usr.bin/cvs/config.c | |
parent | bb6fd23cd9ea4d27e10b0e6b40885c7da78c0337 (diff) |
more CVSROOT/modules stuff:
- support for -i flag:
Run "prog" on "cvs commit" from top-level of module.
- fix some memory leaks in modules.c
- pass the line number from cvs_read_config() towards the callbacks
so its easier to print out where it's going wrong, if it ever does.
OK tobias@
Diffstat (limited to 'usr.bin/cvs/config.c')
-rw-r--r-- | usr.bin/cvs/config.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/cvs/config.c b/usr.bin/cvs/config.c index b6bc4fd1101..1b9bea490c1 100644 --- a/usr.bin/cvs/config.c +++ b/usr.bin/cvs/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.13 2008/02/01 18:10:26 joris Exp $ */ +/* $OpenBSD: config.c,v 1.14 2008/02/04 19:08:32 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -35,7 +35,7 @@ cvs_parse_configfile(void) } void -config_parse_line(char *line) +config_parse_line(char *line, int lineno) { struct rlimit rl; const char *errstr; @@ -76,10 +76,11 @@ config_parse_line(char *line) } void -cvs_read_config(char *name, void (*cb)(char *)) +cvs_read_config(char *name, void (*cb)(char *, int)) { FILE *fp; size_t len; + int lineno; char *p, *buf, *lbuf, fpath[MAXPATHLEN]; (void)xsnprintf(fpath, sizeof(fpath), "%s/%s", @@ -89,7 +90,9 @@ cvs_read_config(char *name, void (*cb)(char *)) return; lbuf = NULL; + lineno = 0; while ((buf = fgetln(fp, &len)) != NULL) { + lineno++; if (buf[len - 1] == '\n') { buf[len - 1] = '\0'; } else { @@ -106,7 +109,7 @@ cvs_read_config(char *name, void (*cb)(char *)) if (p[0] == '#' || p[0] == '\0') continue; - cb(p); + cb(p, lineno); } if (lbuf != NULL) |