diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-11-08 23:03:34 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-11-08 23:03:34 +0100 |
commit | cc596365ac9c522beb8978cfca741d23d3bf83ae (patch) | |
tree | af5e9ea9ae70a9d0b065f1c4bad997de6255ef6a | |
parent | c9e4e152e61b22186ba4f4ca58ae8c8d3d83e81e (diff) |
unboolify dmenu
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | dmenu.c | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/config.def.h b/config.def.h index bc2dc40..a9122f7 100644 --- a/config.def.h +++ b/config.def.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
2 | /* Default settings; can be overriden by command line. */ | 2 | /* Default settings; can be overriden by command line. */ |
3 | 3 | ||
4 | static bool topbar = true; /* -b option; if False, dmenu appears at bottom */ | 4 | static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ |
5 | /* -fn option overrides fonts[0]; default X11 font or font set */ | 5 | /* -fn option overrides fonts[0]; default X11 font or font set */ |
6 | static const char *fonts[] = { | 6 | static const char *fonts[] = { |
7 | "monospace:size=10" | 7 | "monospace:size=10" |
@@ -1,7 +1,6 @@ | |||
1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
2 | #include <ctype.h> | 2 | #include <ctype.h> |
3 | #include <locale.h> | 3 | #include <locale.h> |
4 | #include <stdbool.h> | ||
5 | #include <stdio.h> | 4 | #include <stdio.h> |
6 | #include <stdlib.h> | 5 | #include <stdlib.h> |
7 | #include <string.h> | 6 | #include <string.h> |
@@ -32,7 +31,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ | |||
32 | struct item { | 31 | struct item { |
33 | char *text; | 32 | char *text; |
34 | struct item *left, *right; | 33 | struct item *left, *right; |
35 | bool out; | 34 | int out; |
36 | }; | 35 | }; |
37 | 36 | ||
38 | static char text[BUFSIZ] = ""; | 37 | static char text[BUFSIZ] = ""; |
@@ -421,7 +420,7 @@ keypress(XKeyEvent *ev) | |||
421 | exit(0); | 420 | exit(0); |
422 | } | 421 | } |
423 | if (sel) | 422 | if (sel) |
424 | sel->out = true; | 423 | sel->out = 1; |
425 | break; | 424 | break; |
426 | case XK_Right: | 425 | case XK_Right: |
427 | if (text[cursor] != '\0') { | 426 | if (text[cursor] != '\0') { |
@@ -480,7 +479,7 @@ readstdin(void) | |||
480 | *p = '\0'; | 479 | *p = '\0'; |
481 | if (!(items[i].text = strdup(buf))) | 480 | if (!(items[i].text = strdup(buf))) |
482 | die("cannot strdup %u bytes:", strlen(buf) + 1); | 481 | die("cannot strdup %u bytes:", strlen(buf) + 1); |
483 | items[i].out = false; | 482 | items[i].out = 0; |
484 | if (strlen(items[i].text) > max) | 483 | if (strlen(items[i].text) > max) |
485 | max = strlen(maxstr = items[i].text); | 484 | max = strlen(maxstr = items[i].text); |
486 | } | 485 | } |
@@ -617,8 +616,7 @@ usage(void) | |||
617 | int | 616 | int |
618 | main(int argc, char *argv[]) | 617 | main(int argc, char *argv[]) |
619 | { | 618 | { |
620 | bool fast = false; | 619 | int i, fast = 0; |
621 | int i; | ||
622 | 620 | ||
623 | for (i = 1; i < argc; i++) | 621 | for (i = 1; i < argc; i++) |
624 | /* these options take no arguments */ | 622 | /* these options take no arguments */ |
@@ -626,9 +624,9 @@ main(int argc, char *argv[]) | |||
626 | puts("dmenu-"VERSION); | 624 | puts("dmenu-"VERSION); |
627 | exit(0); | 625 | exit(0); |
628 | } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ | 626 | } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ |
629 | topbar = false; | 627 | topbar = 0; |
630 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ | 628 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ |
631 | fast = true; | 629 | fast = 1; |
632 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ | 630 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ |
633 | fstrncmp = strncasecmp; | 631 | fstrncmp = strncasecmp; |
634 | fstrstr = cistrstr; | 632 | fstrstr = cistrstr; |