diff --git a/src/include/pw3270/hllapi.h b/src/include/pw3270/hllapi.h index 157af09..7c45893 100644 --- a/src/include/pw3270/hllapi.h +++ b/src/include/pw3270/hllapi.h @@ -94,6 +94,8 @@ extern "C" { // 22 PS was updated. // 23 Both OIA and PS were updated. // 24 Either the string was not found, or the presentation space is unformatted. + #define HLLAPI_STATUS_NOT_FOUND 24 /**< String not found or unformatted presentation space */ + // 25 Keystrokes were not available on input queue. // 26 A host event occurred. See QUERY HOST UPDATE (24) for details. // 28 Field length was 0. diff --git a/src/plugins/hllapi/hllapi.c b/src/plugins/hllapi/hllapi.c index dfbff28..6b5150d 100644 --- a/src/plugins/hllapi/hllapi.c +++ b/src/plugins/hllapi/hllapi.c @@ -325,7 +325,10 @@ static int search_ps(char *buffer, unsigned short *length, unsigned short *ps) */ size_t szBuffer = strlen(buffer); char * text; - int rc = -1; + int rc = HLLAPI_STATUS_SYSTEM_ERROR; + + if(!hllapi_is_connected()) + return HLLAPI_STATUS_DISCONNECTED; if(*length < szBuffer) szBuffer = *length; @@ -339,13 +342,13 @@ static int search_ps(char *buffer, unsigned short *length, unsigned short *ps) { // String not found *ps = 0; - rc = 24; + rc = HLLAPI_STATUS_NOT_FOUND; } else { // String found *ps = 1; - rc = 0; + rc = HLLAPI_STATUS_SUCCESS; } hllapi_free(text); -- libgit2 0.21.2