t* sacc + cursorline and uri preview
       
   URI git clone git://git.codevoid.de/sacc-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit 3f367506841bfd8944cc57e3ccf231c41130af5e
   DIR parent 711ff51a2e198b5471b9f372127119530f6bef70
   URI Author: parazyd <parazyd@dyne.org>
       Date:   Sun, 20 May 2018 22:55:30 +0200
       
       Be case-insensitive for inline searching.
       
       Diffstat:
         M common.h                            |       3 +++
         M config.mk                           |       5 +++--
         M sacc.c                              |      12 ++++++++++++
         M ui_ti.c                             |       4 ++--
         M ui_txt.c                            |       2 +-
       
       5 files changed, 21 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/common.h b/common.h
       t@@ -26,6 +26,9 @@ struct dir {
        #ifdef NEED_ASPRINTF
        int asprintf(char **s, const char *fmt, ...);
        #endif /* NEED_ASPRINTF */
       +#ifdef NEED_STRCASESTR
       +char *strcasestr(const char *h, const char *n);
       +#endif /* NEED_STRCASESTR */
        void die(const char *fmt, ...);
        size_t mbsprint(const char *s, size_t len);
        const char *typedisplay(char t);
   DIR diff --git a/config.mk b/config.mk
       t@@ -9,5 +9,6 @@ MANDIR = $(PREFIX)/share/man/man1
        UI=ti
        LIBS=-lcurses
        
       -# Define NEED_ASPRINTF in your cflags is your system doesn't provide asprintf()
       -#CFLAGS = -DNEED_ASPRINTF
       +# Define NEED_ASPRINTF and/or NEED_STRCASESTR in your cflags if your system does
       +# not provide asprintf() or strcasestr(), respectively.
       +#CFLAGS = -DNEED_ASPRINTF -DNEED_STRCASESTR
   DIR diff --git a/sacc.c b/sacc.c
       t@@ -62,6 +62,18 @@ asprintf(char **s, const char *fmt, ...)
        }
        #endif /* NEED_ASPRINTF */
        
       +#ifdef NEED_STRCASESTR
       +char *
       +strcasestr(const char *h, const char *n)
       +{
       +        size_t l = strlen(n);
       +        for (; *h; h++)
       +                if (!strncasecmp(h, n, l))
       +                        return (char *)h;
       +        return 0;
       +}
       +#endif /* NEED_STRCASESTR */
       +
        /* print `len' columns of characters. */
        size_t
        mbsprint(const char *s, size_t len)
   DIR diff --git a/ui_ti.c b/ui_ti.c
       t@@ -392,14 +392,14 @@ searchinline(const char *searchstr, Item *entry, int pos)
        
                if (pos > 0) {
                        for (i = dir->curline + 1; i < dir->nitems; ++i) {
       -                        if (strstr(dir->items[i].username, searchstr)) {
       +                        if (strcasestr(dir->items[i].username, searchstr)) {
                                        jumptoline(entry, i, 1);
                                        break;
                                }
                        }
                } else {
                        for (i = dir->curline - 1; i > -1; --i) {
       -                        if (strstr(dir->items[i].username, searchstr)) {
       +                        if (strcasestr(dir->items[i].username, searchstr)) {
                                        jumptoline(entry, i, 1);
                                        break;
                                }
   DIR diff --git a/ui_txt.c b/ui_txt.c
       t@@ -223,7 +223,7 @@ searchinline(const char *searchstr, Item *entry)
                        return;
        
                for (i = 0; i < dir->nitems; ++i)
       -                if (strstr(dir->items[i].username, searchstr))
       +                if (strcasestr(dir->items[i].username, searchstr))
                                printuri(&(dir->items[i]), i + 1);
        }