From: Jaakko Heinonen Date: Sun, 25 Sep 2005 11:20:49 +0000 (+0000) Subject: - implement limit functionality in ui_readline X-Git-Tag: upstream/0.6.1~2^2~155 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=89e2a4996a7a50c18905408887b8eea25b0fc303;p=pkg%2Fabook.git - implement limit functionality in ui_readline --- diff --git a/ui.c b/ui.c index 808ead0..901322b 100644 --- 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; }