From: Howard Chu Date: Tue, 3 Feb 2004 03:58:38 +0000 (+0000) Subject: Fix EBCDIC conversion for syslog() X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~439 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9f3b0d60f95d6c3fbbc6fe8c0e1d6472b1b5524f;p=openldap Fix EBCDIC conversion for syslog() --- diff --git a/include/ldap_log.h b/include/ldap_log.h index 7f1d6c7e86..d053bdf78d 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -114,6 +114,12 @@ LDAP_BEGIN_DECL # ifdef LDAP_SYSLOG extern int ldap_syslog; extern int ldap_syslog_level; + +# ifdef HAVE_EBCDIC +# define syslog eb_syslog + extern void eb_syslog(int pri, const char *fmt, ...); +# endif + # endif /* LDAP_SYSLOG */ /* this doesn't below as part of ldap.h */ diff --git a/libraries/liblber/debug.c b/libraries/liblber/debug.c index caaa49312b..042627f56a 100644 --- a/libraries/liblber/debug.c +++ b/libraries/liblber/debug.c @@ -302,3 +302,19 @@ void (lutil_debug)( int debug, int level, const char *fmt, ... ) fputs( buffer, stderr ); va_end( vl ); } + +#if defined(HAVE_EBCDIC) && defined(LDAP_SYSLOG) +void eb_syslog( int pri, const char *fmt, ... ) +{ + char buffer[4096]; + va_list vl; + + va_start( vl, fmt ); + vsnprintf( buffer, sizeof(buffer), fmt, vl ); + buffer[sizeof(buffer)-1] = '\0'; + + __atoe(buffer); + syslog( pri, "%s", buffer ); + va_end( vl ); +} +#endif