diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-09-27 23:02:33 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-09-27 23:02:33 +0200 |
commit | bc20c13db0fdb73a5ef2c0d4b791e05e3f324aba (patch) | |
tree | 00ccf5df5231714e902ef121fde29fdd080d6138 | |
parent | 96e60c66bc85985fe34cfdcd989abc08fc46a5e2 (diff) |
separate program-specific c99 bool and X11
True, False are X11-specific, make sure to use c99 stdbool for
program-specific things.
... also remove left-over vim mode string in config.
-rw-r--r-- | config.def.h | 6 | ||||
-rw-r--r-- | dmenu.c | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/config.def.h b/config.def.h index 4e5e3e7..bc2dc40 100644 --- a/config.def.h +++ b/config.def.h | |||
@@ -1,9 +1,7 @@ | |||
1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
2 | /* vim: expandtab | 2 | /* Default settings; can be overriden by command line. */ |
3 | */ | ||
4 | /* Default settings; can be overrided by command line. */ | ||
5 | 3 | ||
6 | static Bool topbar = True; /* -b option; if False, dmenu appears at bottom */ | 4 | static bool topbar = true; /* -b option; if False, dmenu appears at bottom */ |
7 | /* -fn option overrides fonts[0]; default X11 font or font set */ | 5 | /* -fn option overrides fonts[0]; default X11 font or font set */ |
8 | static const char *fonts[] = { | 6 | static const char *fonts[] = { |
9 | "monospace:size=10" | 7 | "monospace:size=10" |
@@ -1,6 +1,7 @@ | |||
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> | ||
4 | #include <stdio.h> | 5 | #include <stdio.h> |
5 | #include <stdlib.h> | 6 | #include <stdlib.h> |
6 | #include <string.h> | 7 | #include <string.h> |
@@ -31,7 +32,7 @@ typedef struct Item Item; | |||
31 | struct Item { | 32 | struct Item { |
32 | char *text; | 33 | char *text; |
33 | Item *left, *right; | 34 | Item *left, *right; |
34 | Bool out; | 35 | bool out; |
35 | }; | 36 | }; |
36 | 37 | ||
37 | static void appenditem(Item *item, Item **list, Item **last); | 38 | static void appenditem(Item *item, Item **list, Item **last); |
@@ -76,7 +77,7 @@ static char *(*fstrstr)(const char *, const char *) = strstr; | |||
76 | 77 | ||
77 | int | 78 | int |
78 | main(int argc, char *argv[]) { | 79 | main(int argc, char *argv[]) { |
79 | Bool fast = False; | 80 | bool fast = false; |
80 | int i; | 81 | int i; |
81 | 82 | ||
82 | for(i = 1; i < argc; i++) | 83 | for(i = 1; i < argc; i++) |
@@ -86,9 +87,9 @@ main(int argc, char *argv[]) { | |||
86 | exit(0); | 87 | exit(0); |
87 | } | 88 | } |
88 | else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ | 89 | else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ |
89 | topbar = False; | 90 | topbar = false; |
90 | else if(!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ | 91 | else if(!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ |
91 | fast = True; | 92 | fast = true; |
92 | else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ | 93 | else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ |
93 | fstrncmp = strncasecmp; | 94 | fstrncmp = strncasecmp; |
94 | fstrstr = cistrstr; | 95 | fstrstr = cistrstr; |
@@ -203,7 +204,7 @@ drawmenu(void) { | |||
203 | int x = 0, y = 0, h = bh, w; | 204 | int x = 0, y = 0, h = bh, w; |
204 | 205 | ||
205 | drw_setscheme(drw, &scheme[SchemeNorm]); | 206 | drw_setscheme(drw, &scheme[SchemeNorm]); |
206 | drw_rect(drw, 0, 0, mw, mh, True, 1, 1); | 207 | drw_rect(drw, 0, 0, mw, mh, 1, 1, 1); |
207 | 208 | ||
208 | if(prompt && *prompt) { | 209 | if(prompt && *prompt) { |
209 | drw_setscheme(drw, &scheme[SchemeSel]); | 210 | drw_setscheme(drw, &scheme[SchemeSel]); |
@@ -432,7 +433,7 @@ keypress(XKeyEvent *ev) { | |||
432 | exit(0); | 433 | exit(0); |
433 | } | 434 | } |
434 | if(sel) | 435 | if(sel) |
435 | sel->out = True; | 436 | sel->out = true; |
436 | break; | 437 | break; |
437 | case XK_Right: | 438 | case XK_Right: |
438 | if(text[cursor] != '\0') { | 439 | if(text[cursor] != '\0') { |
@@ -552,7 +553,7 @@ readstdin(void) { | |||
552 | *p = '\0'; | 553 | *p = '\0'; |
553 | if(!(items[i].text = strdup(buf))) | 554 | if(!(items[i].text = strdup(buf))) |
554 | die("cannot strdup %u bytes:", strlen(buf)+1); | 555 | die("cannot strdup %u bytes:", strlen(buf)+1); |
555 | items[i].out = False; | 556 | items[i].out = false; |
556 | if(strlen(items[i].text) > max) | 557 | if(strlen(items[i].text) > max) |
557 | max = strlen(maxstr = items[i].text); | 558 | max = strlen(maxstr = items[i].text); |
558 | } | 559 | } |