summaryrefslogtreecommitdiff
path: root/cmd-line-utils
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-06-05 02:06:51 +0200
committerSergei Golubchik <serg@mariadb.org>2015-06-05 02:06:51 +0200
commitf84f577aa15a193f24c3119eafdee554cb9775fb (patch)
treeee531580839374516db09b2409ec4bd57a847e8a /cmd-line-utils
parentf07b3463e7a4ff32316e1cc94d553b5009ac51f2 (diff)
parent31c803e8d0543b330aa8e61ef878da43fe1f68f7 (diff)
downloadmariadb-git-f84f577aa15a193f24c3119eafdee554cb9775fb.tar.gz
Merge tag 'mysql-5.5.44' into bb-5.5-serg
Diffstat (limited to 'cmd-line-utils')
-rw-r--r--cmd-line-utils/libedit/el_terminal.h4
-rw-r--r--cmd-line-utils/libedit/emacs.c8
-rw-r--r--cmd-line-utils/libedit/terminal.c15
-rw-r--r--cmd-line-utils/libedit/vi.c8
4 files changed, 22 insertions, 13 deletions
diff --git a/cmd-line-utils/libedit/el_terminal.h b/cmd-line-utils/libedit/el_terminal.h
index 807c651783e..db0bb94fa93 100644
--- a/cmd-line-utils/libedit/el_terminal.h
+++ b/cmd-line-utils/libedit/el_terminal.h
@@ -1,7 +1,7 @@
/* $NetBSD: terminal.h,v 1.3 2011/07/29 23:44:45 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -103,7 +103,7 @@ protected int terminal_settc(EditLine *, int, const Char **);
protected int terminal_gettc(EditLine *, int, char **);
protected int terminal_telltc(EditLine *, int, const Char **);
protected int terminal_echotc(EditLine *, int, const Char **);
-protected void terminal_writec(EditLine *, Int);
+protected int terminal_writec(EditLine *, Int);
protected int terminal__putc(EditLine *, Int);
protected void terminal__flush(EditLine *);
diff --git a/cmd-line-utils/libedit/emacs.c b/cmd-line-utils/libedit/emacs.c
index 554d3970485..1f1033a1cb7 100644
--- a/cmd-line-utils/libedit/emacs.c
+++ b/cmd-line-utils/libedit/emacs.c
@@ -1,7 +1,7 @@
/* $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -58,8 +58,10 @@ em_delete_or_list(EditLine *el, Int c)
/* if I'm at the end */
if (el->el_line.cursor == el->el_line.buffer) {
/* and the beginning */
- terminal_writec(el, c); /* then do an EOF */
- return CC_EOF;
+ if(!(terminal_writec(el, c))) /* then do an EOF */
+ return CC_EOF;
+ else
+ return CC_ERROR;
} else {
/*
* Here we could list completions, but it is an
diff --git a/cmd-line-utils/libedit/terminal.c b/cmd-line-utils/libedit/terminal.c
index fb5600a4140..18b789a8bea 100644
--- a/cmd-line-utils/libedit/terminal.c
+++ b/cmd-line-utils/libedit/terminal.c
@@ -1,7 +1,7 @@
/* $NetBSD: terminal.c,v 1.10 2011/10/04 15:27:04 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -1271,14 +1271,19 @@ terminal__flush(EditLine *el)
/* terminal_writec():
* Write the given character out, in a human readable form
*/
-protected void
+protected int
terminal_writec(EditLine *el, Int c)
{
Char visbuf[VISUAL_WIDTH_MAX +1];
ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c);
- visbuf[vcnt] = '\0';
- terminal_overwrite(el, visbuf, (size_t)vcnt);
- terminal__flush(el);
+ if(vcnt == -1)
+ return 1; /* Error due to insufficient space */
+ else {
+ visbuf[vcnt] = '\0';
+ terminal_overwrite(el, visbuf, (size_t)vcnt);
+ terminal__flush(el);
+ return 0;
+ }
}
diff --git a/cmd-line-utils/libedit/vi.c b/cmd-line-utils/libedit/vi.c
index 9a4b97a977e..41242030a98 100644
--- a/cmd-line-utils/libedit/vi.c
+++ b/cmd-line-utils/libedit/vi.c
@@ -1,7 +1,7 @@
/* $NetBSD: vi.c,v 1.41 2011/10/04 15:27:04 christos Exp $ */
/*-
- * Copyright (c) 1992, 1993
+ * Copyright (c) 1992, 2015
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -607,8 +607,10 @@ vi_list_or_eof(EditLine *el, Int c)
if (el->el_line.cursor == el->el_line.lastchar) {
if (el->el_line.cursor == el->el_line.buffer) {
- terminal_writec(el, c); /* then do a EOF */
- return CC_EOF;
+ if(!(terminal_writec(el, c))) /* then do a EOF */
+ return CC_EOF;
+ else
+ return CC_ERROR;
} else {
/*
* Here we could list completions, but it is an