]> git.sur5r.net Git - openldap/commitdiff
Fix EBCDIC conversion for syslog()
authorHoward Chu <hyc@openldap.org>
Tue, 3 Feb 2004 03:58:38 +0000 (03:58 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 3 Feb 2004 03:58:38 +0000 (03:58 +0000)
include/ldap_log.h
libraries/liblber/debug.c

index 7f1d6c7e86554c2f961c7c3a89de53184d0fce7c..d053bdf78dee143426145b5203ab35b3438fda88 100644 (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 */
index caaa49312b3fe5631139592d27613570b4a39b61..042627f56a06d526042c46244407822352d105a5 100644 (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