URI: 
       tfix undefined behaviours with isdigit() and tolower() functions - sacc - sacc(omys), simple console gopher client (mirror)
  HTML git clone https://git.parazyd.org/sacc
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit ed63d85224f39fc733d55b0d326085d7f4bd0b70
   DIR parent 2e25654b851d97ab5738a82bd9d47aeb02128be1
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat,  8 Sep 2018 12:44:35 +0200
       
       fix undefined behaviours with isdigit() and tolower() functions
       
       Diffstat:
         M sacc.c                              |       3 ++-
         M ui_txt.c                            |       4 ++--
       
       2 files changed, 4 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/sacc.c b/sacc.c
       t@@ -86,7 +86,8 @@ strcasestr(const char *h, const char *n)
                        return (char *)h;
        
                for (; *h; ++h) {
       -                for (i = 0; n[i] && tolower(n[i]) == tolower(h[i]); ++i)
       +                for (i = 0; n[i] && tolower((unsigned char)n[i]) ==
       +                            tolower((unsigned char)h[i]); ++i)
                                ;
                        if (n[i] == '\0')
                                return (char *)h;
   DIR diff --git a/ui_txt.c b/ui_txt.c
       t@@ -249,7 +249,7 @@ uiselectitem(Item *entry)
                                putchar('\n');
                                return NULL;
                        }
       -                if (isdigit(*buf)) {
       +                if (isdigit((unsigned char)*buf)) {
                                cmd = '\0';
                                nl = '\0';
                                if (sscanf(buf, "%d%c", &item, &nl) != 2 || nl != '\n')
       t@@ -263,7 +263,7 @@ uiselectitem(Item *entry)
                                *sstr = '\0';
                                sstr = buf+1;
                                cmd = *buf;
       -                } else if (isdigit(*(buf+1))) {
       +                } else if (isdigit((unsigned char)*(buf+1))) {
                                nl = '\0';
                                if (sscanf(buf+1, "%d%c", &item, &nl) != 2 || nl != '\n')
                                        item = -1;