Index: trunk/src/sh_static.c
===================================================================
--- trunk/src/sh_static.c	(revision 530)
+++ trunk/src/sh_static.c	(revision 533)
@@ -908,5 +908,5 @@
 
 #undef DEBUG
-/*#define DEBUG*/
+/* #define DEBUG */
 
 #ifdef DEBUG
@@ -1000,11 +1000,13 @@
 
 	do {
-
-	        if (offset < INT_MAX)
+		l = data[offset];
+		if (offset < INT_MAX)
 	                offset++;
 		else
 		        return -1;
-
-		l = data[offset];
+		if (!l)
+		  break;
+		
+		DPRINTF("l[%d] = %d\n", offset, l);
 
 		if ((l & 0xc0) == (0xc0)) {
@@ -1023,4 +1025,5 @@
 	} while (l);
 
+	DPRINTF("orig: %d now %d\n", orig_offset, offset);
 	return offset - orig_offset;
 }
@@ -1265,5 +1268,5 @@
 		h.rd = 1;
 
-		DPRINTF("encoding header\n", h.rd);
+		DPRINTF("encoding header %d\n", h.rd);
 
 		i = __encode_header(&h, packet, PACKETSZ);
@@ -1714,4 +1717,5 @@
 	char ** __nameserverXX;
 
+	DPRINTF("sh_gethostbyname_r: /%s/\n", name);
 	__open_nameservers();
 
@@ -1814,4 +1818,5 @@
 			free(packet);
 			*h_errnop=HOST_NOT_FOUND;
+			DPRINTF("host_not_found\n");
 			return TRY_AGAIN;
 		}
@@ -1830,7 +1835,7 @@
 			sizeof(char *)*(ALIAS_DIM) + 256/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
-
+	
+	DPRINTF("sh_gethostbyname: /%s/\n", name);
 	sh_gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno);
-
 	return hp;
 }
@@ -1891,4 +1896,5 @@
 	char ** __nameserverXX;
 
+	DPRINTF("sh_gethostbyaddr_r called\n");
 	*result=NULL;
 	if (!addr)
@@ -2061,4 +2067,5 @@
 	struct hostent *hp;
 
+	DPRINTF("sh_gethostbyaddr called\n");
 	sh_gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno);
         
