Commit 38c5f27485b17e41b6b6beea506fd2cea81d6cff

Authored by perry.werneck@gmail.com
1 parent 1ba70be9

Ajustes para windows, incluindo detecção via ./configure e uso da função getaddr…

…info quando disponível
@@ -220,6 +220,7 @@ AC_SUBST(DLL_CFLAGS) @@ -220,6 +220,7 @@ AC_SUBST(DLL_CFLAGS)
220 220
221 AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?])) 221 AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
222 222
  223 +AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) )
223 224
224 #--[ GTK 2/3 check ]------------------------------------------------------------------------------------------------------------------------------------------ 225 #--[ GTK 2/3 check ]------------------------------------------------------------------------------------------------------------------------------------------
225 226
src/gtk/Makefile.in
@@ -59,7 +59,7 @@ DEPENDS=*.h common/*.h uiparser/*.h v3270/*.h $(GLOBAL_DEPS) @@ -59,7 +59,7 @@ DEPENDS=*.h common/*.h uiparser/*.h v3270/*.h $(GLOBAL_DEPS)
59 59
60 VALGRIND=@VALGRIND@ 60 VALGRIND=@VALGRIND@
61 61
62 -CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -DDATADIR=\"$(datarootdir)\" -I../../src/include 62 +CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../../src/include
63 LIBS=@LIBS@ @GTK_LIBS@ 63 LIBS=@LIBS@ @GTK_LIBS@
64 64
65 include ../include/rules.mak 65 include ../include/rules.mak
src/gtk/main.c
@@ -120,10 +120,10 @@ int main(int argc, char *argv[]) @@ -120,10 +120,10 @@ int main(int argc, char *argv[])
120 g_free( appdir ); 120 g_free( appdir );
121 121
122 } 122 }
123 -#elif defined( DATADIR ) 123 +#elif defined( DATAROOTDIR )
124 { 124 {
125 - gchar * appdir = g_build_filename(DATADIR,PACKAGE_NAME,NULL);  
126 - gchar * locdir = g_build_filename(DATADIR,"locale",NULL); 125 + gchar * appdir = g_build_filename(DATAROOTDIR,PACKAGE_NAME,NULL);
  126 + gchar * locdir = g_build_filename(DATAROOTDIR,"locale",NULL);
127 127
128 g_chdir(appdir); 128 g_chdir(appdir);
129 bindtextdomain( PACKAGE_NAME, locdir); 129 bindtextdomain( PACKAGE_NAME, locdir);
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) @@ -132,7 +132,7 @@ int main(int argc, char *argv[])
132 g_free(appdir); 132 g_free(appdir);
133 133
134 } 134 }
135 -#endif // DATADIR 135 +#endif // DATAROOTDIR
136 136
137 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8"); 137 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
138 textdomain(PACKAGE_NAME); 138 textdomain(PACKAGE_NAME);
src/gtk/uiparser/Makefile.in
@@ -53,7 +53,7 @@ SOURCES=testprogram.c ../common/config.c $(foreach SRC, $(UI_PARSER_SRC), $(SRC) @@ -53,7 +53,7 @@ SOURCES=testprogram.c ../common/config.c $(foreach SRC, $(UI_PARSER_SRC), $(SRC)
53 53
54 DEPENDS=*.h ../common/*.h Makefile 54 DEPENDS=*.h ../common/*.h Makefile
55 55
56 -CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -DDATADIR=\"$(datarootdir)\" -I../../include 56 +CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../../include
57 LIBS=@LIBS@ @GTK_LIBS@ 57 LIBS=@LIBS@ @GTK_LIBS@
58 58
59 include ../../include/rules.mak 59 include ../../include/rules.mak
src/include/lib3270/config.h.in
@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
40 #undef HAVE_GNUC_VISIBILITY 40 #undef HAVE_GNUC_VISIBILITY
41 #undef HAVE_LIBM 41 #undef HAVE_LIBM
42 #undef HAVE_LIBINTL 42 #undef HAVE_LIBINTL
  43 + #undef HAVE_GETADDRINFO
43 44
44 #undef HAVE_GNOME 45 #undef HAVE_GNOME
45 46
src/lib3270/Makefile.in
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 28
29 PACKAGE=@PACKAGE_NAME@ 29 PACKAGE=@PACKAGE_NAME@
30 30
31 -CFLAGS=@CFLAGS@ @DLL_CFLAGS@ -DDATADIR=\"$(datarootdir)\" -I../include 31 +CFLAGS=@CFLAGS@ @DLL_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../include
32 SSL_CFLAGS=@LIBSSL_CFLAGS@ 32 SSL_CFLAGS=@LIBSSL_CFLAGS@
33 33
34 DLL_FLAGS=@DLL_FLAGS@ 34 DLL_FLAGS=@DLL_FLAGS@
src/lib3270/glue.c
@@ -810,7 +810,7 @@ Boolean error_popup_visible = False; @@ -810,7 +810,7 @@ Boolean error_popup_visible = False;
810 810
811 811
812 /* Pop up an error dialog, based on an error number. */ 812 /* Pop up an error dialog, based on an error number. */
813 -void popup_an_errno(int errn, const char *fmt, ...) 813 +void popup_an_errno(H3270 *session, int errn, const char *fmt, ...)
814 { 814 {
815 char vmsgbuf[4096]; 815 char vmsgbuf[4096];
816 va_list args; 816 va_list args;
@@ -819,7 +819,7 @@ void popup_an_errno(int errn, const char *fmt, ...) @@ -819,7 +819,7 @@ void popup_an_errno(int errn, const char *fmt, ...)
819 (void) vsprintf(vmsgbuf, fmt, args); 819 (void) vsprintf(vmsgbuf, fmt, args);
820 va_end(args); 820 va_end(args);
821 821
822 - lib3270_write_log("3270", "Error Popup:\n%s\nrc=%d (%s)",vmsgbuf,errn,strerror(errn)); 822 + lib3270_write_log(session, "3270", "Error Popup:\n%s\nrc=%d (%s)",vmsgbuf,errn,strerror(errn));
823 823
824 Error(NULL,vmsgbuf); 824 Error(NULL,vmsgbuf);
825 } 825 }
src/lib3270/host.c
@@ -645,7 +645,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) @@ -645,7 +645,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
645 */ 645 */
646 static void try_reconnect(H3270 *session) 646 static void try_reconnect(H3270 *session)
647 { 647 {
648 - lib3270_write_log("3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-"); 648 + lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-");
649 session->auto_reconnect_inprogress = False; 649 session->auto_reconnect_inprogress = False;
650 lib3270_reconnect(session,0); 650 lib3270_reconnect(session,0);
651 } 651 }
src/lib3270/popupsc.h
@@ -14,5 +14,5 @@ @@ -14,5 +14,5 @@
14 14
15 /* Non-display version of popupsc.h */ 15 /* Non-display version of popupsc.h */
16 16
17 -LIB3270_INTERNAL void popup_an_errno(int errn, const char *fmt, ...); 17 +LIB3270_INTERNAL void popup_an_errno(H3270 *session, int errn, const char *fmt, ...);
18 LIB3270_INTERNAL void action_output(const char *fmt, ...); 18 LIB3270_INTERNAL void action_output(const char *fmt, ...);
src/lib3270/resolver.c
@@ -86,9 +86,7 @@ struct parms @@ -86,9 +86,7 @@ struct parms
86 */ 86 */
87 static int cresolve_host_and_port(H3270 *h, struct parms *p) 87 static int cresolve_host_and_port(H3270 *h, struct parms *p)
88 { 88 {
89 -#warning Should use configure to detect getaddrinfo and use it if available.  
90 -  
91 -#ifdef AF_INET6 89 +#ifdef HAVE_GETADDRINFO
92 90
93 struct addrinfo hints, *res; 91 struct addrinfo hints, *res;
94 int rc; 92 int rc;
src/lib3270/telnet.c
@@ -3277,7 +3277,7 @@ static void client_info_callback(INFO_CONST SSL *s, int where, int ret) @@ -3277,7 +3277,7 @@ static void client_info_callback(INFO_CONST SSL *s, int where, int ret)
3277 if (ret == 0) 3277 if (ret == 0)
3278 { 3278 {
3279 trace_dsn("SSL_connect: failed in %s\n",SSL_state_string_long(s)); 3279 trace_dsn("SSL_connect: failed in %s\n",SSL_state_string_long(s));
3280 - lib3270_write_log("SSL","connect failed in %s (Alert: %s)",SSL_state_string_long(s),SSL_alert_type_string_long(ret)); 3280 + lib3270_write_log(&h3270,"SSL","connect failed in %s (Alert: %s)",SSL_state_string_long(s),SSL_alert_type_string_long(ret));
3281 } 3281 }
3282 else if (ret < 0) 3282 else if (ret < 0)
3283 { 3283 {
src/lib3270/trace_ds.c
@@ -246,27 +246,6 @@ static void __vwtrace(H3270 *session, const char *fmt, va_list args) @@ -246,27 +246,6 @@ static void __vwtrace(H3270 *session, const char *fmt, va_list args)
246 fflush(stdout); 246 fflush(stdout);
247 } 247 }
248 248
249 -/*  
250 -static void vwtrace(const char *fmt, va_list args)  
251 -{  
252 - char buf[16384];  
253 -  
254 - vsnprintf(buf,16384,fmt,args);  
255 -  
256 - if(!tracewindow_handle)  
257 - tracewindow_handle = console_window_new( _( "Trace Window" ), NULL );  
258 -  
259 - if(tracewindow_handle)  
260 - console_window_append(tracewindow_handle,"%s",buf);  
261 -  
262 - if(tracef != NULL)  
263 - {  
264 - if(fwrite(buf,strlen(buf),1,tracef) != 1)  
265 - popup_an_errno(errno,_( "Write to trace file failed\n%s" ),strerror(errno));  
266 - }  
267 -}  
268 -*/  
269 -  
270 /* Write to the trace file. */ 249 /* Write to the trace file. */
271 static void wtrace(const char *fmt, ...) 250 static void wtrace(const char *fmt, ...)
272 { 251 {