]> git.deb.at Git - pkg/abook.git/commitdiff
- implement limit functionality in ui_readline
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Sun, 25 Sep 2005 11:20:49 +0000 (11:20 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Sun, 25 Sep 2005 11:20:49 +0000 (11:20 +0000)
ui.c

diff --git a/ui.c b/ui.c
index 808ead07e15dcdc211fe35964d611222de018ab9..901322b50712c6f4295d71e11336d1713845c096 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -243,10 +243,11 @@ ui_readline(char *prompt, char *s, size_t limit, bool use_completion)
 
        ret = abook_readline(bottom, y, x, s, use_completion);
 
-       /* XXX: check that string doesn't exceed limit */
-
-       if(ret)
+       if(ret) {
                strtrim(ret);
+               if(strlen(ret) > limit && limit > 0)
+                       ret[limit] = '\0';
+       }
 
        return ret;
 }