Hi,

it also defines feature macro _BSD_SOURCE, so usleep and strdup is
declared.

patch attached.

-Ph


-- 
Premysl "Anydot" Hruby, http://www.redrum.cz/
diff -r 0088cc3243e3 config.mk
--- a/config.mk	Sat Jun 21 16:43:12 2008 +0100
+++ b/config.mk	Wed Jun 25 23:09:40 2008 +0200
@@ -19,7 +19,7 @@
 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}
 
 # flags
-CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -D_BSD_SOURCE
 CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
 LDFLAGS = -s ${LIBS}
 
diff -r 0088cc3243e3 dmenu.c
--- a/dmenu.c	Sat Jun 21 16:43:12 2008 +0100
+++ b/dmenu.c	Wed Jun 25 23:09:40 2008 +0200
@@ -129,25 +129,12 @@
 
 char *
 cistrstr(const char *s, const char *sub) {
-	int c, csub;
-	uint len;
-
 	if(!sub)
-		return (char *)s;
-	if((c = *sub++) != 0) {
-		c = tolower(c);
-		len = strlen(sub);
-		do {
-			do {
-				if((csub = *s++) == 0)
-					return (NULL);
-			}
-			while(tolower(csub) != c);
-		}
-		while(strncasecmp(s, sub, len) != 0);
-		s--;
-	}
-	return (char *)s;
+		return (char *)1;
+	for (; *s; s++)
+		if (strcasecmp(s, sub) == 0)
+			return (char *)1;
+	return (char *)NULL;
 }
 
 void
@@ -411,11 +398,7 @@
 	switch(ksym) {
 	default:
 		if(num && !iscntrl((int) buf[0])) {
-			buf[num] = 0;
-			if(len > 0)
-				strncat(text, buf, sizeof text);
-			else
-				strncpy(text, buf, sizeof text);
+			strncat(text, buf, num);
 			match(text);
 		}
 		break;

Reply via email to