diff --git a/Makefile.in b/Makefile.in index da43b8f..a361f76 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,8 +75,16 @@ clean: @rm -fr .bin @make -C src/lib3270 clean @make -C src/gtk clean + @rm -f *.log distclean: clean @rm -f src/gtk/Makefile @rm -f config.status - @rm -f *.log + @rm -f src/lib3270/mkversion.sh + @rm -f src/lib3270/Makefile + @rm -f src/include/lib3270/config.h + @rm -f src/gtk/uiparser/Makefile + @rm -fr autom4te.cache + + @rm -f Makefile + diff --git a/src/gtk/v3270/v3270.h b/src/gtk/v3270/v3270.h index c75624a..ee17e26 100644 --- a/src/gtk/v3270/v3270.h +++ b/src/gtk/v3270/v3270.h @@ -194,7 +194,7 @@ H3270 * v3270_get_session(GtkWidget *widget); - void v3270_connect(GtkWidget *widget, const gchar *host); + int v3270_connect(GtkWidget *widget, const gchar *host); void v3270_disconnect(GtkWidget *widget); G_END_DECLS diff --git a/src/gtk/v3270/widget.c b/src/gtk/v3270/widget.c index bab4fc8..e8950e7 100644 --- a/src/gtk/v3270/widget.c +++ b/src/gtk/v3270/widget.c @@ -778,9 +778,12 @@ H3270 * v3270_get_session(GtkWidget *widget) return GTK_V3270(widget)->host; } -void v3270_connect(GtkWidget *widget, const gchar *host) +int v3270_connect(GtkWidget *widget, const gchar *host) { v3270 * terminal; + int rc = -1; + + trace("%s widget=%p host=%p",__FUNCTION__,widget,host); g_return_if_fail(GTK_IS_V3270(widget)); @@ -789,20 +792,23 @@ void v3270_connect(GtkWidget *widget, const gchar *host) if(host) { set_string_to_config("host","uri","%s",host); + rc = lib3270_connect(terminal->host,host,0); } else { gchar *hs = get_string_from_config("host","uri",""); + trace("[%s]",hs); + if(*hs) - lib3270_connect(terminal->host,hs,0); + rc = lib3270_connect(terminal->host,hs,0); g_free(hs); - return; } - lib3270_connect(terminal->host,host,0); + trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); + return rc; } gboolean v3270_focus_in_event(GtkWidget *widget, GdkEventFocus *event) diff --git a/src/lib3270/host.c b/src/lib3270/host.c index 8fa2864..afdb4b8 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -516,22 +516,8 @@ static int do_connect(H3270 *hSession, const char *n) &hSession->passthru_host, &hSession->non_tn3270e_host, &hSession->ssl_host, &hSession->no_login_host, hSession->luname, &port, &needed)) == CN) - return -1; + return EINVAL; - /* Look up the name in the hosts file. */ /* - if (!needed && hostfile_lookup(s, &target_name, &ps)) { - // - // Rescan for qualifiers. - // Qualifiers, LU names, and ports are all overridden - // by the hosts file. - // - Free(s); - if (!(s = split_host(target_name, &ansi_host, - &std_ds_host, &passthru_host, &non_tn3270e_host, - &ssl_host, &no_login_host, hSession->luname, &port, - &needed))) - return -1; - } */ chost = s; /* Default the port. */ @@ -620,8 +606,9 @@ static int do_connect(H3270 *hSession, const char *n) int lib3270_connect(H3270 *h, const char *n, int wait) { - if(!h) - h = &h3270; + int rc; + + CHECK_SESSION_HANDLE(h); RunPendingEvents(0); @@ -631,8 +618,9 @@ int lib3270_connect(H3270 *h, const char *n, int wait) if(PCONNECTED) return EBUSY; - if(do_connect(h,n)) - return -1; + rc = do_connect(h,n); + if(rc) + return rc; if(wait) { @@ -647,7 +635,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) } } - return 0; + return rc; } /* -- libgit2 0.21.2