From 39e75777f480d626de759a6a62bf57d3ef184a66 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 8 Nov 2019 14:28:39 -0300 Subject: [PATCH] Adjustments on charset API. --- src/core/charset/charset.c | 6 +++++- src/core/charset/getset.c | 4 ---- src/include/lib3270/charset.h | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/core/charset/charset.c b/src/core/charset/charset.c index ab3252c..0e58084 100644 --- a/src/core/charset/charset.c +++ b/src/core/charset/charset.c @@ -271,7 +271,11 @@ LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name) } } - return ENOENT; + return errno = EINVAL; } +LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession) +{ + return hSession->charset.host; +} diff --git a/src/core/charset/getset.c b/src/core/charset/getset.c index d198eef..65b3de0 100644 --- a/src/core/charset/getset.c +++ b/src/core/charset/getset.c @@ -53,8 +53,4 @@ LIB3270_EXPORT const char * lib3270_get_display_charset(const H3270 *hSession) return hSession->charset.display ? hSession->charset.display : "ISO-8859-1"; } -LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession) -{ - return hSession->charset.host; -} diff --git a/src/include/lib3270/charset.h b/src/include/lib3270/charset.h index deeebf3..d8e005c 100644 --- a/src/include/lib3270/charset.h +++ b/src/include/lib3270/charset.h @@ -61,7 +61,19 @@ BOTH } lib3270_remap_scope; + /** + * @brief Set host charset. + * + * @param hSession Session Handle. + * @param name Charset name (us, bracket, cp500) or NULL to lib3270's default. + * + * @return 0 if ok, error code if not. + * + * @retval EINVAL Invalid charset name. + * + */ LIB3270_EXPORT int lib3270_set_host_charset(H3270 *hSession, const char *name); + LIB3270_EXPORT const char * lib3270_get_host_charset(const H3270 *hSession); LIB3270_EXPORT void lib3270_reset_charset(H3270 *hSession, const char * host, const char * display, unsigned long cgcsgid); @@ -75,6 +87,8 @@ * @param id The character definition (id or 0x[code]). * * @return Character code if ok, 0 if not (sets errno). + * + * @retval EINVAL Invalid character id. */ LIB3270_EXPORT unsigned short lib3270_translate_char(const char *id); -- libgit2 0.21.2