unboolify dmenu
cc596365
2 file(s) · +7 −9
| 1 | 1 | /* See LICENSE file for copyright and license details. */ |
|
| 2 | 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 | 5 | /* -fn option overrides fonts[0]; default X11 font or font set */ |
|
| 6 | 6 | static const char *fonts[] = { |
|
| 7 | 7 | "monospace:size=10" |
| 1 | 1 | /* See LICENSE file for copyright and license details. */ |
|
| 2 | 2 | #include <ctype.h> |
|
| 3 | 3 | #include <locale.h> |
|
| 4 | - | #include <stdbool.h> |
|
| 5 | 4 | #include <stdio.h> |
|
| 6 | 5 | #include <stdlib.h> |
|
| 7 | 6 | #include <string.h> |
|
| 32 | 31 | struct item { |
|
| 33 | 32 | char *text; |
|
| 34 | 33 | struct item *left, *right; |
|
| 35 | - | bool out; |
|
| 34 | + | int out; |
|
| 36 | 35 | }; |
|
| 37 | 36 | ||
| 38 | 37 | static char text[BUFSIZ] = ""; |
|
| 421 | 420 | exit(0); |
|
| 422 | 421 | } |
|
| 423 | 422 | if (sel) |
|
| 424 | - | sel->out = true; |
|
| 423 | + | sel->out = 1; |
|
| 425 | 424 | break; |
|
| 426 | 425 | case XK_Right: |
|
| 427 | 426 | if (text[cursor] != '\0') { |
|
| 480 | 479 | *p = '\0'; |
|
| 481 | 480 | if (!(items[i].text = strdup(buf))) |
|
| 482 | 481 | die("cannot strdup %u bytes:", strlen(buf) + 1); |
|
| 483 | - | items[i].out = false; |
|
| 482 | + | items[i].out = 0; |
|
| 484 | 483 | if (strlen(items[i].text) > max) |
|
| 485 | 484 | max = strlen(maxstr = items[i].text); |
|
| 486 | 485 | } |
|
| 617 | 616 | int |
|
| 618 | 617 | main(int argc, char *argv[]) |
|
| 619 | 618 | { |
|
| 620 | - | bool fast = false; |
|
| 621 | - | int i; |
|
| 619 | + | int i, fast = 0; |
|
| 622 | 620 | ||
| 623 | 621 | for (i = 1; i < argc; i++) |
|
| 624 | 622 | /* these options take no arguments */ |
|
| 626 | 624 | puts("dmenu-"VERSION); |
|
| 627 | 625 | exit(0); |
|
| 628 | 626 | } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */ |
|
| 629 | - | topbar = false; |
|
| 627 | + | topbar = 0; |
|
| 630 | 628 | else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */ |
|
| 631 | - | fast = true; |
|
| 629 | + | fast = 1; |
|
| 632 | 630 | else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */ |
|
| 633 | 631 | fstrncmp = strncasecmp; |
|
| 634 | 632 | fstrstr = cistrstr; |
|