diff --git a/src/core/ft/ft.c b/src/core/ft/ft.c index 2e64e4c..1abebc9 100644 --- a/src/core/ft/ft.c +++ b/src/core/ft/ft.c @@ -635,7 +635,8 @@ LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session) { return ((H3270FT *) session->ft)->state; } -LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args) { +LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) { + FAIL_IF_NOT_ONLINE(hSession); if(hSession->ft) @@ -644,7 +645,7 @@ LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *t return ENOTSUP; } -LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args) { +LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) { FAIL_IF_NOT_ONLINE(hSession); if(hSession->ft) diff --git a/src/core/linux/log.c b/src/core/linux/log.c index de9be14..697dd74 100644 --- a/src/core/linux/log.c +++ b/src/core/linux/log.c @@ -42,7 +42,7 @@ int use_syslog = 0; -int default_log_writer(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) { +int default_log_writer(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) { #ifdef HAVE_SYSLOG if(use_syslog) { syslog(LOG_INFO, "%s: %s", module, message); diff --git a/src/core/log.c b/src/core/log.c index 081963f..0eb65e8 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -120,9 +120,10 @@ LIB3270_EXPORT int lib3270_set_log_filename(H3270 * hSession, const char *filena } -LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER handler) { +LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER handler, void *userdata) { if(session) { session->log.handler = (handler ? handler : default_log_writer); + session->log.userdata = userdata; } else { loghandler = (handler ? handler : default_log_writer); } diff --git a/src/core/windows/log.c b/src/core/windows/log.c index f1c1213..4e0cf1b 100644 --- a/src/core/windows/log.c +++ b/src/core/windows/log.c @@ -41,9 +41,10 @@ /*---[ Implement ]------------------------------------------------------------------------------------------*/ -int default_log_writer(H3270 GNUC_UNUSED(*session), const char *module, int rc, const char *msg) { +int default_log_writer(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int rc, const char *msg) { if(hEventLog) { + lib3270_autoptr(char) username = lib3270_get_user_name(); const char *outMsg[] = { diff --git a/src/include/internals.h b/src/include/internals.h index b25e34a..e4e6e2b 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -740,7 +740,7 @@ LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr); LIB3270_INTERNAL unsigned char get_field_attribute(H3270 *session, int baddr); /// @brief Default log writer. -LIB3270_INTERNAL int default_log_writer(H3270 *session, void *dunno, const char *module, int rc, const char *message); +LIB3270_INTERNAL int default_log_writer(const H3270 *session, void *dunno, const char *module, int rc, const char *message); /// @brief The active log handler. LIB3270_INTERNAL LIB3270_LOG_HANDLER loghandler; diff --git a/src/include/lib3270/log.h b/src/include/lib3270/log.h index 04773c2..7e5d906 100644 --- a/src/include/lib3270/log.h +++ b/src/include/lib3270/log.h @@ -54,7 +54,7 @@ extern "C" { typedef int (*LIB3270_LOG_HANDLER)(const H3270 *, void *, const char *, int, const char *); -LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER loghandler); +LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER loghandler, void *userdata); LIB3270_EXPORT int lib3270_set_log_filename(H3270 * hSession, const char *name); LIB3270_EXPORT const char * lib3270_get_log_filename(const H3270 * hSession); -- libgit2 0.21.2