* Copyright (c) 1989 The Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)config.c 5.1 (Berkeley) %G%";
* read in the configuration file, convert it to a colon separated
char *buf
, *endp
, line
[256], *realloc();
if (!freopen(_PATH_MANCONF
, "r", stdin
)) {
(void)fprintf(stderr
, "%s: no configuration file %s.\n",
progname
, _PATH_MANCONF
);
while (fgets(line
, sizeof(line
), stdin
)) {
if (!index(line
, '\n')) {
(void)fprintf(stderr
, "%s: config line too long.\n",
len
= strcspn(line
, " \t\n");
if (!len
|| *line
== '#')
if (!p
|| p
+ len
+ 2 >= endp
) {
if (!(buf
= realloc(buf
, buflen
+= 1024)))
(void)fprintf(stderr
, "%s: %s\n", strerror(ENOMEM
), progname
);