]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Move .digrc to home dir, and hide behinf #ifndef NOPOSIX
authorMichael Sawyer <source@isc.org>
Mon, 24 Jul 2000 23:13:44 +0000 (23:13 +0000)
committerMichael Sawyer <source@isc.org>
Mon, 24 Jul 2000 23:13:44 +0000 (23:13 +0000)
bin/dig/dig.c

index 87c1288bc25296eaf3d9a7d533d4b358511aeac3..0b78e6b47e952ec463d96835493e891952f58fad 100644 (file)
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */
 
-/* $Id: dig.c,v 1.76 2000/07/24 20:46:55 mws Exp $ */
+/* $Id: dig.c,v 1.77 2000/07/24 23:13:44 mws Exp $ */
 
 #include <config.h>
 #include <stdlib.h>
@@ -584,6 +584,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
        int rc;
        char **rv;
        char *ptr;
+#ifndef NOPOSIX
+       char *homedir;
+       char rcfile[132];
+#endif
 
        /*
         * The semantics for parsing the args is a bit complex; if
@@ -601,11 +605,16 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
                debug("making new lookup");
                default_lookup = make_empty_lookup();
 
+#ifndef NOPOSIX
                /*
                 * Treat .digrc as a special batchfile
-                * XXXMWS should check $HOME in some portable way
                 */
-               batchfp = fopen(".digrc", "r");
+               homedir = getenv("HOME");
+               if (homedir != NULL)
+                       snprintf(rcfile, 132, "%s/.digrc", homedir);
+               else
+                       strcpy(rcfile, ".digrc");
+               batchfp = fopen(rcfile, "r");
                if (batchfp != NULL) {
                        while (fgets(batchline, sizeof(batchline),
                                     batchfp) != 0) {
@@ -627,6 +636,7 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
                        }
                        fclose(batchfp);
                }
+#endif
        }
 
        lookup = default_lookup;