diff -r 545ec6141dc4 dmenu.c
--- a/dmenu.c	Wed May 05 11:42:39 2010 +0100
+++ b/dmenu.c	Tue May 11 13:13:03 2010 +0100
@@ -63,7 +63,7 @@
 static void initfont(const char *fontstr);
 static void kpress(XKeyEvent * e);
 static void match(char *pattern);
-static void readstdin(void);
+static void readmenu(char **argv);
 static void run(void);
 static void setup(Bool topbar);
 static int textnw(const char *text, unsigned int len);
@@ -609,17 +609,21 @@
 }
 
 void
-readstdin(void) {
-	char *p, buf[sizeof text];
+readmenu(char **argv) {
+	char *p, *s, buf[sizeof text];
 	unsigned int len = 0, max = 0;
+	Bool args = False;
 	Item *i, *new;
 
+	if(*argv)
+		args = True;
 	i = NULL;
-	while(fgets(buf, sizeof buf, stdin)) {
-		len = strlen(buf);
-		if(buf[len-1] == '\n')
-			buf[--len] = '\0';
-		if(!(p = strdup(buf)))
+	while(*argv || (!args && fgets(buf, sizeof buf, stdin))) {
+		s = args ? *argv++ : buf;
+		len = strlen(s);
+		if(s[len-1] == '\n')
+			s[--len] = '\0';
+		if(!(p = strdup(s)))
 			eprint("fatal: could not strdup() %u bytes\n", len);
 		if(max < len || !maxname) {
 			maxname = p;
@@ -798,8 +802,7 @@
 		else if(!strcmp(argv[i], "-v"))
 			eprint("dmenu-"VERSION", © 2006-2010 dmenu engineers, see LICENSE for details\n");
 		else
-			eprint("usage: dmenu [-i] [-b] [-e <xid>] [-l <lines>] [-fn <font>] [-nb <color>]\n"
-			       "             [-nf <color>] [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n");
+			break;
 	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
 		fprintf(stderr, "warning: no locale support\n");
 	if(!(dpy = XOpenDisplay(NULL)))
@@ -808,7 +811,7 @@
 	if(!parent)
 		parent = RootWindow(dpy, screen);
 
-	readstdin();
+	readmenu(argv + i);
 	running = grabkeyboard();
 
 	setup(topbar);
