Commit 22a5863afda2aec2bfe0a8b7c889302599ab0241

Authored by Perry Werneck
1 parent ccc8d3e1

Fixing errno use in "has_selection" attribute.

src/include/lib3270.h
@@ -1066,7 +1066,7 @@ @@ -1066,7 +1066,7 @@
1066 LIB3270_EXPORT const char * lib3270_get_default_charset(void); 1066 LIB3270_EXPORT const char * lib3270_get_default_charset(void);
1067 1067
1068 /** 1068 /**
1069 - * Get selected area. 1069 + * @brief Get selected area.
1070 * 1070 *
1071 * @param h Session Handle. 1071 * @param h Session Handle.
1072 * 1072 *
@@ -1077,6 +1077,14 @@ @@ -1077,6 +1077,14 @@
1077 1077
1078 LIB3270_EXPORT char * lib3270_cut_selected(H3270 *hSession); 1078 LIB3270_EXPORT char * lib3270_cut_selected(H3270 *hSession);
1079 1079
  1080 + /**
  1081 + * @brief Check if the terminal has selected area (allways sets errno).
  1082 + *
  1083 + * @param hSession Session handle.
  1084 + *
  1085 + * @return Non zero if the terminal has selected area, 0 if not.
  1086 + *
  1087 + */
1080 LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession); 1088 LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession);
1081 1089
1082 /** 1090 /**
src/selection/selection.c
@@ -392,10 +392,11 @@ LIB3270_EXPORT char * lib3270_get_field_string_at(H3270 *session, int baddr) @@ -392,10 +392,11 @@ LIB3270_EXPORT char * lib3270_get_field_string_at(H3270 *session, int baddr)
392 392
393 LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession) 393 LIB3270_EXPORT int lib3270_has_selection(const H3270 *hSession)
394 { 394 {
  395 + errno = 0;
395 if(check_online_session(hSession)) 396 if(check_online_session(hSession))
396 return 0; 397 return 0;
397 398
398 - return hSession->selected != 0; 399 + return (hSession->selected != 0);
399 } 400 }
400 401
401 LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *row, unsigned int *col, unsigned int *width, unsigned int *height) 402 LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *row, unsigned int *col, unsigned int *width, unsigned int *height)