Merge lp:~jobinau/drizzle/mingwport into lp:~drizzle-trunk/drizzle/development

Proposed by Jobin Augustine
Status: Rejected
Rejected by: Lee Bieber
Proposed branch: lp:~jobinau/drizzle/mingwport
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 164 lines (+58/-7)
2 files modified
client/drizzle.cc (+19/-2)
client/get_password.cc (+39/-5)
To merge this branch: bzr merge lp:~jobinau/drizzle/mingwport
Reviewer Review Type Date Requested Status
Lee Bieber (community) Needs Fixing
Review via email: mp+33481@code.launchpad.net

Description of the change

Please Review Revisions after last merge
and advice me if any changes are to be done.

These modifications are for compiling the drizzle client tools in windows.

To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

Can't build on Linux:

  CXX client/drizzle.o
client/drizzle.cc: In function ‘int main(int, char**)’:
client/drizzle.cc:1562: error: ‘_isatty’ was not declared in this scope
client/drizzle.cc: In function ‘void window_resize(int)’:
client/drizzle.cc:1934: error: aggregate ‘winsize window_size’ has incomplete type and cannot be defined
client/drizzle.cc:1936: error: ‘TIOCGWINSZ’ was not declared in this scope
client/drizzle.cc:1936: error: ‘ioctl’ was not declared in this scope
make[2]: *** [client/drizzle.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/lbieber/repos/build'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lbieber/repos/build'
make: *** [all] Error 2

review: Needs Fixing
Revision history for this message
Jobin Augustine (jobinau) wrote :

Thank you Lee for the test.
The decision to push as small patches is paying off.

Monty,
I need a help on build.
HAVE_SYS_IOCTL_H is not getting defined in config.h in Linux.

Unmerged revisions

1706. By jobin <jobin@jobin-laptop>

modification requied to compile on windows

1705. By jobin <jobin@jobin-laptop>

in windows, read password from keyboard and put * into screen

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'client/drizzle.cc'
--- client/drizzle.cc 2010-08-21 17:16:51 +0000
+++ client/drizzle.cc 2010-08-24 02:26:41 +0000
@@ -63,10 +63,16 @@
63#include <math.h>63#include <math.h>
64#include "client/linebuffer.h"64#include "client/linebuffer.h"
65#include <signal.h>65#include <signal.h>
66#ifdef HAVE_SYS_IOCTL_H
66#include <sys/ioctl.h>67#include <sys/ioctl.h>
68#endif
67#include <drizzled/configmake.h>69#include <drizzled/configmake.h>
68#include "drizzled/utf8/utf8.h"70#include "drizzled/utf8/utf8.h"
69#include <cstdlib>71#include <cstdlib> /*not sure where it is used */
72#ifdef _WIN32
73#include <io.h>
74#endif
75
7076
71#if defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)77#if defined(HAVE_CURSES_H) && defined(HAVE_TERM_H)
72#include <curses.h>78#include <curses.h>
@@ -1553,7 +1559,7 @@
1553 default_pager.assign(tmp);1559 default_pager.assign(tmp);
1554 }1560 }
1555 }1561 }
1556 if (! isatty(0) || ! isatty(1))1562 if (! _isatty(0) || ! _isatty(1))
1557 {1563 {
1558 status.setBatch(1); opt_silent=1;1564 status.setBatch(1); opt_silent=1;
1559 ignore_errors=0;1565 ignore_errors=0;
@@ -1806,6 +1812,8 @@
1806 if (histfile)1812 if (histfile)
1807 sprintf(histfile,"%s/.drizzle_history",getenv("HOME"));1813 sprintf(histfile,"%s/.drizzle_history",getenv("HOME"));
1808 char link_name[FN_REFLEN];1814 char link_name[FN_REFLEN];
1815#ifndef _WIN32
1816 /*links won't work in windows */
1809 ssize_t sym_link_size= readlink(histfile,link_name,FN_REFLEN-1);1817 ssize_t sym_link_size= readlink(histfile,link_name,FN_REFLEN-1);
1810 if (sym_link_size >= 0)1818 if (sym_link_size >= 0)
1811 {1819 {
@@ -1817,6 +1825,7 @@
1817 histfile= 0;1825 histfile= 0;
1818 }1826 }
1819 }1827 }
1828#endif
1820 }1829 }
1821 if (histfile)1830 if (histfile)
1822 {1831 {
@@ -4360,16 +4369,24 @@
4360 putc(c, OUTFILE);4369 putc(c, OUTFILE);
4361}4370}
43624371
4372#ifdef _WIN32
4373#include <time.h>
4374#else
4363#include <sys/times.h>4375#include <sys/times.h>
4364#ifdef _SC_CLK_TCK // For mit-pthreads4376#ifdef _SC_CLK_TCK // For mit-pthreads
4365#undef CLOCKS_PER_SEC4377#undef CLOCKS_PER_SEC
4366#define CLOCKS_PER_SEC (sysconf(_SC_CLK_TCK))4378#define CLOCKS_PER_SEC (sysconf(_SC_CLK_TCK))
4367#endif4379#endif
4380#endif
43684381
4369static uint32_t start_timer(void)4382static uint32_t start_timer(void)
4370{4383{
4384#ifdef _WIN32
4385 return clock();
4386#else
4371 struct tms tms_tmp;4387 struct tms tms_tmp;
4372 return times(&tms_tmp);4388 return times(&tms_tmp);
4389#endif
4373}4390}
43744391
43754392
43764393
=== modified file 'client/get_password.cc'
--- client/get_password.cc 2010-06-19 16:36:52 +0000
+++ client/get_password.cc 2010-08-24 02:26:41 +0000
@@ -33,6 +33,7 @@
33#include <ctype.h>33#include <ctype.h>
34#include <unistd.h>34#include <unistd.h>
3535
36#ifndef _WIN32
36#include <sys/ioctl.h>37#include <sys/ioctl.h>
37#ifdef HAVE_TERMIOS_H /* For tty-password */38#ifdef HAVE_TERMIOS_H /* For tty-password */
38# include <termios.h>39# include <termios.h>
@@ -46,6 +47,9 @@
46# define TERMIO struct sgttyb47# define TERMIO struct sgttyb
47# endif48# endif
48#endif49#endif
50#else /*in windows, include conio.h*/
51#include <conio.h>
52#endif
4953
50using namespace std;54using namespace std;
5155
@@ -100,7 +104,6 @@
100104
101char *client_get_tty_password(const char *opt_message)105char *client_get_tty_password(const char *opt_message)
102{106{
103 TERMIO org,tmp;
104 char buff[80];107 char buff[80];
105108
106 if (isatty(fileno(stdout)))109 if (isatty(fileno(stdout)))
@@ -108,9 +111,42 @@
108 fputs(opt_message ? opt_message : "Enter password: ",stdout);111 fputs(opt_message ? opt_message : "Enter password: ",stdout);
109 fflush(stdout);112 fflush(stdout);
110 }113 }
114
115#if defined(_WIN32)
116 /*windows specific password reading logic goes here (read it from keyboard) */
117 char *pos=buff,*end=buff+sizeof(buff)-1;
118 int i=0;
119 for (;;)
120 {
121 char tmp;
122 tmp=_getch();
123 if (tmp == '\b' || (int) tmp == 127)
124 {
125 if (pos != buff)
126 {
127 _cputs("\b \b");
128 pos--;
129 continue;
130 }
131 }
132 if (tmp == '\n' || tmp == '\r' || tmp == 3)
133 break;
134 if (iscntrl(tmp) || pos == end)
135 continue;
136 _cputs("*");
137 *(pos++) = tmp;
138 }
139 while (pos != buff && isspace(pos[-1]) == ' ')
140 pos--; /* Allow dummy space at end */
141 *pos=0;
142 _cputs("\n");
143#else /*if not windows, Declare and initialize TERMIO variables */
144 TERMIO org,tmp;
145 tmp = org;
146#endif
147
111# if defined(HAVE_TERMIOS_H)148# if defined(HAVE_TERMIOS_H)
112 tcgetattr(fileno(stdin), &org);149 tcgetattr(fileno(stdin), &org);
113 tmp = org;
114 tmp.c_lflag &= ~(ECHO | ISIG | ICANON);150 tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
115 tmp.c_cc[VMIN] = 1;151 tmp.c_cc[VMIN] = 1;
116 tmp.c_cc[VTIME] = 0;152 tmp.c_cc[VTIME] = 0;
@@ -119,16 +155,14 @@
119 tcsetattr(fileno(stdin), TCSADRAIN, &org);155 tcsetattr(fileno(stdin), TCSADRAIN, &org);
120# elif defined(HAVE_TERMIO_H)156# elif defined(HAVE_TERMIO_H)
121 ioctl(fileno(stdin), (int) TCGETA, &org);157 ioctl(fileno(stdin), (int) TCGETA, &org);
122 tmp=org;
123 tmp.c_lflag &= ~(ECHO | ISIG | ICANON);158 tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
124 tmp.c_cc[VMIN] = 1;159 tmp.c_cc[VMIN] = 1;
125 tmp.c_cc[VTIME]= 0;160 tmp.c_cc[VTIME]= 0;
126 ioctl(fileno(stdin),(int) TCSETA, &tmp);161 ioctl(fileno(stdin),(int) TCSETA, &tmp);
127 get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));162 get_password(buff,sizeof(buff)-1,fileno(stdin),isatty(fileno(stdout)));
128 ioctl(fileno(stdin),(int) TCSETA, &org);163 ioctl(fileno(stdin),(int) TCSETA, &org);
129# else164# elif !defined(_WIN32)
130 gtty(fileno(stdin), &org);165 gtty(fileno(stdin), &org);
131 tmp=org;
132 tmp.sg_flags &= ~ECHO;166 tmp.sg_flags &= ~ECHO;
133 tmp.sg_flags |= RAW;167 tmp.sg_flags |= RAW;
134 stty(fileno(stdin), &tmp);168 stty(fileno(stdin), &tmp);