diff options
author | serg@serg.mylan <> | 2005-09-21 17:42:44 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2005-09-21 17:42:44 +0200 |
commit | 306aa1539166160bcea439c38e361399b4bef086 (patch) | |
tree | d2a90066bc4c5375327f5a42f732d5b0e36337f7 /client | |
parent | 6d70588d9ebc06f3eaf39a65236155433facb3bc (diff) | |
parent | 3b41e3362b9a33fe88fb25fdde3855860d460c87 (diff) | |
download | mariadb-git-306aa1539166160bcea439c38e361399b4bef086.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0-merged
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index f4361f77f4c..05dfcbeccba 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -959,10 +959,15 @@ static int get_options(int argc, char **argv) static int read_and_execute(bool interactive) { -#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; @@ -993,7 +998,7 @@ static int read_and_execute(bool interactive) #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) @@ -1002,7 +1007,22 @@ static int read_and_execute(bool interactive) 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; @@ -1078,9 +1098,14 @@ static int read_and_execute(bool interactive) status.exit_status=0; } } + #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__) buffer.free(); #endif +#if defined( __WIN__) + tmpbuf.free(); +#endif + return status.exit_status; } |