diff --git a/.gitignore b/.gitignore index 4b0b20d..b180c9c 100644 --- a/.gitignore +++ b/.gitignore @@ -49,5 +49,6 @@ makeruntime.sh scripts vgcore.* doxygen/html +src/include/lib3270/actions.h doxygen/doxyfile diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 5af7158..e971626 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -459,10 +459,10 @@ * @param h Session handle. * @param url URL of host to set in the format tn3270://hostname:service or tn3270s://hostname:service . * - * @return Processed host url + * @return 0 * */ - LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *url); + LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *url); /** * @brief Get hostname for the connect/reconnect operations. @@ -489,7 +489,13 @@ LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc); - LIB3270_EXPORT const char * lib3270_get_url(H3270 *h, char *buffer, int len); + /** + * @brief Get HOST URL. + * + * @return TN3270 Connection URL. + * + */ + LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession); /** * @brief Get session options. diff --git a/src/lib3270/host.c b/src/lib3270/host.c index a783844..219d94f 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -169,6 +169,7 @@ LIB3270_EXPORT void lib3270_register_schange(H3270 *h, LIB3270_STATE tx, void (* st = (struct lib3270_state_callback *) lib3270_malloc(sizeof(struct lib3270_state_callback)); st->func = func; + st->data = data; if (h->st_last[tx]) h->st_last[tx]->next = st; @@ -231,20 +232,13 @@ static void update_host(H3270 *h) } -LIB3270_EXPORT const char * lib3270_get_url(H3270 *h, char *buffer, int len) +LIB3270_EXPORT const char * lib3270_get_url(H3270 *hSession) { - CHECK_SESSION_HANDLE(h); - - snprintf(buffer,len,"%s://%s:%s", - ((h->options & LIB3270_OPTION_SSL) == 0) ? "tn3270" : "tn3270s", - h->host.current, - h->host.srvc - ); - - return buffer; + CHECK_SESSION_HANDLE(hSession); + return hSession->host.full; } -LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *n) +LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) { CHECK_SESSION_HANDLE(h); @@ -289,7 +283,7 @@ LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *n) } if(!*hostname) - return h->host.current; + return 0; ptr = strchr(hostname,':'); if(ptr) @@ -353,7 +347,7 @@ LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *n) free(str); } - return h->host.current; + return 0; } LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h) diff --git a/src/lib3270/testprogram/testprogram.c b/src/lib3270/testprogram/testprogram.c index 09ef26f..f678fb9 100644 --- a/src/lib3270/testprogram/testprogram.c +++ b/src/lib3270/testprogram/testprogram.c @@ -22,7 +22,7 @@ int main(int numpar, char *param[]) lib3270_set_url(h,url ? url : "tn3270://fandezhi.efglobe.com"); rc = lib3270_connect(h,120); - printf("\nConnect exits with rc=%d\n",rc); + printf("\nConnect %s exits with rc=%d\n",lib3270_get_url(h),rc); lib3270_wait_for_ready(h,10); -- libgit2 0.21.2