Fix last commit (ChangeLog entry still applicable).
authorSimon Josefsson <simon@josefsson.org>
Thu, 10 Nov 2005 14:50:28 +0000 (14:50 +0000)
committerSimon Josefsson <simon@josefsson.org>
Thu, 10 Nov 2005 14:50:28 +0000 (14:50 +0000)
lib/readline.c

index f2ddcaa..88f39b2 100644 (file)
@@ -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;