version 1.24, 2015/04/28 16:13:45 |
version 1.25, 2015/05/07 12:08:13 |
Line 84 manconf_parse(struct manconf *conf, const char *file, |
|
Line 84 manconf_parse(struct manconf *conf, const char *file, |
|
free(buf); |
free(buf); |
pclose(stream); |
pclose(stream); |
#else |
#else |
char manpath_default[] = MANPATH_DEFAULT; |
|
char *insert; |
char *insert; |
|
|
/* Always prepend -m. */ |
/* Always prepend -m. */ |
Line 104 manconf_parse(struct manconf *conf, const char *file, |
|
Line 103 manconf_parse(struct manconf *conf, const char *file, |
|
/* No MANPATH; use man.conf(5) only. */ |
/* No MANPATH; use man.conf(5) only. */ |
if (NULL == defp || '\0' == defp[0]) { |
if (NULL == defp || '\0' == defp[0]) { |
manconf_file(conf, file); |
manconf_file(conf, file); |
if (conf->manpath.sz == 0) |
|
manpath_parseline(&conf->manpath, manpath_default, 0); |
|
return; |
return; |
} |
} |
|
|
|
|
manconf_file(struct manconf *conf, const char *file) |
manconf_file(struct manconf *conf, const char *file) |
{ |
{ |
const char *const toks[] = { "manpath", "output", "_whatdb" }; |
const char *const toks[] = { "manpath", "output", "_whatdb" }; |
|
char manpath_default[] = MANPATH_DEFAULT; |
|
|
FILE *stream; |
FILE *stream; |
char *cp, *ep; |
char *cp, *ep; |
size_t len, tok; |
size_t len, tok; |
|
|
if ((stream = fopen(file, "r")) == NULL) |
if ((stream = fopen(file, "r")) == NULL) |
return; |
goto out; |
|
|
while ((cp = fgetln(stream, &len)) != NULL) { |
while ((cp = fgetln(stream, &len)) != NULL) { |
ep = cp + len; |
ep = cp + len; |
Line 250 manconf_file(struct manconf *conf, const char *file) |
|
Line 248 manconf_file(struct manconf *conf, const char *file) |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case 0: /* manpath */ |
case 0: /* manpath */ |
manpath_add(&conf->manpath, cp, 0); |
manpath_add(&conf->manpath, cp, 0); |
|
*manpath_default = '\0'; |
break; |
break; |
case 1: /* output */ |
case 1: /* output */ |
manconf_output(&conf->output, cp); |
manconf_output(&conf->output, cp); |
Line 258 manconf_file(struct manconf *conf, const char *file) |
|
Line 257 manconf_file(struct manconf *conf, const char *file) |
|
break; |
break; |
} |
} |
} |
} |
|
|
fclose(stream); |
fclose(stream); |
|
|
|
out: |
|
if (*manpath_default != '\0') |
|
manpath_parseline(&conf->manpath, manpath_default, 0); |
} |
} |
|
|
void |
void |