busybox dnsd to support domainname search

Denys Vlasenko vda.linux at googlemail.com
Sun Apr 12 11:31:01 UTC 2009


On Sunday 12 April 2009 05:33, Ming-Ching Tiew wrote:
> 
> Patch included.

 static void convname(char *a, uint8_t *q)
 {
+	int j=0;
 	int i = (q[0] == '.') ? 0 : 1;
 	for (; i < MAX_HOST_LEN-1 && *q; i++, q++)
 		a[i] = tolower(*q);
 	a[0] = i - 1;
 	a[i] = 0;
+	for( i-- ; i >= 0; j++, i-- ){
+		if( a[i] == '.' ){
+			a[i] = j;
+			j=-1; // because j is incremented after this
+		}
+	}	
 }
 
 /*


Thanks.

If you will look closer, the same code is just a 15 lines above...
I reused that. I also ditched convname() as it is actually bogus
(does not account for dots in names).
--
vda


More information about the busybox mailing list