diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 741276a..fa2ac3e 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -935,6 +935,13 @@ LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0); /** + * @brief Check if the screen position is unprotected. + * + */ + LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr0); + + + /** * Get address of the first blank. * * Get address of the first blank after the last nonblank in the diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c index 7a8bb07..64a6f4a 100644 --- a/src/lib3270/ctlr.c +++ b/src/lib3270/ctlr.c @@ -612,6 +612,19 @@ LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0) return 0; } +LIB3270_EXPORT int lib3270_get_is_protected(H3270 *hSession, int baddr) +{ + CHECK_SESSION_HANDLE(hSession); + + if(baddr < 0) + baddr = hSession->cursor_addr; + + int faddr = find_field_attribute(hSession,baddr); + + return FA_IS_PROTECTED(hSession->ea_buf[faddr].fa); +} + + /** * Perform an erase command, which may include changing the (virtual) screen size. * -- libgit2 0.21.2