Commit d1ef560ba0440fd727148047d11dde978909966a

Authored by Perry Werneck
1 parent 037c5e5c
Exists in master and in 2 other branches develop, macos

Updating get host and get service methods.

src/core/actions/actions.c
@@ -99,7 +99,7 @@ LIB3270_EXPORT int lib3270_activate_by_name(H3270 *hSession, const char *name) @@ -99,7 +99,7 @@ LIB3270_EXPORT int lib3270_activate_by_name(H3270 *hSession, const char *name)
99 99
100 LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name) 100 LIB3270_EXPORT int lib3270_action(H3270 *hSession, const char *name)
101 { 101 {
102 - return lib3270_activate_by_name(name,hSession); 102 + return lib3270_activate_by_name(hSession,name);
103 } 103 }
104 104
105 LIB3270_EXPORT void lib3270_action_group_notify(H3270 *hSession, LIB3270_ACTION_GROUP group) 105 LIB3270_EXPORT void lib3270_action_group_notify(H3270 *hSession, LIB3270_ACTION_GROUP group)
src/core/host.c
@@ -393,14 +393,18 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) @@ -393,14 +393,18 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n)
393 srvc = ptr; 393 srvc = ptr;
394 query = strchr(ptr,'?'); 394 query = strchr(ptr,'?');
395 395
396 - trace("QUERY=[%s]",query);  
397 -  
398 - if(query)  
399 - *(query++) = 0;  
400 - else  
401 - query = ""; 396 + }
  397 + else
  398 + {
  399 + srvc = "3270";
  400 + query = strchr(hostname,'?');
402 } 401 }
403 402
  403 + if(query)
  404 + *(query++) = 0;
  405 + else
  406 + query = "";
  407 +
404 trace("SRVC=[%s]",srvc); 408 trace("SRVC=[%s]",srvc);
405 409
406 Replace(h->host.current,strdup(hostname)); 410 Replace(h->host.current,strdup(hostname));
@@ -452,35 +456,6 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n) @@ -452,35 +456,6 @@ LIB3270_EXPORT int lib3270_set_url(H3270 *h, const char *n)
452 return 0; 456 return 0;
453 } 457 }
454 458
455 -LIB3270_EXPORT const char * lib3270_get_hostname(const H3270 *h)  
456 -{  
457 - if(h->host.current)  
458 - return h->host.current;  
459 -  
460 - return "";  
461 -}  
462 -  
463 -LIB3270_EXPORT void lib3270_set_hostname(H3270 *h, const char *hostname)  
464 -{  
465 - CHECK_SESSION_HANDLE(h);  
466 - Replace(h->host.current,strdup(hostname));  
467 - update_url(h);  
468 -}  
469 -  
470 -LIB3270_EXPORT const char * lib3270_get_srvcname(const H3270 *h)  
471 -{  
472 - if(h->host.srvc)  
473 - return h->host.srvc;  
474 - return "telnet";  
475 -}  
476 -  
477 -LIB3270_EXPORT void lib3270_set_srvcname(H3270 *h, const char *srvc)  
478 -{  
479 - CHECK_SESSION_HANDLE(h);  
480 - Replace(h->host.srvc,strdup(srvc));  
481 - update_url(h);  
482 -}  
483 -  
484 LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h) 459 LIB3270_EXPORT const char * lib3270_get_host(const H3270 *h)
485 { 460 {
486 return h->host.url; 461 return h->host.url;
src/core/properties/string.c
@@ -376,3 +376,13 @@ LIB3270_EXPORT const char ** lib3270_get_lunames(H3270 *hSession) @@ -376,3 +376,13 @@ LIB3270_EXPORT const char ** lib3270_get_lunames(H3270 *hSession)
376 return (const char **) hSession->lu.names; 376 return (const char **) hSession->lu.names;
377 } 377 }
378 378
  379 +LIB3270_EXPORT const char * lib3270_host_get_name(const H3270 *h)
  380 +{
  381 + return h->host.current;
  382 +}
  383 +
  384 +LIB3270_EXPORT const char * lib3270_service_get_name(const H3270 *h)
  385 +{
  386 + return h->host.srvc;
  387 +}
  388 +
src/include/lib3270.h
@@ -512,30 +512,6 @@ @@ -512,30 +512,6 @@
512 LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 *hSession); 512 LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 *hSession);
513 513
514 /** 514 /**
515 - * @brief Get hostname for the connect/reconnect operations.  
516 - *  
517 - * @param h Session handle.  
518 - *  
519 - * @return Pointer to host id set (internal data, do not change it)  
520 - *  
521 - */  
522 - LIB3270_EXPORT const char * LIB3270_DEPRECATED(lib3270_get_hostname(const H3270 *h));  
523 -  
524 - LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_hostname(H3270 *h, const char *hostname));  
525 -  
526 - /**  
527 - * @brief Get service or port for the connect/reconnect operations.  
528 - *  
529 - * @param h Session handle.  
530 - *  
531 - * @return Pointer to service name (internal data, do not change it)  
532 - *  
533 - */  
534 - LIB3270_EXPORT const char * LIB3270_DEPRECATED(lib3270_get_srvcname(const H3270 *h));  
535 -  
536 - LIB3270_EXPORT void LIB3270_DEPRECATED(lib3270_set_srvcname(H3270 *h, const char *srvc));  
537 -  
538 - /**  
539 * @brief Get HOST URL. 515 * @brief Get HOST URL.
540 * 516 *
541 * @return TN3270 Connection URL. 517 * @return TN3270 Connection URL.
src/include/lib3270/properties.h
@@ -219,6 +219,25 @@ @@ -219,6 +219,25 @@
219 */ 219 */
220 LIB3270_EXPORT char * lib3270_get_version_info(void); 220 LIB3270_EXPORT char * lib3270_get_version_info(void);
221 221
  222 + /**
  223 + * @brief Get hostname for the connect/reconnect operations.
  224 + *
  225 + * @param h Session handle.
  226 + *
  227 + * @return Pointer to host id set (internal data, do not change it)
  228 + *
  229 + */
  230 + LIB3270_EXPORT const char * lib3270_host_get_name(const H3270 *h);
  231 +
  232 + /**
  233 + * @brief Get service or port for the connect/reconnect operations.
  234 + *
  235 + * @param h Session handle.
  236 + *
  237 + * @return Pointer to service name (internal data, do not change it)
  238 + *
  239 + */
  240 + LIB3270_EXPORT const char * lib3270_service_get_name(const H3270 *h);
222 241
223 #ifdef __cplusplus 242 #ifdef __cplusplus
224 } 243 }
src/testprogram/testprogram.c
@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) @@ -114,7 +114,7 @@ int main(int argc, char *argv[])
114 #endif // HAVE_LDAP 114 #endif // HAVE_LDAP
115 115
116 if(lib3270_set_url(h,NULL)) 116 if(lib3270_set_url(h,NULL))
117 - lib3270_set_url(h,"tn3270://fandezhi.efglobe.com"); 117 + lib3270_set_url(h,"tn3270://127.0.0.1");
118 118
119 int long_index =0; 119 int long_index =0;
120 int opt; 120 int opt;