summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <SergeyV@selena.>2005-09-16 01:56:16 +0400
committerunknown <SergeyV@selena.>2005-09-16 01:56:16 +0400
commit627bf43d9ff9c4b1b5cde1463cf5d03cf5e92c3d (patch)
tree0dd45aa9200f62048bab12884a63a483e4f9ef52 /client
parentd026dd0e4532b51d49cd14cbcba4cb693155f0d0 (diff)
downloadmariadb-git-627bf43d9ff9c4b1b5cde1463cf5d03cf5e92c3d.tar.gz
Fixes bug #12929. Uses my_cgets instead of _cgets function, thus eliminating
a restriction to 255 chars for editable buffer. VC++Files/mysys/mysys.dsp: Added my_conio.c VC++Files/mysys/mysys_ia64.dsp: Added my_conio.c include/my_sys.h: Added declarations for my_conio.c functions mysys/my_conio.c: Added _cgets() replacement that is not limited to 255 chars retrieval from win32 console.
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 51822b64c82..be1541faaf5 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -938,10 +938,15 @@ static int get_options(int argc, char **argv)
static int read_lines(bool execute_commands)
{
-#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
+#if defined(OS2) || defined(__NETWARE__)
char linebuffer[254];
String buffer;
#endif
+#if defined(__WIN__)
+ String tmpbuf;
+ String buffer;
+#endif
+
char *line;
char in_string=0;
ulong line_number=0;
@@ -972,7 +977,7 @@ static int read_lines(bool execute_commands)
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
tee_fputs(prompt, stdout);
-#ifdef __NETWARE__
+#if defined(__NETWARE__)
line=fgets(linebuffer, sizeof(linebuffer)-1, stdin);
/* Remove the '\n' */
if (line)
@@ -981,7 +986,22 @@ static int read_lines(bool execute_commands)
if (p != NULL)
*p = '\0';
}
-#else
+#elif defined(__WIN__)
+ if (!tmpbuf.is_alloced())
+ tmpbuf.alloc(65535);
+ buffer.length(0);
+ unsigned long clen;
+ do
+ {
+ line= my_cgets(tmpbuf.c_ptr(), tmpbuf.alloced_length(), &clen);
+ buffer.append(line, clen);
+ /*
+ if we got buffer fully filled than there is a chance that
+ something else is still in console input buffer
+ */
+ } while (tmpbuf.alloced_length() <= clen + 1);
+ line= buffer.c_ptr();
+#else /* OS2 */
buffer.length(0);
/* _cgets() expects the buffer size - 3 as the first byte */
linebuffer[0]= (char) sizeof(linebuffer) - 3;
@@ -1057,9 +1077,14 @@ static int read_lines(bool execute_commands)
status.exit_status=0;
}
}
+
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
buffer.free();
#endif
+#if defined( __WIN__)
+ tmpbuf.free();
+#endif
+
return status.exit_status;
}