~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzle.cc

  • Committer: Brian Aker
  • Date: 2009-01-10 22:27:38 UTC
  • mfrom: (779.1.8 devel)
  • Revision ID: brian@tangent.org-20090110222738-zx4zzq9lsa3othvn
Merge for Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include <sys/ioctl.h>
45
45
#include <drizzled/configmake.h>
46
46
 
47
 
 
48
 
#if defined(HAVE_LOCALE_H)
49
 
#include <locale.h>
50
 
#endif
51
 
 
52
 
#include <drizzled/gettext.h>
53
 
 
54
 
#if defined(CMATH_NAMESPACE)
55
 
  using namespace CMATH_NAMESPACE;
56
 
#endif
57
 
 
58
 
const char *VER= "14.14";
59
 
 
60
 
/* Don't try to make a nice table if the data is too big */
61
 
#define MAX_COLUMN_LENGTH       (uint32_t)1024
62
 
 
63
 
/* Buffer to hold 'version' and 'version_comment' */
64
 
#define MAX_SERVER_VERSION_LENGTH     128
65
 
 
66
 
void* sql_alloc(unsigned size);       // Don't use drizzled alloc for these
67
 
void sql_element_free(void *ptr);
68
 
 
69
 
 
70
47
#if defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
71
48
#include <curses.h>
72
49
#ifdef __sun
96
73
#endif
97
74
#endif
98
75
 
99
 
#undef bcmp                             // Fix problem with new readline
 
76
#ifdef HAVE_LIBREADLINE
 
77
#  if defined(HAVE_READLINE_READLINE_H)
 
78
#    include <readline/readline.h>
 
79
#  elif defined(HAVE_READLINE_H)
 
80
#    include <readline.h>
 
81
#  else /* !defined(HAVE_READLINE_H) */
 
82
extern char *readline ();
 
83
#  endif /* !defined(HAVE_READLINE_H) */
 
84
char *cmdline = NULL;
 
85
#else /* !defined(HAVE_READLINE_READLINE_H) */
 
86
  /* no readline */
 
87
#  error Readline Required
 
88
#endif /* HAVE_LIBREADLINE */
100
89
 
101
 
#ifdef HAVE_READLINE_HISTORY_H
102
 
#include <readline/history.h>
103
 
#endif
104
 
#include <readline/readline.h>
 
90
#ifdef HAVE_READLINE_HISTORY
 
91
#  if defined(HAVE_READLINE_HISTORY_H)
 
92
#    include <readline/history.h>
 
93
#  elif defined(HAVE_HISTORY_H)
 
94
#    include <history.h>
 
95
#  else /* !defined(HAVE_HISTORY_H) */
 
96
extern void add_history ();
 
97
extern int write_history ();
 
98
extern int read_history ();
 
99
#  endif /* defined(HAVE_READLINE_HISTORY_H) */
 
100
    /* no history */
 
101
#endif /* HAVE_READLINE_HISTORY */
105
102
 
106
103
/**
107
104
 Make the old readline interface look like the new one.
113
110
  completion_matches((char *)str, (CPFunction *)func)
114
111
#endif
115
112
 
 
113
#if defined(HAVE_LOCALE_H)
 
114
#include <locale.h>
 
115
#endif
 
116
 
 
117
#include <drizzled/gettext.h>
 
118
 
 
119
#if defined(CMATH_NAMESPACE)
 
120
  using namespace CMATH_NAMESPACE;
 
121
#endif
 
122
 
 
123
const char *VER= "14.14";
 
124
 
 
125
/* Don't try to make a nice table if the data is too big */
 
126
#define MAX_COLUMN_LENGTH       (uint32_t)1024
 
127
 
 
128
/* Buffer to hold 'version' and 'version_comment' */
 
129
#define MAX_SERVER_VERSION_LENGTH     128
 
130
 
 
131
void* sql_alloc(unsigned size);       // Don't use drizzled alloc for these
 
132
void sql_element_free(void *ptr);
 
133
 
116
134
 
117
135
#if !defined(HAVE_VIDATTR)
118
136
#undef vidattr
1011
1029
static void end_timer(uint32_t start_time,char *buff);
1012
1030
static void drizzle_end_timer(uint32_t start_time,char *buff);
1013
1031
static void nice_time(double sec,char *buff,bool part_second);
1014
 
extern "C" RETSIGTYPE drizzle_end(int sig);
1015
 
extern "C" RETSIGTYPE handle_sigint(int sig);
 
1032
extern "C" void drizzle_end(int sig);
 
1033
extern "C" void handle_sigint(int sig);
1016
1034
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1017
 
static RETSIGTYPE window_resize(int sig);
 
1035
static void window_resize(int sig);
1018
1036
#endif
1019
1037
 
1020
1038
int main(int argc,char *argv[])
1187
1205
  return(0);        // Keep compiler happy
1188
1206
}
1189
1207
 
1190
 
RETSIGTYPE drizzle_end(int sig)
 
1208
void drizzle_end(int sig)
1191
1209
{
1192
1210
  drizzle_close(&drizzle);
1193
1211
  if (!status.batch && !quick && histfile)
1231
1249
  no query in process, terminate like previous behavior
1232
1250
*/
1233
1251
extern "C"
1234
 
RETSIGTYPE handle_sigint(int sig)
 
1252
void handle_sigint(int sig)
1235
1253
{
1236
1254
  char kill_buffer[40];
1237
1255
  DRIZZLE *kill_drizzle= NULL;
1264
1282
 
1265
1283
 
1266
1284
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
1267
 
RETSIGTYPE window_resize(int)
 
1285
void window_resize(int)
1268
1286
{
1269
1287
  struct winsize window_size;
1270
1288