changeset 6446:04d604cf1d2e

* readline.c: Remove EOL.
author Simon Josefsson <simon@josefsson.org>
date Thu, 10 Nov 2005 02:19:29 +0000
parents 87f075c0178d
children ae0846575b68
files lib/ChangeLog lib/readline.c
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2005-11-10  Simon Josefsson  <jas@extundo.com>
+
+	* readline.c: Remove EOL.
+
 2005-11-08  Eric Blake  <ebb9@byu.net>
 
 	* inet_ntop.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -33,6 +33,7 @@
 #include "readline.h"
 
 #include <stdio.h>
+#include <string.h>
 #include <getline.h>
 
 char *
@@ -47,5 +48,10 @@
   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')
+    out[strlen (out) - 1] = '\0';
+
   return out;
 }