diff options
Diffstat (limited to 'client/mysql.cc')
-rw-r--r-- | client/mysql.cc | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 8d926a54840..e4db7e93256 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -77,7 +77,7 @@ extern "C" { #undef bcmp // Fix problem with new readline #undef bzero -#ifdef __WIN__ +#if defined( __WIN__) || defined(OS2) #include <conio.h> #else #include <readline/readline.h> @@ -569,7 +569,7 @@ static int get_options(int argc, char **argv) set_all_changeable_vars(changeable_vars); while ((c=getopt_long(argc,argv, - "?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::", + (char*) "?ABCD:LfgGHinNoqrstTU::vVw::WEe:h:O:P:S:u:#::p::", long_options, &option_index)) != EOF) { switch(c) { @@ -767,10 +767,20 @@ static int get_options(int argc, char **argv) return(0); } +#if defined(OS2) +static char* readline( char* prompt) +{ +#if defined(OS2) + static char linebuffer[254]; +#endif + puts( prompt); + return gets( linebuffer); +} +#endif static int read_lines(bool execute_commands) { -#ifdef __WIN__ +#if defined( __WIN__) || defined(OS2) char linebuffer[254]; #endif char *line; @@ -790,7 +800,7 @@ static int read_lines(bool execute_commands) } else { -#ifdef __WIN__ +#if defined( __WIN__) || defined(OS2) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); tee_fputs(glob_buffer.is_empty() ? "mysql> " : @@ -1483,7 +1493,7 @@ com_go(String *buffer,char *line __attribute__((unused))) static void init_pager() { -#ifndef __WIN__ +#if !defined( __WIN__) && !defined( OS2) if (!opt_nopager) { if (!(PAGER= popen(pager, "w"))) @@ -1499,7 +1509,7 @@ static void init_pager() static void end_pager() { -#ifndef __WIN__ +#if !defined( __WIN__) && !defined( OS2) if (!opt_nopager) pclose(PAGER); #endif @@ -2337,6 +2347,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...) va_start(args, fmt); (void) vfprintf(file, fmt, args); +#ifdef OS2 + fflush( file); +#endif if (opt_outfile) (void) vfprintf(OUTFILE, fmt, args); va_end(args); @@ -2346,6 +2359,9 @@ void tee_fprintf(FILE *file, const char *fmt, ...) void tee_fputs(const char *s, FILE *file) { fputs(s, file); +#ifdef OS2 + fflush( file); +#endif if (opt_outfile) fputs(s, OUTFILE); } @@ -2355,6 +2371,9 @@ void tee_puts(const char *s, FILE *file) { fputs(s, file); fputs("\n", file); +#ifdef OS2 + fflush( file); +#endif if (opt_outfile) { fputs(s, OUTFILE); @@ -2365,11 +2384,14 @@ void tee_puts(const char *s, FILE *file) void tee_putc(int c, FILE *file) { putc(c, file); +#ifdef OS2 + fflush( file); +#endif if (opt_outfile) putc(c, OUTFILE); } -#ifdef __WIN__ +#if defined( __WIN__) || defined( OS2) #include <time.h> #else #include <sys/times.h> @@ -2379,7 +2401,7 @@ void tee_putc(int c, FILE *file) static ulong start_timer(void) { -#ifdef __WIN__ +#if defined( __WIN__) || defined( OS2) return clock(); #else struct tms tms_tmp; |