Commit c84d55f2675bf4fc7d5a585e4bb4c321084772bd

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

Simplificando opções de conexão

Showing 4 changed files with 30 additions and 30 deletions   Show diff stats
connect.c
... ... @@ -175,7 +175,7 @@ static void net_connected(H3270 *hSession)
175 175 }
176 176 #endif // WIN32
177 177  
178   - LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_CONNECT_OPTION opt)
  178 + LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_OPTION opt)
179 179 {
180 180 CHECK_SESSION_HANDLE(hSession);
181 181  
... ... @@ -202,20 +202,20 @@ static void net_connected(H3270 *hSession)
202 202 hostname = name;
203 203 }
204 204  
205   - hSession->host.opt = opt & ~LIB3270_CONNECT_OPTION_WAIT;
  205 + hSession->options = opt & ~LIB3270_OPTION_WAIT;
206 206 Replace(hSession->host.current,strdup(hostname));
207 207 Replace(hSession->host.srvc,strdup(srvc));
208 208  
209 209 Replace(hSession->host.full,
210 210 lib3270_strdup_printf(
211 211 "%s%s:%s",
212   - opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://",
  212 + opt&LIB3270_OPTION_SSL ? "tn3270s://" : "tn3270://",
213 213 hostname,
214 214 srvc ));
215 215  
216 216 trace("current_host=\"%s\"",hSession->host.current);
217 217  
218   - return lib3270_connect(hSession,opt & LIB3270_CONNECT_OPTION_WAIT);
  218 + return lib3270_connect(hSession,opt & LIB3270_OPTION_WAIT);
219 219  
220 220 }
221 221  
... ... @@ -316,7 +316,7 @@ static void net_connected(H3270 *hSession)
316 316 hSession->ever_3270 = False;
317 317 hSession->ssl_host = 0;
318 318  
319   - if(hSession->host.opt&LIB3270_CONNECT_OPTION_SSL)
  319 + if(hSession->options&LIB3270_OPTION_SSL)
320 320 {
321 321 #if defined(HAVE_LIBSSL)
322 322 hSession->ssl_host = 1;
... ...
host.c
... ... @@ -500,18 +500,18 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n)
500 500 {
501 501 static const struct _sch
502 502 {
503   - LIB3270_CONNECT_OPTION opt;
504   - const char * text;
505   - const char * srvc;
  503 + LIB3270_OPTION opt;
  504 + const char * text;
  505 + const char * srvc;
506 506 } sch[] =
507 507 {
508   - { LIB3270_CONNECT_OPTION_DEFAULTS, "tn3270://", "telnet" },
509   - { LIB3270_CONNECT_OPTION_SSL, "tn3270s://", "telnets" },
510   - { LIB3270_CONNECT_OPTION_DEFAULTS, "telnet://", "telnet" },
511   - { LIB3270_CONNECT_OPTION_DEFAULTS, "telnets://", "telnets" },
512   - { LIB3270_CONNECT_OPTION_SSL, "L://", "telnets" },
  508 + { LIB3270_OPTION_DEFAULTS, "tn3270://", "telnet" },
  509 + { LIB3270_OPTION_SSL, "tn3270s://", "telnets" },
  510 + { LIB3270_OPTION_DEFAULTS, "telnet://", "telnet" },
  511 + { LIB3270_OPTION_DEFAULTS, "telnets://", "telnets" },
  512 + { LIB3270_OPTION_SSL, "L://", "telnets" },
513 513  
514   - { LIB3270_CONNECT_OPTION_SSL, "L:", "telnets" } // The compatibility should be the last option
  514 + { LIB3270_OPTION_SSL, "L:", "telnets" } // The compatibility should be the last option
515 515 };
516 516  
517 517 char * str = strdup(n);
... ... @@ -522,16 +522,16 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n)
522 522 int f;
523 523  
524 524 trace("%s(%s)",__FUNCTION__,str);
525   - h->host.opt = LIB3270_CONNECT_OPTION_DEFAULTS;
  525 + h->options = LIB3270_OPTION_DEFAULTS;
526 526  
527 527 for(f=0;f < sizeof(sch)/sizeof(sch[0]);f++)
528 528 {
529 529 size_t sz = strlen(sch[f].text);
530 530 if(!strncasecmp(hostname,sch[f].text,sz))
531 531 {
532   - h->host.opt = sch[f].opt;
533   - srvc = sch[f].srvc;
534   - hostname += sz;
  532 + h->options = sch[f].opt;
  533 + srvc = sch[f].srvc;
  534 + hostname += sz;
535 535 break;
536 536 }
537 537 }
... ... @@ -561,7 +561,7 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n)
561 561 Replace(h->host.full,
562 562 lib3270_strdup_printf(
563 563 "%s%s:%s%s%s",
564   - h->host.opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://",
  564 + h->options&LIB3270_OPTION_SSL ? "tn3270s://" : "tn3270://",
565 565 hostname,
566 566 srvc,
567 567 *query ? "?" : "",
... ... @@ -579,19 +579,19 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n)
579 579 LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h)
580 580 {
581 581 CHECK_SESSION_HANDLE(h);
582   - return h->host.current;
583   -}
584 582  
585   -LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h)
586   -{
587   - CHECK_SESSION_HANDLE(h);
588   - return h->host.srvc;
  583 + if(h->host.current)
  584 + return h->host.current;
  585 +
  586 + return "";
589 587 }
590 588  
591   -LIB3270_EXPORT LIB3270_CONNECT_OPTION lib3270_get_connect_options(H3270 *h)
  589 +LIB3270_EXPORT const char * lib3270_get_srvcname(H3270 *h)
592 590 {
593 591 CHECK_SESSION_HANDLE(h);
594   - return h->host.opt;
  592 + if(h->host.srvc)
  593 + return h->host.srvc;
  594 + return "telnet";
595 595 }
596 596  
597 597 LIB3270_EXPORT const char * lib3270_get_host(H3270 *h)
... ...
kybd.c
... ... @@ -572,14 +572,14 @@ LIB3270_FKEY_ACTION( pfkey )
572 572  
573 573 if (hSession->kybdlock)
574 574 {
575   - if(hSession->options & LIB3270_OPTION_KYBD_AS400)
  575 + if(hSession->options & LIB3270_OPTION_AS400)
576 576 enq_key(hSession,pa_xlate[0]);
577 577  
578 578 enq_key(hSession,pf_xlate[key-1]);
579 579 }
580 580 else
581 581 {
582   - if(hSession->options & LIB3270_OPTION_KYBD_AS400)
  582 + if(hSession->options & LIB3270_OPTION_AS400)
583 583 key_AID(hSession,pa_xlate[0]);
584 584  
585 585 key_AID(hSession,pf_xlate[key-1]);
... ...
options.c
... ... @@ -39,7 +39,7 @@
39 39 static const const LIB3270_OPTION_ENTRY options[LIB3270_OPTION_COUNT+1] =
40 40 {
41 41 {
42   - LIB3270_OPTION_KYBD_AS400,
  42 + LIB3270_OPTION_AS400,
43 43 "as400",
44 44 N_( "Host is AS/400" ),
45 45 NULL
... ...