Commit 20c47c4f2fe3e390d031c816d064b4e48a1a0175
1 parent
556416a7
Exists in
master
and in
5 other branches
Implementando hllapi
Showing
5 changed files
with
23 additions
and
7 deletions
Show diff stats
po/pt_BR.po
... | ... | @@ -5,7 +5,7 @@ msgid "" |
5 | 5 | msgstr "" |
6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | 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 | 9 | "PO-Revision-Date: 2012-09-20 17:33-0300\n" |
10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | 11 | "Language-Team: Português <perry.werneck@gmail.com>\n" | ... | ... |
src/include/pw3270.h
... | ... | @@ -66,6 +66,8 @@ |
66 | 66 | LIB3270_EXPORT const gchar * pw3270_get_session_name(GtkWidget *widget); |
67 | 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 | 71 | #ifdef HAVE_GTKMAC |
70 | 72 | #include <gtk-mac-bundle.h> |
71 | 73 | LIB3270_EXPORT GtkMacBundle * pw3270_get_bundle(void); | ... | ... |
src/plugins/remotectl/hllapi.c
... | ... | @@ -103,7 +103,9 @@ |
103 | 103 | data->rc = *rc; |
104 | 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 | 109 | memset(buffer,0,HLLAPI_MAXLENGTH); |
108 | 110 | |
109 | 111 | if(!TransactNamedPipe(hPipe,(LPVOID) data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NULL)) |
... | ... | @@ -161,16 +163,19 @@ |
161 | 163 | char * inBuffer = NULL; |
162 | 164 | char * outBuffer = NULL; |
163 | 165 | |
164 | - if(*length <= 0 || *length > HLLAPI_MAXLENGTH) | |
166 | + if(*length < 0 || *length > HLLAPI_MAXLENGTH) | |
165 | 167 | { |
166 | 168 | *rc = EINVAL; |
167 | 169 | return 0; |
168 | 170 | } |
169 | 171 | |
170 | 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 | 180 | // Clear output buffer |
176 | 181 | memset(buffer,' ',*length); | ... | ... |
src/plugins/remotectl/remotectl.c
... | ... | @@ -163,6 +163,7 @@ |
163 | 163 | if(!lib3270_connected(hSession)) |
164 | 164 | return ENOTCONN; |
165 | 165 | |
166 | + trace("%s: pos=%d row=%d col=%d",__FUNCTION__,rc,rc/80,rc%80); | |
166 | 167 | lib3270_set_cursor_address(hSession,(int) rc); |
167 | 168 | return 0; |
168 | 169 | } |
... | ... | @@ -198,6 +199,9 @@ |
198 | 199 | |
199 | 200 | switch(*(ptr++)) |
200 | 201 | { |
202 | + case 'P': // Print | |
203 | + break; | |
204 | + | |
201 | 205 | case 'E': // Enter |
202 | 206 | lib3270_enter(hSession); |
203 | 207 | break; |
... | ... | @@ -275,7 +279,7 @@ |
275 | 279 | |
276 | 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 | 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 | 99 | { |
100 | 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 | +} | ... | ... |