Commit 20c47c4f2fe3e390d031c816d064b4e48a1a0175

Authored by perry.werneck@gmail.com
1 parent 556416a7

Implementando hllapi

@@ -5,7 +5,7 @@ msgid "" @@ -5,7 +5,7 @@ msgid ""
5 msgstr "" 5 msgstr ""
6 "Project-Id-Version: pw3270 5.0\n" 6 "Project-Id-Version: pw3270 5.0\n"
7 "Report-Msgid-Bugs-To: \n" 7 "Report-Msgid-Bugs-To: \n"
8 -"POT-Creation-Date: 2012-09-20 18:39-0300\n" 8 +"POT-Creation-Date: 2012-09-24 23:07-0300\n"
9 "PO-Revision-Date: 2012-09-20 17:33-0300\n" 9 "PO-Revision-Date: 2012-09-20 17:33-0300\n"
10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 "Language-Team: Português <perry.werneck@gmail.com>\n" 11 "Language-Team: Português <perry.werneck@gmail.com>\n"
src/include/pw3270.h
@@ -66,6 +66,8 @@ @@ -66,6 +66,8 @@
66 LIB3270_EXPORT const gchar * pw3270_get_session_name(GtkWidget *widget); 66 LIB3270_EXPORT const gchar * pw3270_get_session_name(GtkWidget *widget);
67 LIB3270_EXPORT void pw3270_set_session_name(GtkWidget *widget, const gchar *name); 67 LIB3270_EXPORT void pw3270_set_session_name(GtkWidget *widget, const gchar *name);
68 68
  69 + LIB3270_EXPORT gint pw3270_get_integer(GtkWidget *widget, const gchar *group, const gchar *key, gint def);
  70 +
69 #ifdef HAVE_GTKMAC 71 #ifdef HAVE_GTKMAC
70 #include <gtk-mac-bundle.h> 72 #include <gtk-mac-bundle.h>
71 LIB3270_EXPORT GtkMacBundle * pw3270_get_bundle(void); 73 LIB3270_EXPORT GtkMacBundle * pw3270_get_bundle(void);
src/plugins/remotectl/hllapi.c
@@ -103,7 +103,9 @@ @@ -103,7 +103,9 @@
103 data->rc = *rc; 103 data->rc = *rc;
104 data->len = length; 104 data->len = length;
105 105
106 - memcpy(data->string,arg,length); 106 + if(arg && length > 0)
  107 + memcpy(data->string,arg,length);
  108 +
107 memset(buffer,0,HLLAPI_MAXLENGTH); 109 memset(buffer,0,HLLAPI_MAXLENGTH);
108 110
109 if(!TransactNamedPipe(hPipe,(LPVOID) data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NULL)) 111 if(!TransactNamedPipe(hPipe,(LPVOID) data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NULL))
@@ -161,16 +163,19 @@ @@ -161,16 +163,19 @@
161 char * inBuffer = NULL; 163 char * inBuffer = NULL;
162 char * outBuffer = NULL; 164 char * outBuffer = NULL;
163 165
164 - if(*length <= 0 || *length > HLLAPI_MAXLENGTH) 166 + if(*length < 0 || *length > HLLAPI_MAXLENGTH)
165 { 167 {
166 *rc = EINVAL; 168 *rc = EINVAL;
167 return 0; 169 return 0;
168 } 170 }
169 171
170 // Copy input argument 172 // Copy input argument
171 - inBuffer = malloc(*length+1);  
172 - memcpy(inBuffer,buffer,*length);  
173 - inBuffer[*length] = 0; 173 + if(*length)
  174 + {
  175 + inBuffer = malloc(*length+1);
  176 + memcpy(inBuffer,buffer,*length);
  177 + inBuffer[*length] = 0;
  178 + }
174 179
175 // Clear output buffer 180 // Clear output buffer
176 memset(buffer,' ',*length); 181 memset(buffer,' ',*length);
src/plugins/remotectl/remotectl.c
@@ -163,6 +163,7 @@ @@ -163,6 +163,7 @@
163 if(!lib3270_connected(hSession)) 163 if(!lib3270_connected(hSession))
164 return ENOTCONN; 164 return ENOTCONN;
165 165
  166 + trace("%s: pos=%d row=%d col=%d",__FUNCTION__,rc,rc/80,rc%80);
166 lib3270_set_cursor_address(hSession,(int) rc); 167 lib3270_set_cursor_address(hSession,(int) rc);
167 return 0; 168 return 0;
168 } 169 }
@@ -198,6 +199,9 @@ @@ -198,6 +199,9 @@
198 199
199 switch(*(ptr++)) 200 switch(*(ptr++))
200 { 201 {
  202 + case 'P': // Print
  203 + break;
  204 +
201 case 'E': // Enter 205 case 'E': // Enter
202 lib3270_enter(hSession); 206 lib3270_enter(hSession);
203 break; 207 break;
@@ -275,7 +279,7 @@ @@ -275,7 +279,7 @@
275 279
276 static int cmd_wait(H3270 *hSession, unsigned short rc, char *text, unsigned short length) 280 static int cmd_wait(H3270 *hSession, unsigned short rc, char *text, unsigned short length)
277 { 281 {
278 - return lib3270_wait_for_ready(hSession,60); 282 + return lib3270_wait_for_ready(hSession,pw3270_get_integer(pw3270_get_toplevel(),"hllapi","wait",2));
279 } 283 }
280 284
281 static int cmd_copypstostr(H3270 *hSession, unsigned short pos, char *outBuff, unsigned short length) 285 static int cmd_copypstostr(H3270 *hSession, unsigned short pos, char *outBuff, unsigned short length)
src/pw3270/tools.c
@@ -99,3 +99,8 @@ LIB3270_EXPORT void pw3270_restore_window(GtkWidget *widget, const gchar *name) @@ -99,3 +99,8 @@ LIB3270_EXPORT void pw3270_restore_window(GtkWidget *widget, const gchar *name)
99 { 99 {
100 restore_window_from_config("window", name, widget); 100 restore_window_from_config("window", name, widget);
101 } 101 }
  102 +
  103 +LIB3270_EXPORT gint pw3270_get_integer(GtkWidget *widget, const gchar *group, const gchar *key, gint def)
  104 +{
  105 + return get_integer_from_config(group, key, def);
  106 +}