From 340b176de6db87471610c0a75450e0de9535b6ae Mon Sep 17 00:00:00 2001 From: Connor Lane Smith Date: Tue, 29 Jun 2010 16:07:31 +0100 Subject: dinput with dmenu flags, fixed usage & -v, cosmetics --- dinput.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'dinput.c') diff --git a/dinput.c b/dinput.c index 0bf2679..b69dcb3 100644 --- a/dinput.c +++ b/dinput.c @@ -76,11 +76,11 @@ drawinput(void) /* print prompt? */ if(prompt) { dc.w = promptw; - drawtext(&dc, prompt, selcol, False); + drawtext(&dc, prompt, normcol, False); dc.x += dc.w; } dc.w = mw - dc.x; - drawtext(&dc, *text ? text : NULL, normcol, False); + drawtext(&dc, *text ? text : NULL, selcol, False); drawcursor(); XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0); XFlush(dpy); @@ -329,11 +329,15 @@ main(int argc, char *argv[]) { /* command line args */ progname = argv[0]; for(i = 1; i < argc; i++) - if(!strcmp(argv[i], "-b")) + if(!strcmp(argv[i], "-i")) + ; /* ignore flag */ + else if(!strcmp(argv[i], "-b")) topbar = False; else if(!strcmp(argv[i], "-e")) { if(++i < argc) parent = atoi(argv[i]); } + else if(!strcmp(argv[i], "-l")) + i++; /* ignore flag */ else if(!strcmp(argv[i], "-fn")) { if(++i < argc) font = argv[i]; } @@ -352,13 +356,17 @@ main(int argc, char *argv[]) { else if(!strcmp(argv[i], "-sf")) { if(++i < argc) selfgcolor = argv[i]; } - else if(!strcmp(argv[i], "-v")) - eprint("dinput-"VERSION", © 2006-2010 dinput engineers, see LICENSE for details\n"); + else if(!strcmp(argv[i], "-v")) { + printf("dinput-"VERSION", © 2006-2010 dinput engineers, see LICENSE for details\n"); + exit(EXIT_SUCCESS); + } else if(!*text) strncpy(text, argv[i], sizeof text); - else - eprint("usage: dinput [-b] [-e ] [-fn ] [-nb ] [-nf ]\n" - " [-p ] [-sb ] [-sf ] [-v] []\n"); + else { + fputs("usage: dinput [-b] [-e ] [-fn ] [-nb ] [-nf ]\n" + " [-p ] [-sb ] [-sf ] [-v] []\n", stderr); + exit(EXIT_FAILURE); + } if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) fprintf(stderr, "dinput: warning: no locale support\n"); if(!(dpy = XOpenDisplay(NULL))) -- cgit v1.2.3-13-gbd6f