Commit a6f48ae72b0c7a8d3f05b3e331607fafd2d5fa32

Authored by perry.werneck@gmail.com
1 parent 60d5647c
Exists in master

Incluindo opção para usar mapeamento de teclas PF específico para AS400

1 #!/bin/bash 1 #!/bin/bash
2 2
3 PACKAGE_VERSION=4.2 3 PACKAGE_VERSION=4.2
4 -PACKAGE_RELEASE=5 4 +PACKAGE_RELEASE=6
5 REV_FILE=./revision.m4 5 REV_FILE=./revision.m4
6 REV=`date +%y%m%d%H%M` 6 REV=`date +%y%m%d%H%M`
7 7
src/gtk2/action_calls.c
@@ -54,10 +54,11 @@ @@ -54,10 +54,11 @@
54 char *ptr; 54 char *ptr;
55 gboolean again = TRUE; 55 gboolean again = TRUE;
56 char buffer[1024]; 56 char buffer[1024];
57 - GtkTable *table = GTK_TABLE(gtk_table_new(2,4,FALSE)); 57 + GtkTable *table = GTK_TABLE(gtk_table_new(2,6,FALSE));
58 GtkEntry *host = GTK_ENTRY(gtk_entry_new()); 58 GtkEntry *host = GTK_ENTRY(gtk_entry_new());
59 GtkEntry *port = GTK_ENTRY(gtk_entry_new()); 59 GtkEntry *port = GTK_ENTRY(gtk_entry_new());
60 - GtkToggleButton *checkbox = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Secure connection" ) )); 60 + GtkToggleButton *secure = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Secure connection" ) ));
  61 + GtkToggleButton *as400 = GTK_TOGGLE_BUTTON(gtk_check_button_new_with_label( _( "Host is AS400" ) ));
61 GtkWidget *dialog = gtk_dialog_new_with_buttons( _( "Select hostname" ), 62 GtkWidget *dialog = gtk_dialog_new_with_buttons( _( "Select hostname" ),
62 GTK_WINDOW(topwindow), 63 GTK_WINDOW(topwindow),
63 GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, 64 GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -73,12 +74,13 @@ @@ -73,12 +74,13 @@
73 gtk_entry_set_width_chars(port,7); 74 gtk_entry_set_width_chars(port,7);
74 75
75 gtk_table_attach(table,gtk_label_new( _( "Hostname:" ) ), 0,1,0,1,0,0,5,0); 76 gtk_table_attach(table,gtk_label_new( _( "Hostname:" ) ), 0,1,0,1,0,0,5,0);
76 - gtk_table_attach(table,GTK_WIDGET(host), 1,2,0,1,GTK_EXPAND|GTK_FILL,0,0,0); 77 + gtk_table_attach(table,GTK_WIDGET(host), 1,4,0,1,GTK_EXPAND|GTK_FILL,0,0,0);
77 78
78 - gtk_table_attach(table,gtk_label_new( _( "Port:" ) ), 2,3,0,1,0,0,5,0);  
79 - gtk_table_attach(table,GTK_WIDGET(port), 3,4,0,1,GTK_FILL,0,0,0); 79 + gtk_table_attach(table,gtk_label_new( _( "Port:" ) ), 4,5,0,1,0,0,5,0);
  80 + gtk_table_attach(table,GTK_WIDGET(port), 5,6,0,1,GTK_EXPAND|GTK_FILL,0,0,0);
80 81
81 - gtk_table_attach(table,GTK_WIDGET(checkbox), 1,2,1,2,GTK_EXPAND|GTK_FILL,0,0,0); 82 + gtk_table_attach(table,GTK_WIDGET(secure), 1,2,1,2,GTK_FILL,0,0,0);
  83 + gtk_table_attach(table,GTK_WIDGET(as400), 2,3,1,2,GTK_EXPAND|GTK_FILL,0,20,0);
82 84
83 gtk_container_set_border_width(GTK_CONTAINER(table),5); 85 gtk_container_set_border_width(GTK_CONTAINER(table),5);
84 86
@@ -89,16 +91,23 @@ @@ -89,16 +91,23 @@
89 #ifdef HAVE_LIBSSL 91 #ifdef HAVE_LIBSSL
90 if(!strncmp(hostname,"L:",2)) 92 if(!strncmp(hostname,"L:",2))
91 { 93 {
92 - gtk_toggle_button_set_active(checkbox,TRUE); 94 + gtk_toggle_button_set_active(secure,TRUE);
93 hostname += 2; 95 hostname += 2;
94 } 96 }
95 #else 97 #else
96 - gtk_toggle_button_set_active(checkbox,FALSE);  
97 - gtk_widget_set_sensitive(GTK_WIDGET(checkbox),FALSE); 98 + gtk_toggle_button_set_active(secure,FALSE);
  99 + gtk_widget_set_sensitive(GTK_WIDGET(secure),FALSE);
98 if(!strncmp(hostname,"L:",2)) 100 if(!strncmp(hostname,"L:",2))
99 hostname += 2; 101 hostname += 2;
100 #endif 102 #endif
101 103
  104 + ptr = strchr(hostname,',');
  105 + if(ptr)
  106 + {
  107 + *(ptr++) = 0;
  108 + gtk_toggle_button_set_active(as400,strcmp(ptr,"as400") == 0);
  109 + }
  110 +
102 ptr = strchr(hostname,':'); 111 ptr = strchr(hostname,':');
103 if(ptr) 112 if(ptr)
104 { 113 {
@@ -123,7 +132,7 @@ @@ -123,7 +132,7 @@
123 132
124 gtk_widget_set_sensitive(dialog,FALSE); 133 gtk_widget_set_sensitive(dialog,FALSE);
125 134
126 - if(gtk_toggle_button_get_active(checkbox)) 135 + if(gtk_toggle_button_get_active(secure))
127 strcpy(buffer,"L:"); 136 strcpy(buffer,"L:");
128 else 137 else
129 *buffer = 0; 138 *buffer = 0;
@@ -132,6 +141,9 @@ @@ -132,6 +141,9 @@
132 strncat(buffer,":",1023); 141 strncat(buffer,":",1023);
133 strncat(buffer,gtk_entry_get_text(port),1023); 142 strncat(buffer,gtk_entry_get_text(port),1023);
134 143
  144 + if(gtk_toggle_button_get_active(as400))
  145 + strncat(buffer,",as400",1023);
  146 +
135 if(!host_connect(buffer,1)) 147 if(!host_connect(buffer,1))
136 { 148 {
137 // Connection OK 149 // Connection OK
src/include/lib3270/api.h
@@ -197,6 +197,7 @@ @@ -197,6 +197,7 @@
197 int sock; /**< Network socket */ 197 int sock; /**< Network socket */
198 int net_sock; 198 int net_sock;
199 LIB3270_CSTATE cstate; /**< Connection state */ 199 LIB3270_CSTATE cstate; /**< Connection state */
  200 + int as400; /**< Host is AS400 */
200 201
201 #if defined(_WIN32) /*[*/ 202 #if defined(_WIN32) /*[*/
202 HANDLE sock_handle; 203 HANDLE sock_handle;
src/lib/host.c
@@ -620,6 +620,9 @@ static int do_connect(H3270 *hSession, const char *n) @@ -620,6 +620,9 @@ static int do_connect(H3270 *hSession, const char *n)
620 620
621 int lib3270_connect(H3270 *h, const char *n, int wait) 621 int lib3270_connect(H3270 *h, const char *n, int wait)
622 { 622 {
  623 + char * hostname;
  624 + char * options;
  625 +
623 if(!h) 626 if(!h)
624 h = &h3270; 627 h = &h3270;
625 628
@@ -631,8 +634,20 @@ int lib3270_connect(H3270 *h, const char *n, int wait) @@ -631,8 +634,20 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
631 if(PCONNECTED) 634 if(PCONNECTED)
632 return EBUSY; 635 return EBUSY;
633 636
634 - if(do_connect(h,n)) 637 + hostname = strdup(n);
  638 +
  639 + options = strchr(hostname,',');
  640 + if(options)
  641 + {
  642 + *(options++) = 0;
  643 + h->as400 = strcasecmp(options,"as400") == 0 ? 1 : 0;
  644 + }
  645 +
  646 + if(do_connect(h,hostname))
  647 + {
  648 + free(hostname);
635 return -1; 649 return -1;
  650 + }
636 651
637 if(wait) 652 if(wait)
638 { 653 {
@@ -647,6 +662,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) @@ -647,6 +662,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
647 } 662 }
648 } 663 }
649 664
  665 + free(hostname);
650 return 0; 666 return 0;
651 } 667 }
652 668
src/lib/kybd.c
@@ -546,10 +546,19 @@ LIB3270_FKEY_ACTION( pfkey ) @@ -546,10 +546,19 @@ LIB3270_FKEY_ACTION( pfkey )
546 546
547 if (kybdlock & KL_OIA_MINUS) 547 if (kybdlock & KL_OIA_MINUS)
548 return -1; 548 return -1;
549 - else if (kybdlock) 549 +
  550 + if (kybdlock)
  551 + {
  552 + if(h3270.as400)
  553 + enq_key(pa_xlate,0);
550 enq_key(pf_xlate,key-1); 554 enq_key(pf_xlate,key-1);
  555 + }
551 else 556 else
  557 + {
  558 + if(h3270.as400)
  559 + key_AID(pa_xlate[0]);
552 key_AID(pf_xlate[key-1]); 560 key_AID(pf_xlate[key-1]);
  561 + }
553 562
554 return 0; 563 return 0;
555 } 564 }