Commit 39e75777f480d626de759a6a62bf57d3ef184a66

Authored by Perry Werneck
1 parent dc07439b

Adjustments on charset API.

src/core/charset/charset.c
... ... @@ -271,7 +271,11 @@ LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name)
271 271 }
272 272 }
273 273  
274   - return ENOENT;
  274 + return errno = EINVAL;
275 275  
276 276 }
277 277  
  278 +LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession)
  279 +{
  280 + return hSession->charset.host;
  281 +}
... ...
src/core/charset/getset.c
... ... @@ -53,8 +53,4 @@ LIB3270_EXPORT const char * lib3270_get_display_charset(const H3270 *hSession)
53 53 return hSession->charset.display ? hSession->charset.display : "ISO-8859-1";
54 54 }
55 55  
56   -LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession)
57   -{
58   - return hSession->charset.host;
59   -}
60 56  
... ...
src/include/lib3270/charset.h
... ... @@ -61,7 +61,19 @@
61 61 BOTH
62 62 } lib3270_remap_scope;
63 63  
  64 + /**
  65 + * @brief Set host charset.
  66 + *
  67 + * @param hSession Session Handle.
  68 + * @param name Charset name (us, bracket, cp500) or NULL to lib3270's default.
  69 + *
  70 + * @return 0 if ok, error code if not.
  71 + *
  72 + * @retval EINVAL Invalid charset name.
  73 + *
  74 + */
64 75 LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name);
  76 +
65 77 LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession);
66 78 LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid);
67 79  
... ... @@ -75,6 +87,8 @@
75 87 * @param id The character definition (id or 0x[code]).
76 88 *
77 89 * @return Character code if ok, 0 if not (sets errno).
  90 + *
  91 + * @retval EINVAL Invalid character id.
78 92 */
79 93 LIB3270_EXPORT unsigned short lib3270_translate_char(const char *id);
80 94  
... ...