sdrangel: fix build on x86_64-darwin
[NixPkgs.git] / pkgs / tools / misc / man-db / systemwide-man-db-conf.patch
blob2d4477776bb18cad19fff6089350874d62c540c9
1 commit 9089291006a4258c39c75a920ad536b61504251a
2 Author: rnhmjoj <rnhmjoj@inventati.org>
3 Date: Fri May 1 19:32:15 2020 +0200
5 check for systemwide man_db.conf before the bundled one
7 diff --git a/src/manp.c b/src/manp.c
8 index 5441339..0bbf566 100644
9 --- a/src/manp.c
10 +++ b/src/manp.c
11 @@ -841,18 +841,24 @@ void read_config_file (bool optional)
14 if (getenv ("MAN_TEST_DISABLE_SYSTEM_CONFIG") == NULL) {
15 - config_file = fopen (CONFIG_FILE, "r");
16 + const char *config_filepath;
17 + if (access ("/etc/man_db.conf", F_OK) != -1) {
18 + config_filepath = "/etc/man_db.conf";
19 + } else {
20 + config_filepath = CONFIG_FILE;
21 + }
22 + config_file = fopen (config_filepath, "r");
23 if (config_file == NULL) {
24 if (optional)
25 debug ("can't open %s; continuing anyway\n",
26 - CONFIG_FILE);
27 + config_filepath);
28 else
29 error (FAIL, 0,
30 _("can't open the manpath "
31 "configuration file %s"),
32 - CONFIG_FILE);
33 + config_filepath);
34 } else {
35 - debug ("From the config file %s:\n", CONFIG_FILE);
36 + debug ("From the config file %s:\n", config_filepath);
38 add_to_dirlist (config_file, 0);
39 fclose (config_file);