--- libc/inet/resolv.c	2007-04-23 19:01:05.000000000 +0200
+++ libc/inet/resolv.c	2008-08-15 09:27:16.000000000 +0200
@@ -214,8 +217,10 @@
 
 
 #define MAX_RECURSE 5
-#define REPLY_TIMEOUT 10
-#define MAX_RETRIES 3
+/*--- #define MAX_RETRIES 3 ---*/
+#define MAX_RETRIES __attempts
+/*--- #define REPLY_TIMEOUT 10 ---*/
+#define REPLY_TIMEOUT __timeout
 #define MAX_SERVERS 3
 #define MAX_SEARCH 4
 
@@ -239,6 +244,8 @@
 extern char * __nameserver[MAX_SERVERS] attribute_hidden;
 extern int __searchdomains attribute_hidden;
 extern char * __searchdomain[MAX_SEARCH] attribute_hidden;
+extern int __attempts;
+extern int __timeout;
 
 
 
@@ -736,6 +743,8 @@
 	    goto fail;
 
 	DPRINTF("Looking up type %d answer for '%s'\n", type, name);
+    DPRINTF("max attempts: %d (macro %d)\n", __attempts, MAX_RETRIES);
+    DPRINTF("timeout: %d (macro %d)\n", __timeout, REPLY_TIMEOUT);
 
 	/* Mess with globals while under lock */
 	__UCLIBC_MUTEX_LOCK(mylock);
@@ -791,6 +800,8 @@
 
 		DPRINTF("On try %d, sending query to port %d of machine %s\n",
 				retries+1, NAMESERVER_PORT, dns);
+        DPRINTF("max attempts: %d (macro %d)\n", __attempts, MAX_RETRIES);
+        DPRINTF("timeout: %d (macro %d)\n", __timeout, REPLY_TIMEOUT);
 
 #ifdef __UCLIBC_HAS_IPV6__
 		__UCLIBC_MUTEX_LOCK(__resolv_lock);
@@ -1025,6 +1036,8 @@
 char * __nameserver[MAX_SERVERS];
 int __searchdomains;
 char * __searchdomain[MAX_SEARCH];
+int __attempts = 3;
+int __timeout = 10;
 
 __UCLIBC_MUTEX_INIT(__resolv_lock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
 
@@ -1084,6 +1097,20 @@
 						DPRINTF("adding search %s\n", argv[i]);
 					}
 				}
+
+				if (strcmp(argv[0], "options") == 0) {
+                    DPRINTF("hit options keyword\n");
+                    for (i = 1; i < argc; i++) {
+                        if (strncmp(argv[i], "timeout:", 8) == 0) {
+                            __timeout = atoi(&argv[i][8]);
+                            DPRINTF("set timeout value %d\n", __timeout);
+                        }
+                        if (strncmp(argv[i], "attempts:", 9) == 0) {
+                            __attempts = atoi(&argv[i][9]);
+                            DPRINTF("set attempts value %d\n", __attempts);
+                        }
+                    }
+                }
 			}
 			fclose(fp);
 			DPRINTF("nameservers = %d\n", __nameservers);
