dmenu-caseinsensitive-5.0.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       dmenu-caseinsensitive-5.0.diff (1691B)
       ---
            1 diff --git a/dmenu.1 b/dmenu.1
            2 index 323f93c..3e3b31b 100644
            3 --- a/dmenu.1
            4 +++ b/dmenu.1
            5 @@ -3,7 +3,7 @@
            6  dmenu \- dynamic menu
            7  .SH SYNOPSIS
            8  .B dmenu
            9 -.RB [ \-bfiv ]
           10 +.RB [ \-bfsv ]
           11  .RB [ \-l
           12  .IR lines ]
           13  .RB [ \-m
           14 @@ -44,8 +44,8 @@ dmenu appears at the bottom of the screen.
           15  dmenu grabs the keyboard before reading stdin if not reading from a tty. This
           16  is faster, but will lock up X until stdin reaches end\-of\-file.
           17  .TP
           18 -.B \-i
           19 -dmenu matches menu items case insensitively.
           20 +.B \-s
           21 +dmenu matches menu items case sensitively.
           22  .TP
           23  .BI \-l " lines"
           24  dmenu lists items vertically, with the given number of lines.
           25 diff --git a/dmenu.c b/dmenu.c
           26 index 65f25ce..855df59 100644
           27 --- a/dmenu.c
           28 +++ b/dmenu.c
           29 @@ -55,8 +55,9 @@ static Clr *scheme[SchemeLast];
           30  
           31  #include "config.h"
           32  
           33 -static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
           34 -static char *(*fstrstr)(const char *, const char *) = strstr;
           35 +static char * cistrstr(const char *s, const char *sub);
           36 +static int (*fstrncmp)(const char *, const char *, size_t) = strncasecmp;
           37 +static char *(*fstrstr)(const char *, const char *) = cistrstr;
           38  
           39  static void
           40  appenditem(struct item *item, struct item **list, struct item **last)
           41 @@ -709,9 +710,9 @@ main(int argc, char *argv[])
           42                          topbar = 0;
           43                  else if (!strcmp(argv[i], "-f"))   /* grabs keyboard before reading stdin */
           44                          fast = 1;
           45 -                else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
           46 -                        fstrncmp = strncasecmp;
           47 -                        fstrstr = cistrstr;
           48 +                else if (!strcmp(argv[i], "-s")) { /* case-sensitive item matching */
           49 +                        fstrncmp = strncmp;
           50 +                        fstrstr = strstr;
           51                  } else if (i + 1 == argc)
           52                          usage();
           53                  /* these options take one argument */