Commit 7b6d8dbd425efecf4bf40a187877318ef10e146b
1 parent
8a8d2975
Exists in
master
and in
5 other branches
Ajustes na interface hllapi.
Showing
2 changed files
with
8 additions
and
3 deletions
Show diff stats
src/include/pw3270/hllapi.h
... | ... | @@ -94,6 +94,8 @@ extern "C" { |
94 | 94 | // 22 PS was updated. |
95 | 95 | // 23 Both OIA and PS were updated. |
96 | 96 | // 24 Either the string was not found, or the presentation space is unformatted. |
97 | + #define HLLAPI_STATUS_NOT_FOUND 24 /**< String not found or unformatted presentation space */ | |
98 | + | |
97 | 99 | // 25 Keystrokes were not available on input queue. |
98 | 100 | // 26 A host event occurred. See QUERY HOST UPDATE (24) for details. |
99 | 101 | // 28 Field length was 0. | ... | ... |
src/plugins/hllapi/hllapi.c
... | ... | @@ -325,7 +325,10 @@ static int search_ps(char *buffer, unsigned short *length, unsigned short *ps) |
325 | 325 | */ |
326 | 326 | size_t szBuffer = strlen(buffer); |
327 | 327 | char * text; |
328 | - int rc = -1; | |
328 | + int rc = HLLAPI_STATUS_SYSTEM_ERROR; | |
329 | + | |
330 | + if(!hllapi_is_connected()) | |
331 | + return HLLAPI_STATUS_DISCONNECTED; | |
329 | 332 | |
330 | 333 | if(*length < szBuffer) |
331 | 334 | szBuffer = *length; |
... | ... | @@ -339,13 +342,13 @@ static int search_ps(char *buffer, unsigned short *length, unsigned short *ps) |
339 | 342 | { |
340 | 343 | // String not found |
341 | 344 | *ps = 0; |
342 | - rc = 24; | |
345 | + rc = HLLAPI_STATUS_NOT_FOUND; | |
343 | 346 | } |
344 | 347 | else |
345 | 348 | { |
346 | 349 | // String found |
347 | 350 | *ps = 1; |
348 | - rc = 0; | |
351 | + rc = HLLAPI_STATUS_SUCCESS; | |
349 | 352 | } |
350 | 353 | |
351 | 354 | hllapi_free(text); | ... | ... |