URI:
       fix lenght hanling - lchat - A line oriented chat front end for ii.
  HTML git clone git://git.suckless.org/lchat
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit ee4b1cfdb77b67d8e9ca491c3f2f11d9e3805851
   DIR parent 600166571bf2a893896e1fa37e1e134296b857b4
  HTML Author: Jan Klemkow <j.klemkow@wemelug.de>
       Date:   Sun, 25 Oct 2015 01:55:15 +0200
       
       fix lenght hanling
       
       Diffstat:
         M slackline.c                         |      11 +++++++++--
       
       1 file changed, 9 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/slackline.c b/slackline.c
       @@ -13,7 +13,11 @@ sl_init(void)
                        return NULL;
        
                sl->bufsize = BUFSIZ;
       -        sl->buf = malloc(sl->bufsize);
       +        if ((sl->buf = malloc(sl->bufsize)) == NULL) {
       +                free(sl);
       +                return NULL;
       +        }
       +
                sl->buf[0] = '\0';
                sl->len = 0;
                sl->cur = 0;
       @@ -44,14 +48,17 @@ sl_keystroke(struct slackline *sl, int key)
                                sl->buf[sl->cur++] = key;
                                sl->buf[sl->cur] = '\0';
                        }
       -
       +                sl->len++;
                        return 0;
                }
        
                /* handle ctl keys */
                switch (key) {
                case 8:        /* backspace */
       +                if (sl->cur == 0)
       +                        break;
                        sl->cur--;
       +                sl->len--;
                        sl->buf[sl->cur] = '\0';
                        break;
                }