- CONFIG_DIR support
authorjuandon <witekfl@pld-linux.org>
Sat, 29 Mar 2003 18:42:29 +0000 (18:42 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    fmio-home_etc.patch -> 1.1

fmio-home_etc.patch [new file with mode: 0644]

diff --git a/fmio-home_etc.patch b/fmio-home_etc.patch
new file mode 100644 (file)
index 0000000..3a688b3
--- /dev/null
@@ -0,0 +1,52 @@
+diff -Nru fmio-1.2.29/xsrc/wmfmio.c fmio-1.2.29.new/xsrc/wmfmio.c
+--- fmio-1.2.29/xsrc/wmfmio.c  Fri Jul  5 17:29:20 2002
++++ fmio-1.2.29.new/xsrc/wmfmio.c      Sat Mar 29 12:21:20 2003
+@@ -148,25 +148,37 @@
+ int
+ main(int argc,char *argv[]) {
+       char *home;
++      char *config_dir;
++      
+       myname = argv[0];
+       ParseCMDLine(argc, argv);
+-
+-      home = getenv("HOME");
+-      if (home == NULL)
+-              home = ".";
+-      strncpy(temp, home, TMPBUFSIZE);
+-      temp[TMPBUFSIZE] = '\0';
+-      strncat(temp, "/.", TMPBUFSIZE);
+-      temp[TMPBUFSIZE] = '\0';
+-      strncat(temp, RCFILE, TMPBUFSIZE);
+-      temp[TMPBUFSIZE] = '\0';
++      
++      config_dir = getenv("CONFIG_DIR");
++      if (config_dir) {
++              strncpy(temp, config_dir, TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++              strncat(temp, "/", TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++              strncat(temp, RCFILE, TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++      } else {
++              home = getenv("HOME");
++              if (home == NULL)
++                      home = ".";
++              strncpy(temp, home, TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++              strncat(temp, "/.", TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++              strncat(temp, RCFILE, TMPBUFSIZE);
++              temp[TMPBUFSIZE] = '\0';
++      }
+       if ( ParseRCFile(temp) == 1 ) {
+               strncpy(temp, "/etc/", TMPBUFSIZE);
+               temp[TMPBUFSIZE] = '\0';
+               strncat(temp, RCFILE, TMPBUFSIZE);
+               temp[TMPBUFSIZE] = '\0';
+               if (ParseRCFile(temp) == 1)
+-                      errx(1, "~/.%s or /etc/%s not found", RCFILE, RCFILE);
++                      errx(1, "$CONFIG_DIR/%s, ~/.%s or /etc/%s not found", RCFILE, RCFILE, RCFILE);
+       }
+       if (cmdline_preset == ON)
This page took 0.084263 seconds and 4 git commands to generate.