diff options
author | Simon Josefsson <simon@josefsson.org> | 2005-11-10 02:19:29 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2005-11-10 02:19:29 +0000 |
commit | 04100c39ec27510503ef803a99d895c943ddac12 (patch) | |
tree | b364a757b29118f5b6d898839adc9b990f99418d /lib/readline.c | |
parent | 4d098ae6ffdf51349e1915970c376df0543d234b (diff) | |
download | gnulib-04100c39ec27510503ef803a99d895c943ddac12.tar.gz |
* readline.c: Remove EOL.
Diffstat (limited to 'lib/readline.c')
-rw-r--r-- | lib/readline.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/readline.c b/lib/readline.c index 3f8c18ae44..f2ddcaaaa1 100644 --- 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 @@ 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') + out[strlen (out) - 1] = '\0'; + return out; } |