Commit 4ea2a6a70153d667923e955b4fee451703e991bd

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

Igualando connect windows/linux, ferramentas devem ser compiladas com o compilad…

…or do host, não com o cross
Showing 2 changed files with 39 additions and 23 deletions   Show diff stats
src/lib3270/telnet.c
... ... @@ -331,9 +331,9 @@ static void ssl_info_callback(INFO_CONST SSL *s, int where, int ret);
331 331 static void continue_tls(unsigned char *sbbuf, int len);
332 332 #endif /*]*/
333 333  
334   -#if !defined(_WIN32) /*[*/
335   -static void output_possible(H3270 *session);
336   -#endif /*]*/
  334 +// #if !defined(_WIN32) /*[*/
  335 +// static void output_possible(H3270 *session);
  336 +// #endif /*]*/
337 337  
338 338 #if defined(_WIN32) /*[*/
339 339 #define socket_errno() WSAGetLastError()
... ... @@ -624,7 +624,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
624 624 #endif
625 625  
626 626 /* set the socket to be non-delaying */
627   - if (non_blocking(session,True) < 0)
  627 + if (non_blocking(session,False) < 0)
628 628 close_fail;
629 629  
630 630 #if !defined(_WIN32)
... ... @@ -641,17 +641,19 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
641 641  
642 642 /* connect */
643 643 status_connecting(session,1);
  644 + rc = connect_sock(session, session->sock, &haddr.sa,ha_len);
644 645  
645   - switch(connect_sock(session, session->sock, &haddr.sa,ha_len))
  646 + if(!rc)
646 647 {
647   - case 0: // Connected
648 648 trace_dsn("Connected.\n");
649 649  
650   - if(non_blocking(session,False) < 0)
651   - close_fail;
  650 +// if(non_blocking(session,False) < 0)
  651 +// close_fail;
  652 +
652 653 net_connected(session);
653   - break;
654 654  
  655 +/*
  656 + break;
655 657 case SE_EWOULDBLOCK: // Connection in progress
656 658 case SE_EINPROGRESS:
657 659 *pending = True;
... ... @@ -660,9 +662,19 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
660 662 output_id = AddOutput(session->sock, session, output_possible);
661 663 #endif
662 664 break;
  665 +*/
  666 + }
  667 + else
  668 + {
  669 + char *msg = xs_buffer( _( "Can't connect to %s:%d" ), session->hostname, session->current_port);
663 670  
664   - default:
665   - popup_a_sockerr(session, N_( "Can't connect to %s:%d" ),session->hostname, session->current_port);
  671 + lib3270_popup_dialog( session,
  672 + LIB3270_NOTIFY_ERROR,
  673 + _( "Network error" ),
  674 + msg,
  675 + "%s",strerror(rc) );
  676 +
  677 + Free(msg);
666 678 close_fail;
667 679  
668 680 }
... ... @@ -801,7 +813,7 @@ static void net_connected(H3270 *session)
801 813 }
802 814 else
803 815 {
804   - non_blocking(session,False);
  816 + // non_blocking(session,False);
805 817 rc = SSL_connect(session->ssl_con);
806 818  
807 819 if(rc != 1)
... ... @@ -898,12 +910,13 @@ static void connection_complete(void)
898 910 net_connected(&h3270);
899 911 }
900 912  
901   -#if !defined(_WIN32) /*[*/
902 913 /*
903   - * output_possible
904   - * Output is possible on the socket. Used only when a connection is
905   - * pending, to determine that the connection is complete.
906   - */
  914 +#if !defined(_WIN32)
  915 +//
  916 +// output_possible
  917 +// Output is possible on the socket. Used only when a connection is
  918 +// pending, to determine that the connection is complete.
  919 +//
907 920 static void output_possible(H3270 *session)
908 921 {
909 922 trace("%s: %s",__FUNCTION__,HALF_CONNECTED ? "Half connected" : "Connected");
... ... @@ -918,7 +931,8 @@ static void output_possible(H3270 *session)
918 931 output_id = 0L;
919 932 }
920 933 }
921   -#endif /*]*/
  934 +#endif
  935 +*/
922 936  
923 937 /*
924 938 * net_disconnect
... ...
src/tools/Makefile.in
... ... @@ -30,25 +30,27 @@ PACKAGE_NAME=@PACKAGE_NAME@
30 30  
31 31 EXEEXT=@EXEEXT@
32 32 OBJEXT=@OBJEXT@
33   -CFLAGS=@CFLAGS@ @GTK_CFLAGS@ -DDATAROOTDIR=\"$(datarootdir)\" -I../../src/include
34   -LIBS=@LIBS@ @GTK_LIBS@
  33 +
  34 +GTK_CFLAGS=@GTK_CFLAGS@
  35 +GTK_LIBS=@GTK_LIBS@
35 36  
36 37 CC=@CC@
37 38 LD=@CC@
  39 +HOST_CC=@HOST_CC@
38 40  
39 41 #---[ Rules ]------------------------------------------------------------------
40 42  
41 43 $(OBJDBG)/%.o: %.c
42 44 @echo " CC `basename $@`"
43   - @$(CC) $(CFLAGS) -o $@ -c $<
  45 + @$(HOST_CC) -g -o $@ $<
44 46  
45 47 #---[ Targets ]----------------------------------------------------------------
46 48  
47 49 all: xml2pot$(EXEEXT)
48 50  
49   -xml2pot$(EXEEXT): xml2pot$(OBJEXT)
  51 +xml2pot$(EXEEXT): xml2pot.c Makefile
50 52 @echo " CCLD `basename $@`"
51   - @$(LD) -o $@ $^ $(LIBS)
  53 + @$(HOST_CC) $(GTK_CFLAGS) -g -o $@ xml2pot.c $(GTK_LIBS)
52 54  
53 55 clean:
54 56 @rm -f *.$(OBJEXT)
... ...