* Copyright (c) 1989 The Regents of the University of California.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)config.c 5.6 (Berkeley) %G%";
char *pathbuf
, **arorder
;
* read in the configuration file, calling a function with the line
* from each matching section.
while (fgets(line
, sizeof(line
), cfp
)) {
if (!index(line
, '\n')) {
(void)fprintf(stderr
, "%s: config line too long.\n",
p
= strtok(line
, " \t\n");
for (av
= sects
; *av
; ++av
)
while (p
= strtok((char *)NULL
, " \t\n")) {
for (av
= arorder
; *av
; ++av
)
cadd(p
, len
, (char *)NULL
);
len2
= add2
? strlen(add2
) : 0;
if (!bp
|| bp
+ len1
+ len2
+ 2 >= endp
) {
if (!(pathbuf
= realloc(pathbuf
, buflen
+= 1024)))
if (!(cfp
= fopen(_PATH_MANCONF
, "r"))) {
(void)fprintf(stderr
, "%s: no configuration file %s.\n",
progname
, _PATH_MANCONF
);
char **ar
, line
[MAXLINE
];
while (fgets(line
, sizeof(line
), cfp
)) {
if (!index(line
, '\n')) {
(void)fprintf(stderr
, "%s: config line too long.\n",
p
= strtok(line
, " \t\n");
if (!p
|| *p
== '#' || strcmp(p
, WHATDB
))
while (p
= strtok((char *)NULL
, " \t\n")) {
!(ar
= realloc(ar
, (num
+= 30) * sizeof(char **))))
if (!(ar
[++cnt
] = strdup(p
)))
!(ar
= realloc(ar
, ++num
* sizeof(char **))))
char **ar
, line
[MAXLINE
];
while (fgets(line
, sizeof(line
), cfp
)) {
if (!index(line
, '\n')) {
(void)fprintf(stderr
, "%s: config line too long.\n",
p
= strtok(line
, " \t\n");
if (!p
|| *p
== '#' || strcmp(p
, SUBDIR
))
while (p
= strtok((char *)NULL
, " \t\n")) {
!(ar
= realloc(ar
, (num
+= 30) * sizeof(char **))))
if (!(ar
[++cnt
] = strdup(p
)))
!(ar
= realloc(ar
, ++num
* sizeof(char **))))
while (fgets(line
, sizeof(line
), cfp
)) {
if (!index(line
, '\n')) {
(void)fprintf(stderr
, "%s: config line too long.\n",
p
= strtok(line
, " \t\n");
(void)fprintf(stderr
, "%s: %s\n", progname
, strerror(ENOMEM
));