From: hjl@valinux.com (H.J. Lu)
To: libc-hacker@sourceware.cygnus.com (GNU C Library)
Subject: A patch for libresolv
Date: Tue, 05 Oct 1999 18:27:00 -0000 [thread overview]
Message-ID: <19991006012700.3C0933FC1@valinux.com> (raw)
Hi,
There are many options in libresolve. However, there are no codes to
set them. Here is a patch to handle options for libresolve.
--
H.J. Lu (hjl@gnu.org)
--
Tue Oct 5 18:23:01 1999 H.J. Lu <hjl@gnu.org>
* resolv/res_init.c (o_mnemonic): New.
(res_setoptions): Use it.
Index: resolv/res_init.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/resolv/res_init.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 res_init.c
--- resolv/res_init.c 1999/05/05 01:35:31 1.1.1.9
+++ resolv/res_init.c 1999/10/06 01:21:05
@@ -111,6 +111,7 @@ static int netinfo_res_init __P((int *ha
#endif
static void res_setoptions __P((char *, char *)) internal_function;
+static u_long o_mnemonic __P((const char * mnemonic)) internal_function;
#ifdef RESOLVSORT
static const char sort_mask[] = "/&";
@@ -427,12 +428,66 @@ res_init()
return (0);
}
+/*
+ * Return an option from a mnemonic.
+ */
+static u_long
+internal_function
+o_mnemonic (mnemonic)
+ const char * mnemonic;
+{
+ if (strncasecmp (mnemonic, "init", sizeof ("init") - 1) == 0)
+ return RES_INIT;
+ else if (strncasecmp (mnemonic, "debug",
+ sizeof ("debug") - 1) == 0)
+ return RES_DEBUG;
+ else if (strncasecmp (mnemonic, "aaonly",
+ sizeof ("aaonly") - 1) == 0)
+ return RES_AAONLY;
+ else if (strncasecmp (mnemonic, "usevc",
+ sizeof ("usevc") - 1) == 0)
+ return RES_USEVC;
+ else if (strncasecmp (mnemonic, "primry",
+ sizeof ("primry") - 1) == 0)
+ return RES_PRIMARY;
+ else if (strncasecmp (mnemonic, "igntc",
+ sizeof ("igntc") - 1) == 0)
+ return RES_IGNTC;
+ else if (strncasecmp (mnemonic, "recurs",
+ sizeof ("recurs") - 1) == 0)
+ return RES_RECURSE;
+ else if (strncasecmp (mnemonic, "defnam",
+ sizeof ("defnam") - 1) == 0)
+ return RES_DEFNAMES;
+ else if (strncasecmp (mnemonic, "styopn",
+ sizeof ("styopn") - 1) == 0)
+ return RES_STAYOPEN;
+ else if (strncasecmp (mnemonic, "dnsrch",
+ sizeof ("dnsrch") - 1) == 0)
+ return RES_DNSRCH;
+ else if (strncasecmp (mnemonic, "insecure1",
+ sizeof ("insecure1") - 1) == 0)
+ return RES_INSECURE1;
+ else if (strncasecmp (mnemonic, "insecure2",
+ sizeof ("insecure2") - 1) == 0)
+ return RES_INSECURE2;
+ else if (strncasecmp (mnemonic, "noaliases",
+ sizeof ("noaliases") - 1) == 0)
+ return RES_NOALIASES;
+ else if (strncasecmp (mnemonic, "inet6",
+ sizeof ("inet6") - 1) == 0)
+ return RES_USE_INET6;
+ else
+ return ~0;
+}
+
static void
internal_function
res_setoptions(options, source)
char *options, *source;
{
char *cp = options;
+ u_long option;
int i;
#ifdef DEBUG
@@ -464,8 +519,8 @@ res_setoptions(options, source)
}
printf(";;\tdebug\n");
#endif
- } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
- _res.options |= RES_USE_INET6;
+ } else if ((option = o_mnemonic (cp)) != ~0) {
+ _res.options |= option;
} else {
/* XXX - print a warning here? */
}
next reply other threads:[~1999-10-05 18:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-05 18:27 H.J. Lu [this message]
1999-10-11 14:47 ` Ulrich Drepper
1999-10-11 15:00 ` H.J. Lu
1999-10-11 15:07 ` Ulrich Drepper
1999-10-11 15:11 ` H.J. Lu
1999-10-11 17:20 ` Geoff Keating
1999-10-11 17:26 ` H.J. Lu
1999-10-11 17:37 ` Geoff Keating
1999-10-11 17:56 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19991006012700.3C0933FC1@valinux.com \
--to=hjl@valinux.com \
--cc=libc-hacker@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).