bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

readline fix


From: Simon Josefsson
Subject: readline fix
Date: Thu, 10 Nov 2005 03:17:53 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Is this right?  I'm not sure what a portable way to remove EOL is.
Anyway, I installed this because it work on known platforms.

2005-11-10  Simon Josefsson  <address@hidden>

            * readline.c: Remove EOL.

--- readline.c 20 Sep 2005 11:12:16 +0200       1.2
+++ readline.c 10 Nov 2005 03:16:03 +0100       
@@ -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;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]