[hackers] [dmenu] unboolify dmenu || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 8 Nov 2015 23:04:23 +0100 (CET)

commit cc596365ac9c522beb8978cfca741d23d3bf83ae
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sun Nov 8 23:03:34 2015 +0100
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Sun Nov 8 23:03:34 2015 +0100

    unboolify dmenu

diff --git a/config.def.h b/config.def.h
index bc2dc40..a9122f7 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -1,7 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 /* Default settings; can be overriden by command line. */
 
-static bool topbar = true; /* -b option; if False, dmenu appears at bottom */
+static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */
 /* -fn option overrides fonts[0]; default X11 font or font set */
 static const char *fonts[] = {
         "monospace:size=10"
diff --git a/dmenu.c b/dmenu.c
index 6308fa9..a07f8e3 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -1,7 +1,6 @@
 /* See LICENSE file for copyright and license details. */
 #include <ctype.h>
 #include <locale.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
_AT_@ -32,7 +31,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
 struct item {
         char *text;
         struct item *left, *right;
- bool out;
+ int out;
 };
 
 static char text[BUFSIZ] = "";
_AT_@ -421,7 +420,7 @@ keypress(XKeyEvent *ev)
                         exit(0);
                 }
                 if (sel)
- sel->out = true;
+ sel->out = 1;
                 break;
         case XK_Right:
                 if (text[cursor] != '\0') {
_AT_@ -480,7 +479,7 @@ readstdin(void)
                         *p = '\0';
                 if (!(items[i].text = strdup(buf)))
                         die("cannot strdup %u bytes:", strlen(buf) + 1);
- items[i].out = false;
+ items[i].out = 0;
                 if (strlen(items[i].text) > max)
                         max = strlen(maxstr = items[i].text);
         }
_AT_@ -617,8 +616,7 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
- bool fast = false;
- int i;
+ int i, fast = 0;
 
         for (i = 1; i < argc; i++)
                 /* these options take no arguments */
_AT_@ -626,9 +624,9 @@ main(int argc, char *argv[])
                         puts("dmenu-"VERSION);
                         exit(0);
                 } else if (!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
- topbar = false;
+ topbar = 0;
                 else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
- fast = true;
+ fast = 1;
                 else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
                         fstrncmp = strncasecmp;
                         fstrstr = cistrstr;
Received on Sun Nov 08 2015 - 23:04:23 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 08 2015 - 23:12:11 CET