X-Git-Url: https://git.xinqibao.xyz/dmenu.git/blobdiff_plain/194d890517ef3b9efce9e51976ebc19fbbd498b8..93c3f930c537ff5275fe4383ea00e8f13edcf13c:/main.c?ds=sidebyside diff --git a/main.c b/main.c index 7228cb6..743967a 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,7 @@ #include "dmenu.h" #include +#include #include #include #include @@ -144,7 +145,7 @@ kpress(XKeyEvent * e) { len = strlen(text); buf[0] = 0; - num = XLookupString(e, buf, sizeof(buf), &ksym, 0); + num = XLookupString(e, buf, sizeof buf, &ksym, 0); if(IsFunctionKey(ksym) || IsKeypadKey(ksym) || IsMiscFunctionKey(ksym) || IsPFKey(ksym) || IsPrivateKeypadKey(ksym)) @@ -181,7 +182,7 @@ kpress(XKeyEvent * e) { case XK_Tab: if(!sel) return; - strncpy(text, sel->text, sizeof(text)); + strncpy(text, sel->text, sizeof text); match(text); break; case XK_Right: @@ -221,9 +222,9 @@ kpress(XKeyEvent * e) { if(num && !iscntrl((int) buf[0])) { buf[num] = 0; if(len > 0) - strncat(text, buf, sizeof(text)); + strncat(text, buf, sizeof text); else - strncpy(text, buf, sizeof(text)); + strncpy(text, buf, sizeof text); match(text); } } @@ -238,7 +239,7 @@ readstdin(void) { Item *i, *new; i = 0; - while(fgets(buf, sizeof(buf), stdin)) { + while(fgets(buf, sizeof buf, stdin)) { len = strlen(buf); if (buf[len - 1] == '\n') buf[len - 1] = 0; @@ -309,6 +310,7 @@ main(int argc, char *argv[]) { } else eprint("usage: dmenu [-font ] [-{norm,sel}{bg,fg} ] [-t ] [-v]\n", stdout); + setlocale(LC_CTYPE, ""); dpy = XOpenDisplay(0); if(!dpy) eprint("dmenu: cannot open display\n");