separate program-specific c99 bool and X11 bc20c13d
True, False are X11-specific, make sure to use c99 stdbool for
program-specific things.

... also remove left-over vim mode string in config.
Hiltjo Posthuma · 2015-09-27 23:02 2 file(s) · +10 −11
config.def.h +2 −4
1 1
/* See LICENSE file for copyright and license details. */
2 -
/* vim: expandtab
3 -
 */
4 -
/* Default settings; can be overrided by command line. */
2 +
/* Default settings; can be overriden 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 5
/* -fn option overrides fonts[0]; default X11 font or font set */
8 6
static const char *fonts[] = {
9 7
	"monospace:size=10"
dmenu.c +8 −7
1 1
/* See LICENSE file for copyright and license details. */
2 2
#include <ctype.h>
3 3
#include <locale.h>
4 +
#include <stdbool.h>
4 5
#include <stdio.h>
5 6
#include <stdlib.h>
6 7
#include <string.h>
31 32
struct Item {
32 33
	char *text;
33 34
	Item *left, *right;
34 -
	Bool out;
35 +
	bool out;
35 36
};
36 37
37 38
static void appenditem(Item *item, Item **list, Item **last);
76 77
77 78
int
78 79
main(int argc, char *argv[]) {
79 -
	Bool fast = False;
80 +
	bool fast = false;
80 81
	int i;
81 82
82 83
	for(i = 1; i < argc; i++)
86 87
			exit(0);
87 88
		}
88 89
		else if(!strcmp(argv[i], "-b"))   /* appears at the bottom of the screen */
89 -
			topbar = False;
90 +
			topbar = false;
90 91
		else if(!strcmp(argv[i], "-f"))   /* grabs keyboard before reading stdin */
91 -
			fast = True;
92 +
			fast = true;
92 93
		else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
93 94
			fstrncmp = strncasecmp;
94 95
			fstrstr = cistrstr;
203 204
	int x = 0, y = 0, h = bh, w;
204 205
205 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 209
	if(prompt && *prompt) {
209 210
		drw_setscheme(drw, &scheme[SchemeSel]);
432 433
			exit(0);
433 434
		}
434 435
		if(sel)
435 -
			sel->out = True;
436 +
			sel->out = true;
436 437
		break;
437 438
	case XK_Right:
438 439
		if(text[cursor] != '\0') {
552 553
			*p = '\0';
553 554
		if(!(items[i].text = strdup(buf)))
554 555
			die("cannot strdup %u bytes:", strlen(buf)+1);
555 -
		items[i].out = False;
556 +
		items[i].out = false;
556 557
		if(strlen(items[i].text) > max)
557 558
			max = strlen(maxstr = items[i].text);
558 559
	}