static bool short_form = false, printcmd = true,
plusquest = false, pluscomm = false,
- ipv4only = false, ipv6only = false;
+ ipv4only = false, ipv6only = false, digrc = true;
static uint32_t splitwidth = 0xffffffff;
/*% opcode text */
" -m (enable memory usage debugging)\n"
" -p port (specify port number)\n"
" -q name (specify query name)\n"
+" -r (do not read ~/.digrc)\n"
" -t type (specify query type)\n"
" -u (display times in usec instead of msec)\n"
" -x dot-notation (shortcut for reverse lookups)\n"
/*%
* #true returned if value was used
*/
-static const char *single_dash_opts = "46dhimnuv";
-static const char *dash_opts = "46bcdfhikmnpqtvyx";
+static const char *single_dash_opts = "46dhimnruv";
+static const char *dash_opts = "46bcdfhikmnpqrtvyx";
static bool
dash_option(char *option, char *next, dig_lookup_t **lookup,
bool *open_type_class, bool *need_clone,
case 'n':
/* deprecated */
break;
+ case 'r':
+ debug("digrc (late)");
+ digrc = false;
+ break;
case 'u':
(*lookup)->use_usec = true;
break;
option = &rv[0][1];
while (strpbrk(option, single_dash_opts) == &option[0]) {
switch (option[0]) {
+ case 'd':
+ /* For debugging early startup */
+ debugging = true;
+ break;
case 'm':
memdebugging = true;
isc_mem_debugging = ISC_MEM_DEBUGTRACE |
ISC_MEM_DEBUGRECORD;
break;
+ case 'r':
+ /*
+ * Must be done early, because ~/.digrc
+ * is read before command line parsing
+ */
+ debug("digrc (early)");
+ digrc = false;
+ break;
case '4':
if (ipv6only)
fatal("only one of -4 and -6 allowed");
*/
INSIST(batchfp == NULL);
homedir = getenv("HOME");
- if (homedir != NULL) {
+ if (homedir != NULL && digrc) {
unsigned int n;
+ debug("digrc (open)");
n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc",
homedir);
if (n < sizeof(rcfile)) {
<para>
It is possible to set per-user defaults for <command>dig</command> via
- <filename>${HOME}/.digrc</filename>. This file is read and
- any options in it
- are applied before the command line arguments.
+ <filename>${HOME}/.digrc</filename>. This file is read and any
+ options in it are applied before the command line arguments.
+ The <option>-r</option> option disables this feature, for
+ scripts that need predictable behaviour.
</para>
<para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-r</term>
+ <listitem>
+ <para>
+ Do not read options from <filename>${HOME}/.digrc</filename>.
+ This is useful for scripts that need predictable behaviour.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-t <replaceable class="parameter">type</replaceable></term>
<listitem>