Commit 22c3f50c3caf5bcd774160c1620c1ed9a684c8bb

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

Iniciando atualizações da lib para a versão 5

Makefile.in
... ... @@ -75,8 +75,16 @@ clean:
75 75 @rm -fr .bin
76 76 @make -C src/lib3270 clean
77 77 @make -C src/gtk clean
  78 + @rm -f *.log
78 79  
79 80 distclean: clean
80 81 @rm -f src/gtk/Makefile
81 82 @rm -f config.status
82   - @rm -f *.log
  83 + @rm -f src/lib3270/mkversion.sh
  84 + @rm -f src/lib3270/Makefile
  85 + @rm -f src/include/lib3270/config.h
  86 + @rm -f src/gtk/uiparser/Makefile
  87 + @rm -fr autom4te.cache
  88 +
  89 + @rm -f Makefile
  90 +
... ...
src/gtk/v3270/v3270.h
... ... @@ -194,7 +194,7 @@
194 194  
195 195 H3270 * v3270_get_session(GtkWidget *widget);
196 196  
197   - void v3270_connect(GtkWidget *widget, const gchar *host);
  197 + int v3270_connect(GtkWidget *widget, const gchar *host);
198 198 void v3270_disconnect(GtkWidget *widget);
199 199  
200 200 G_END_DECLS
... ...
src/gtk/v3270/widget.c
... ... @@ -778,9 +778,12 @@ H3270 * v3270_get_session(GtkWidget *widget)
778 778 return GTK_V3270(widget)->host;
779 779 }
780 780  
781   -void v3270_connect(GtkWidget *widget, const gchar *host)
  781 +int v3270_connect(GtkWidget *widget, const gchar *host)
782 782 {
783 783 v3270 * terminal;
  784 + int rc = -1;
  785 +
  786 + trace("%s widget=%p host=%p",__FUNCTION__,widget,host);
784 787  
785 788 g_return_if_fail(GTK_IS_V3270(widget));
786 789  
... ... @@ -789,20 +792,23 @@ void v3270_connect(GtkWidget *widget, const gchar *host)
789 792 if(host)
790 793 {
791 794 set_string_to_config("host","uri","%s",host);
  795 + rc = lib3270_connect(terminal->host,host,0);
792 796 }
793 797 else
794 798 {
795 799 gchar *hs = get_string_from_config("host","uri","");
796 800  
  801 + trace("[%s]",hs);
  802 +
797 803 if(*hs)
798   - lib3270_connect(terminal->host,hs,0);
  804 + rc = lib3270_connect(terminal->host,hs,0);
799 805  
800 806 g_free(hs);
801   - return;
802 807 }
803 808  
804   - lib3270_connect(terminal->host,host,0);
  809 + trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc));
805 810  
  811 + return rc;
806 812 }
807 813  
808 814 gboolean v3270_focus_in_event(GtkWidget *widget, GdkEventFocus *event)
... ...
src/lib3270/host.c
... ... @@ -516,22 +516,8 @@ static int do_connect(H3270 *hSession, const char *n)
516 516 &hSession->passthru_host, &hSession->non_tn3270e_host, &hSession->ssl_host,
517 517 &hSession->no_login_host, hSession->luname, &port,
518 518 &needed)) == CN)
519   - return -1;
  519 + return EINVAL;
520 520  
521   - /* Look up the name in the hosts file. */ /*
522   - if (!needed && hostfile_lookup(s, &target_name, &ps)) {
523   - //
524   - // Rescan for qualifiers.
525   - // Qualifiers, LU names, and ports are all overridden
526   - // by the hosts file.
527   - //
528   - Free(s);
529   - if (!(s = split_host(target_name, &ansi_host,
530   - &std_ds_host, &passthru_host, &non_tn3270e_host,
531   - &ssl_host, &no_login_host, hSession->luname, &port,
532   - &needed)))
533   - return -1;
534   - } */
535 521 chost = s;
536 522  
537 523 /* Default the port. */
... ... @@ -620,8 +606,9 @@ static int do_connect(H3270 *hSession, const char *n)
620 606  
621 607 int lib3270_connect(H3270 *h, const char *n, int wait)
622 608 {
623   - if(!h)
624   - h = &h3270;
  609 + int rc;
  610 +
  611 + CHECK_SESSION_HANDLE(h);
625 612  
626 613 RunPendingEvents(0);
627 614  
... ... @@ -631,8 +618,9 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
631 618 if(PCONNECTED)
632 619 return EBUSY;
633 620  
634   - if(do_connect(h,n))
635   - return -1;
  621 + rc = do_connect(h,n);
  622 + if(rc)
  623 + return rc;
636 624  
637 625 if(wait)
638 626 {
... ... @@ -647,7 +635,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
647 635 }
648 636 }
649 637  
650   - return 0;
  638 + return rc;
651 639 }
652 640  
653 641 /*
... ...