diff --git a/src/core/html.c b/src/core/html.c
index a999710..103bbb5 100644
--- a/src/core/html.c
+++ b/src/core/html.c
@@ -282,7 +282,7 @@
}
else if(session->text[baddr+col+1].chr == 'F')
{
- char *text = lib3270_get_field_text_at(session,baddr+col+1);
+ char *text = lib3270_get_field_string_at(session,baddr+col+1);
if(text)
{
diff --git a/src/core/wait.c b/src/core/wait.c
index 2632793..ef35bbc 100644
--- a/src/core/wait.c
+++ b/src/core/wait.c
@@ -67,6 +67,42 @@ LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds)
return errno = ETIMEDOUT;
}
+int lib3270_wait_for_text(H3270 *hSession, const char *key, int seconds)
+{
+ time_t end = time(0)+seconds;
+
+ FAIL_IF_NOT_ONLINE(hSession);
+
+ lib3270_main_iterate(hSession,0);
+
+ do
+ {
+ // Keyboard is locked by operator error, fails!
+ if(hSession->kybdlock && KYBDLOCK_IS_OERR(hSession))
+ return errno = EPERM;
+
+ if(!lib3270_connected(hSession))
+ return errno = ENOTCONN;
+
+ char * contents = lib3270_get_string_at_address(hSession, 0, -1, 0);
+ if(!contents)
+ return errno;
+
+ if(strstr(contents,key)) {
+ lib3270_free(contents);
+ return 0;
+ }
+
+ lib3270_free(contents);
+
+ lib3270_main_iterate(hSession,1);
+
+ }
+ while(time(0) < end);
+
+ return errno = ETIMEDOUT;
+}
+
int lib3270_wait_for_string_at_address(H3270 *hSession, int baddr, const char *key, int seconds)
{
time_t end = time(0)+seconds;
@@ -87,7 +123,7 @@ int lib3270_wait_for_string_at_address(H3270 *hSession, int baddr, const char *k
if(!lib3270_connected(hSession))
return errno = ENOTCONN;
- if(lib3270_cmp_text_at_address(hSession, baddr, key, 0) == 0)
+ if(lib3270_cmp_string_at_address(hSession, baddr, key, 0) == 0)
return 0;
lib3270_main_iterate(hSession,1);
diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 060093b..3d26749 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -705,9 +705,7 @@
* @return Negative if error (sets errno) or number of processed characters.
*
*/
- LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *text, int length);
-
- #define lib3270_set_text_at(h,r,c,t) lib3270_set_string_at(h,r,c,t,-1)
+ LIB3270_EXPORT int lib3270_set_text(H3270 *h, const unsigned char *text, int length);
/**
* @brief Set string at defined row/column.
@@ -1135,9 +1133,9 @@
* @return Test result from strcmp
*
*/
- LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, unsigned int row, unsigned int col, const char *text, char lf);
+ LIB3270_EXPORT int lib3270_cmp_string_at(H3270 *h, unsigned int row, unsigned int col, const char *text, char lf);
- LIB3270_EXPORT int lib3270_cmp_text_at_address(H3270 *h, int baddr, const char *text, char lf);
+ LIB3270_EXPORT int lib3270_cmp_string_at_address(H3270 *h, int baddr, const char *text, char lf);
/**
* @brief Get contents of the field at position.
@@ -1151,7 +1149,7 @@
* @exception EOVERFLOW Invalid position.
*
*/
- LIB3270_EXPORT char * lib3270_get_field_text_at(H3270 *h, int baddr);
+ LIB3270_EXPORT char * lib3270_get_field_string_at(H3270 *h, int baddr);
/**
* @brief Find the next unprotected field.
@@ -1481,6 +1479,22 @@
LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession);
/**
+ * @brief Wait for string at screen.
+ *
+ * @param hSession TN3270 Session.
+ * @param key The string to wait for.
+ * @param seconds Maximum wait time.
+ *
+ * @return 0 if the string was found, error code if not (sets errno).
+ *
+ * @retval ENOTCONN Not connected to host.
+ * @retval ETIMEDOUT Timeout.
+ * @retval EPERM The keyboard is locked.
+ *
+ */
+ LIB3270_EXPORT int lib3270_wait_for_string(H3270 *hSession, const char *key, int seconds);
+
+ /**
* @brief Wait for string at position.
*
* @param hSession TN3270 Session.
diff --git a/src/selection/selection.c b/src/selection/selection.c
index 6285311..5610f59 100644
--- a/src/selection/selection.c
+++ b/src/selection/selection.c
@@ -345,16 +345,16 @@ LIB3270_EXPORT char * lib3270_get_string_at(H3270 *h, unsigned int row, unsigned
return lib3270_get_string_at_address(h, baddr, len, lf);
}
-LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, unsigned int row, unsigned int col, const char *text, char lf)
+LIB3270_EXPORT int lib3270_cmp_string_at(H3270 *h, unsigned int row, unsigned int col, const char *text, char lf)
{
int baddr = lib3270_translate_to_address(h,row,col);
if(baddr < 0)
return -1;
- return lib3270_cmp_text_at_address(h,baddr,text,lf);
+ return lib3270_cmp_string_at_address(h,baddr,text,lf);
}
- LIB3270_EXPORT int lib3270_cmp_text_at_address(H3270 *h, int baddr, const char *text, char lf)
+ LIB3270_EXPORT int lib3270_cmp_string_at_address(H3270 *h, int baddr, const char *text, char lf)
{
int rc;
size_t sz = strlen(text);
@@ -380,7 +380,7 @@ LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, unsigned int row, unsigned int
*
* @return String with the field contents (release it with lib3270_free()
*/
-LIB3270_EXPORT char * lib3270_get_field_text_at(H3270 *session, int baddr)
+LIB3270_EXPORT char * lib3270_get_field_string_at(H3270 *session, int baddr)
{
int first = lib3270_field_addr(session,baddr);
diff --git a/src/ssl/negotiate.c b/src/ssl/negotiate.c
index 24d342d..76add03 100644
--- a/src/ssl/negotiate.c
+++ b/src/ssl/negotiate.c
@@ -434,7 +434,7 @@ void ssl_info_callback(INFO_CONST SSL *s, int where, int ret)
#endif /*]*/
-int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const char *title, const char *summary, const char *body)
+int popup_ssl_error(H3270 GNUC_UNUSED(*hSession), int rc, const char GNUC_UNUSED(*title), const char *summary, const char *body)
{
#ifdef _WIN32
--
libgit2 0.21.2