+
+int
+main(int argc, char *argv[]) {
+ Bool fast = False;
+ int i;
+
+ for(i = 1; i < argc; i++)
+ /* these options take no arguments */
+ if(!strcmp(argv[i], "-v")) { /* prints version information */
+ puts("dmenu-"VERSION", © 2006-2012 dmenu engineers, see LICENSE for details");
+ exit(EXIT_SUCCESS);
+ }
+ else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
+ topbar = False;
+ else if(!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
+ fast = True;
+ else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
+ fstrncmp = strncasecmp;
+ fstrstr = cistrstr;
+ }
+ else if(i+1 == argc)
+ usage();
+ /* these options take one argument */
+ else if(!strcmp(argv[i], "-l")) /* number of lines in vertical list */
+ lines = atoi(argv[++i]);
+ else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */
+ prompt = argv[++i];
+ else if(!strcmp(argv[i], "-fn")) /* font or font set */
+ font = argv[++i];
+ else if(!strcmp(argv[i], "-nb")) /* normal background color */
+ normbgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-nf")) /* normal foreground color */
+ normfgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-sb")) /* selected background color */
+ selbgcolor = argv[++i];
+ else if(!strcmp(argv[i], "-sf")) /* selected foreground color */
+ selfgcolor = argv[++i];
+ else
+ usage();
+
+ dc = initdc();
+ initfont(dc, font);
+
+ if(fast) {
+ grabkeyboard();
+ readstdin();
+ }
+ else {
+ readstdin();
+ grabkeyboard();
+ }
+ setup();
+ run();
+
+ return 1; /* unreachable */
+}