1020
1020
static void window_resize(int sig);
1023
static inline int is_prefix(const char *s, const char *t)
1026
if (*s++ != *t++) return 0;
1027
return 1; /* WRONG */
1024
1031
Shutdown the server that we are currently connected to.
2064
2071
*pos && (*pos != *delimiter ||
2065
!is_prefix(pos + 1, delimiter + 1)) ; pos++)
2072
strncmp(pos + 1, delimiter + 1,
2073
strlen(delimiter + 1))) ; pos++)
2066
2074
; // Remove parameters
2113
2121
buffer->clear();
2116
else if (!*ml_comment && !*in_string && is_prefix(pos, delimiter))
2124
else if (!*ml_comment && !*in_string && !strncmp(pos, delimiter,
2118
2127
// Found a statement. Continue parsing after the delimiter
2119
2128
pos+= delimiter_length;
2816
pos= int10_to_str(warnings, pos, 10);
2825
char warnings_buff[20];
2826
memset(warnings_buff,0,20);
2827
sprintf(warnings_buff, "%d", warnings);
2828
strcpy(pos, warnings_buff);
2829
pos+= strlen(warnings_buff);
2817
2830
pos= strcpy(pos, " warning")+8;
2818
2831
if (warnings != 1)
4245
4258
static void nice_time(double sec,char *buff,bool part_second)
4261
ostringstream tmp_buff_str;
4248
4263
if (sec >= 3600.0*24)
4250
4265
tmp=(uint32_t) floor(sec/(3600.0*24));
4251
4266
sec-= 3600.0*24*tmp;
4252
buff= int10_to_str((long) tmp, buff, 10);
4267
tmp_buff_str << tmp;
4255
buff= strcpy(buff," days ")+6;
4270
tmp_buff_str << " days ";
4257
buff= strcpy(buff," day ")+5;
4272
tmp_buff_str << " day ";
4260
4275
if (sec >= 3600.0)
4262
4277
tmp=(uint32_t) floor(sec/3600.0);
4263
4278
sec-=3600.0*tmp;
4264
buff=int10_to_str((long) tmp, buff, 10);
4279
tmp_buff_str << tmp;
4267
buff= strcpy(buff, " hours ")+7;
4282
tmp_buff_str << " hours ";
4269
buff= strcpy(buff, " hour ")+6;
4284
tmp_buff_str << " hour ";
4271
4286
if (sec >= 60.0)
4273
4288
tmp=(uint32_t) floor(sec/60.0);
4275
buff=int10_to_str((long) tmp, buff, 10);
4276
buff= strcpy(buff," min ")+5;
4290
tmp_buff_str << tmp << " min ";
4278
4292
if (part_second)
4279
sprintf(buff,"%.2f sec",sec);
4293
tmp_buff_str.precision(2);
4281
sprintf(buff,"%d sec",(int) sec);
4295
tmp_buff_str.precision(0);
4296
tmp_buff_str << sec << " sec";
4297
strcpy(buff, tmp_buff_str.str().c_str());
4470
4486
static void add_int_to_prompt(int toadd)
4473
int10_to_str(toadd, buffer, 10);
4474
processed_prompt->append(buffer);
4488
ostringstream buffer;
4490
processed_prompt->append(buffer.str().c_str());
4477
4493
static void init_username()