diff --git a/programs/.gitignore b/programs/.gitignore index 27055b829..05fb0b621 100644 --- a/programs/.gitignore +++ b/programs/.gitignore @@ -49,6 +49,7 @@ test/ssl_cert_test test/udp_proxy util/pem2der util/strerror +util/syslog2stderr.so x509/cert_app x509/cert_req x509/crl_app diff --git a/programs/Makefile b/programs/Makefile index 443689b1b..163059b54 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -277,6 +277,12 @@ x509/req_app$(EXEXT): x509/req_app.c $(DEP) echo " CC x509/req_app.c" $(CC) $(LOCAL_CFLAGS) $(CFLAGS) x509/req_app.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ +ifndef WINDOWS +util/syslog2stderr.so: util/syslog2stderr.c + echo " CC util/syslog2stderr.c" + $(CC) $(CFLAGS) -fPIC -shared -o $@ $< -ldl +endif + clean: ifndef WINDOWS rm -f $(APPS) diff --git a/programs/util/syslog2stderr.c b/programs/util/syslog2stderr.c new file mode 100644 index 000000000..6a636ecd8 --- /dev/null +++ b/programs/util/syslog2stderr.c @@ -0,0 +1,41 @@ +#include +#include +#include +#include +#include +#include + + +void openlog( const char *ident, int option, int facility ) +{ + (void) ident; + (void) option; + (void) facility; +} + +/* POSIX API */ +void syslog( int priority, const char *format, ... ) +{ + va_list args; + va_start( args, format ); + vfprintf( stderr, format, args ); + va_end( args ); +} + +/* Linux ABI + * http://refspecs.linux-foundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---syslog-chk-1.html + */ +void __syslog_chk( int priority, int flag, const char *format, ... ) +{ + va_list args; + (int) flag; + va_start( args, format ); + vfprintf( stderr, format, args ); + fputc( '\n', stderr ); + va_end( args ); +} + +void closelog( void ) +{ + /* no-op */ +}