summaryrefslogtreecommitdiff
path: root/cmd-line-utils/readline/histfile.c
diff options
context:
space:
mode:
authorunknown <df@pippilotta.erinye.com>2007-11-19 14:38:08 +0100
committerunknown <df@pippilotta.erinye.com>2007-11-19 14:38:08 +0100
commit17146fc93d49fc4354f791f9c269fc21d5000eb6 (patch)
tree6886afa4046d456ba17671394e79a76cec21267a /cmd-line-utils/readline/histfile.c
parent7bb73945459e71bdd8fa1297dc3fd313306235cc (diff)
downloadmariadb-git-17146fc93d49fc4354f791f9c269fc21d5000eb6.tar.gz
Update readline to version 5.2. This fixes bug#18431.
cmd-line-utils/readline/INSTALL: update readline to version 5.2 cmd-line-utils/readline/README: update readline to version 5.2 cmd-line-utils/readline/bind.c: update readline to version 5.2 cmd-line-utils/readline/callback.c: update readline to version 5.2 cmd-line-utils/readline/chardefs.h: update readline to version 5.2 cmd-line-utils/readline/compat.c: update readline to version 5.2 cmd-line-utils/readline/complete.c: update readline to version 5.2 cmd-line-utils/readline/configure.in: update readline to version 5.2 cmd-line-utils/readline/display.c: update readline to version 5.2 cmd-line-utils/readline/funmap.c: update readline to version 5.2 cmd-line-utils/readline/histexpand.c: update readline to version 5.2 cmd-line-utils/readline/histfile.c: update readline to version 5.2 cmd-line-utils/readline/history.c: update readline to version 5.2 cmd-line-utils/readline/histsearch.c: update readline to version 5.2 cmd-line-utils/readline/input.c: update readline to version 5.2 cmd-line-utils/readline/isearch.c: update readline to version 5.2 cmd-line-utils/readline/keymaps.c: update readline to version 5.2 cmd-line-utils/readline/kill.c: update readline to version 5.2 cmd-line-utils/readline/macro.c: update readline to version 5.2 cmd-line-utils/readline/mbutil.c: update readline to version 5.2 cmd-line-utils/readline/misc.c: update readline to version 5.2 cmd-line-utils/readline/nls.c: update readline to version 5.2 cmd-line-utils/readline/parens.c: update readline to version 5.2 cmd-line-utils/readline/readline.c: update readline to version 5.2 cmd-line-utils/readline/readline.h: update readline to version 5.2 cmd-line-utils/readline/rlconf.h: update readline to version 5.2 cmd-line-utils/readline/rldefs.h: update readline to version 5.2 cmd-line-utils/readline/rlmbutil.h: update readline to version 5.2 cmd-line-utils/readline/rlprivate.h: update readline to version 5.2 cmd-line-utils/readline/rltty.c: update readline to version 5.2 cmd-line-utils/readline/savestring.c: update readline to version 5.2 cmd-line-utils/readline/search.c: update readline to version 5.2 cmd-line-utils/readline/shell.c: update readline to version 5.2 cmd-line-utils/readline/signals.c: update readline to version 5.2 cmd-line-utils/readline/terminal.c: update readline to version 5.2 cmd-line-utils/readline/text.c: update readline to version 5.2 cmd-line-utils/readline/tilde.c: update readline to version 5.2 cmd-line-utils/readline/tilde.h: update readline to version 5.2 cmd-line-utils/readline/undo.c: update readline to version 5.2 cmd-line-utils/readline/util.c: update readline to version 5.2 cmd-line-utils/readline/vi_keymap.c: update readline to version 5.2 cmd-line-utils/readline/vi_mode.c: update readline to version 5.2 cmd-line-utils/readline/xmalloc.c: update readline to version 5.2
Diffstat (limited to 'cmd-line-utils/readline/histfile.c')
-rw-r--r--cmd-line-utils/readline/histfile.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c
index f1822b105a4..2f051a32563 100644
--- a/cmd-line-utils/readline/histfile.c
+++ b/cmd-line-utils/readline/histfile.c
@@ -30,7 +30,9 @@
# include <floss.h>
#endif
-#include "config_readline.h"
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
#include <stdio.h>
@@ -184,8 +186,7 @@ read_history_range (filename, from, to)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
- if ((long long) file_size != (long long) finfo.st_size ||
- file_size + 1 < file_size)
+ if (file_size != finfo.st_size || file_size + 1 < file_size)
{
errno = overflow_errno;
goto error_and_exit;
@@ -255,7 +256,11 @@ read_history_range (filename, from, to)
for (line_end = line_start; line_end < bufend; line_end++)
if (*line_end == '\n')
{
- *line_end = '\0';
+ /* Change to allow Windows-like \r\n end of line delimiter. */
+ if (line_end > line_start && line_end[-1] == '\r')
+ line_end[-1] = '\0';
+ else
+ *line_end = '\0';
if (*line_start)
{
@@ -334,8 +339,7 @@ history_truncate_file (fname, lines)
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
- if ((long long) file_size != (long long) finfo.st_size ||
- file_size + 1 < file_size)
+ if (file_size != finfo.st_size || file_size + 1 < file_size)
{
close (file);
#if defined (EFBIG)