[hackers] [dmenu] separate program-specific c99 bool and X11 || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 27 Sep 2015 23:07:45 +0200 (CEST)

commit bc20c13db0fdb73a5ef2c0d4b791e05e3f324aba
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sun Sep 27 23:02:33 2015 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Sun Sep 27 23:02:33 2015 +0200

    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.

diff --git a/config.def.h b/config.def.h
index 4e5e3e7..bc2dc40 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -1,9 +1,7 @@
 /* See LICENSE file for copyright and license details. */
-/* vim: expandtab
- */
-/* Default settings; can be overrided by command line. */
+/* Default settings; can be overriden by command line. */
 
-static Bool topbar = True; /* -b option; if False, dmenu appears at bottom */
+static bool topbar = true; /* -b option; if False, 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 f0bc176..9e78e83 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -1,6 +1,7 @@
 /* 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_@ -31,7 +32,7 @@ typedef struct Item Item;
 struct Item {
         char *text;
         Item *left, *right;
- Bool out;
+ bool out;
 };
 
 static void appenditem(Item *item, Item **list, Item **last);
_AT_@ -76,7 +77,7 @@ static char *(*fstrstr)(const char *, const char *) = strstr;
 
 int
 main(int argc, char *argv[]) {
- Bool fast = False;
+ bool fast = false;
         int i;
 
         for(i = 1; i < argc; i++)
_AT_@ -86,9 +87,9 @@ main(int argc, char *argv[]) {
                         exit(0);
                 }
                 else if(!strcmp(argv[i], "-b")) /* appears at the bottom of the screen */
- topbar = False;
+ topbar = false;
                 else if(!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
- fast = True;
+ fast = true;
                 else if(!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
                         fstrncmp = strncasecmp;
                         fstrstr = cistrstr;
_AT_@ -203,7 +204,7 @@ drawmenu(void) {
         int x = 0, y = 0, h = bh, w;
 
         drw_setscheme(drw, &scheme[SchemeNorm]);
- drw_rect(drw, 0, 0, mw, mh, True, 1, 1);
+ drw_rect(drw, 0, 0, mw, mh, 1, 1, 1);
 
         if(prompt && *prompt) {
                 drw_setscheme(drw, &scheme[SchemeSel]);
_AT_@ -432,7 +433,7 @@ keypress(XKeyEvent *ev) {
                         exit(0);
                 }
                 if(sel)
- sel->out = True;
+ sel->out = true;
                 break;
         case XK_Right:
                 if(text[cursor] != '\0') {
_AT_@ -552,7 +553,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 = false;
                 if(strlen(items[i].text) > max)
                         max = strlen(maxstr = items[i].text);
         }
Received on Sun Sep 27 2015 - 23:07:45 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 27 2015 - 23:12:11 CEST