]> git.pld-linux.org Git - packages/fmio.git/blob - fmio-home_etc.patch
- CONFIG_DIR support
[packages/fmio.git] / fmio-home_etc.patch
1 diff -Nru fmio-1.2.29/xsrc/wmfmio.c fmio-1.2.29.new/xsrc/wmfmio.c
2 --- fmio-1.2.29/xsrc/wmfmio.c   Fri Jul  5 17:29:20 2002
3 +++ fmio-1.2.29.new/xsrc/wmfmio.c       Sat Mar 29 12:21:20 2003
4 @@ -148,25 +148,37 @@
5  int
6  main(int argc,char *argv[]) {
7         char *home;
8 +       char *config_dir;
9 +       
10         myname = argv[0];
11         ParseCMDLine(argc, argv);
12 -
13 -       home = getenv("HOME");
14 -       if (home == NULL)
15 -               home = ".";
16 -       strncpy(temp, home, TMPBUFSIZE);
17 -       temp[TMPBUFSIZE] = '\0';
18 -       strncat(temp, "/.", TMPBUFSIZE);
19 -       temp[TMPBUFSIZE] = '\0';
20 -       strncat(temp, RCFILE, TMPBUFSIZE);
21 -       temp[TMPBUFSIZE] = '\0';
22 +       
23 +       config_dir = getenv("CONFIG_DIR");
24 +       if (config_dir) {
25 +               strncpy(temp, config_dir, TMPBUFSIZE);
26 +               temp[TMPBUFSIZE] = '\0';
27 +               strncat(temp, "/", TMPBUFSIZE);
28 +               temp[TMPBUFSIZE] = '\0';
29 +               strncat(temp, RCFILE, TMPBUFSIZE);
30 +               temp[TMPBUFSIZE] = '\0';
31 +       } else {
32 +               home = getenv("HOME");
33 +               if (home == NULL)
34 +                       home = ".";
35 +               strncpy(temp, home, TMPBUFSIZE);
36 +               temp[TMPBUFSIZE] = '\0';
37 +               strncat(temp, "/.", TMPBUFSIZE);
38 +               temp[TMPBUFSIZE] = '\0';
39 +               strncat(temp, RCFILE, TMPBUFSIZE);
40 +               temp[TMPBUFSIZE] = '\0';
41 +       }
42         if ( ParseRCFile(temp) == 1 ) {
43                 strncpy(temp, "/etc/", TMPBUFSIZE);
44                 temp[TMPBUFSIZE] = '\0';
45                 strncat(temp, RCFILE, TMPBUFSIZE);
46                 temp[TMPBUFSIZE] = '\0';
47                 if (ParseRCFile(temp) == 1)
48 -                       errx(1, "~/.%s or /etc/%s not found", RCFILE, RCFILE);
49 +                       errx(1, "$CONFIG_DIR/%s, ~/.%s or /etc/%s not found", RCFILE, RCFILE, RCFILE);
50         }
51  
52         if (cmdline_preset == ON)
This page took 0.027799 seconds and 3 git commands to generate.