From aa38fc9f67c2cd6f8e59941e7ed4b9b855a98d02 Mon Sep 17 00:00:00 2001 From: Michael Sawyer Date: Mon, 24 Jul 2000 23:13:44 +0000 Subject: [PATCH] Move .digrc to home dir, and hide behinf #ifndef NOPOSIX --- bin/dig/dig.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 87c1288bc2..0b78e6b47e 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -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 #include @@ -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;