Fix EBCDIC conversion for syslog()

This commit is contained in:
Howard Chu 2004-02-03 03:58:38 +00:00
parent 253f70e0c2
commit 9f3b0d60f9
2 changed files with 22 additions and 0 deletions

View File

@ -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 */

View File

@ -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