From: Simon Josefsson Date: Thu, 10 Nov 2005 14:50:28 +0000 (+0000) Subject: Fix last commit (ChangeLog entry still applicable). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aacff154ea39c589ffe6dfb3c324cac4257151d8;p=pspp Fix last commit (ChangeLog entry still applicable). --- diff --git a/lib/readline.c b/lib/readline.c index f2ddcaaaa1..88f39b2103 100644 --- a/lib/readline.c +++ b/lib/readline.c @@ -48,9 +48,8 @@ readline (const char *prompt) if (getline (&out, &size, stdin) < 0) return NULL; - if (out[strlen (out) - 1] == '\r') - out[strlen (out) - 1] = '\0'; - if (out[strlen (out) - 1] == '\n') + while (*out && (out[strlen (out) - 1] == '\r' + || out[strlen (out) - 1] == '\n')) out[strlen (out) - 1] = '\0'; return out;