diff --git a/connect.c b/connect.c index 386203e..5b441a8 100644 --- a/connect.c +++ b/connect.c @@ -175,7 +175,7 @@ static void net_connected(H3270 *hSession) } #endif // WIN32 - LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_CONNECT_OPTION opt) + LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_OPTION opt) { CHECK_SESSION_HANDLE(hSession); @@ -202,20 +202,20 @@ static void net_connected(H3270 *hSession) hostname = name; } - hSession->host.opt = opt & ~LIB3270_CONNECT_OPTION_WAIT; + hSession->options = opt & ~LIB3270_OPTION_WAIT; Replace(hSession->host.current,strdup(hostname)); Replace(hSession->host.srvc,strdup(srvc)); Replace(hSession->host.full, lib3270_strdup_printf( "%s%s:%s", - opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://", + opt&LIB3270_OPTION_SSL ? "tn3270s://" : "tn3270://", hostname, srvc )); trace("current_host=\"%s\"",hSession->host.current); - return lib3270_connect(hSession,opt & LIB3270_CONNECT_OPTION_WAIT); + return lib3270_connect(hSession,opt & LIB3270_OPTION_WAIT); } @@ -316,7 +316,7 @@ static void net_connected(H3270 *hSession) hSession->ever_3270 = False; hSession->ssl_host = 0; - if(hSession->host.opt&LIB3270_CONNECT_OPTION_SSL) + if(hSession->options&LIB3270_OPTION_SSL) { #if defined(HAVE_LIBSSL) hSession->ssl_host = 1; diff --git a/host.c b/host.c index 92b9bd6..82e2706 100644 --- a/host.c +++ b/host.c @@ -500,18 +500,18 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) { static const struct _sch { - LIB3270_CONNECT_OPTION opt; - const char * text; - const char * srvc; + LIB3270_OPTION opt; + const char * text; + const char * srvc; } sch[] = { - { LIB3270_CONNECT_OPTION_DEFAULTS, "tn3270://", "telnet" }, - { LIB3270_CONNECT_OPTION_SSL, "tn3270s://", "telnets" }, - { LIB3270_CONNECT_OPTION_DEFAULTS, "telnet://", "telnet" }, - { LIB3270_CONNECT_OPTION_DEFAULTS, "telnets://", "telnets" }, - { LIB3270_CONNECT_OPTION_SSL, "L://", "telnets" }, + { LIB3270_OPTION_DEFAULTS, "tn3270://", "telnet" }, + { LIB3270_OPTION_SSL, "tn3270s://", "telnets" }, + { LIB3270_OPTION_DEFAULTS, "telnet://", "telnet" }, + { LIB3270_OPTION_DEFAULTS, "telnets://", "telnets" }, + { LIB3270_OPTION_SSL, "L://", "telnets" }, - { LIB3270_CONNECT_OPTION_SSL, "L:", "telnets" } // The compatibility should be the last option + { LIB3270_OPTION_SSL, "L:", "telnets" } // The compatibility should be the last option }; char * str = strdup(n); @@ -522,16 +522,16 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) int f; trace("%s(%s)",__FUNCTION__,str); - h->host.opt = LIB3270_CONNECT_OPTION_DEFAULTS; + h->options = LIB3270_OPTION_DEFAULTS; for(f=0;f < sizeof(sch)/sizeof(sch[0]);f++) { size_t sz = strlen(sch[f].text); if(!strncasecmp(hostname,sch[f].text,sz)) { - h->host.opt = sch[f].opt; - srvc = sch[f].srvc; - hostname += sz; + h->options = sch[f].opt; + srvc = sch[f].srvc; + hostname += sz; break; } } @@ -561,7 +561,7 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) Replace(h->host.full, lib3270_strdup_printf( "%s%s:%s%s%s", - h->host.opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://", + h->options&LIB3270_OPTION_SSL ? "tn3270s://" : "tn3270://", hostname, srvc, *query ? "?" : "", @@ -579,19 +579,19 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) { CHECK_SESSION_HANDLE(h); - return h->host.current; -} -LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h) -{ - CHECK_SESSION_HANDLE(h); - return h->host.srvc; + if(h->host.current) + return h->host.current; + + return ""; } -LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h) +LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h) { CHECK_SESSION_HANDLE(h); - return h->host.opt; + if(h->host.srvc) + return h->host.srvc; + return "telnet"; } LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) diff --git a/kybd.c b/kybd.c index e005723..6c6e22b 100644 --- a/kybd.c +++ b/kybd.c @@ -572,14 +572,14 @@ LIB3270_FKEY_ACTION( pfkey ) if (hSession->kybdlock) { - if(hSession->options & LIB3270_OPTION_KYBD_AS400) + if(hSession->options & LIB3270_OPTION_AS400) enq_key(hSession,pa_xlate[0]); enq_key(hSession,pf_xlate[key-1]); } else { - if(hSession->options & LIB3270_OPTION_KYBD_AS400) + if(hSession->options & LIB3270_OPTION_AS400) key_AID(hSession,pa_xlate[0]); key_AID(hSession,pf_xlate[key-1]); diff --git a/options.c b/options.c index 6e5272d..8aca9f0 100644 --- a/options.c +++ b/options.c @@ -39,7 +39,7 @@ static const const LIB3270_OPTION_ENTRY options[LIB3270_OPTION_COUNT+1] = { { - LIB3270_OPTION_KYBD_AS400, + LIB3270_OPTION_AS400, "as400", N_( "Host is AS/400" ), NULL -- libgit2 0.21.2