From 94a98b74d920f4eefea55c41fa0b047f27aaf854 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 5 Jan 2016 10:22:56 +0100 Subject: [PATCH] syslog --- config.m4 | 4 +++- m4/stdio.m4 | 18 +++++++++--------- m4/wchar.m4 | 8 ++++++-- psi.d/stdio.psi | 4 ++-- src/context.c | 3 +++ 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/config.m4 b/config.m4 index cce2aff..e0890da 100644 --- a/config.m4 +++ b/config.m4 @@ -29,6 +29,7 @@ if test "$PHP_PSI" != no; then [sys_types.m4], [sys_uio.m4], [sys_utsname.m4], + [syslog.m4], [time.m4], [wchar.m4]], [ dnl pecl build @@ -59,6 +60,7 @@ if test "$PHP_PSI" != no; then PSI_CHECK_SYS_STAT PSI_CHECK_SYS_UIO PSI_CHECK_SYS_UTSNAME + PSI_CHECK_SYSLOG PSI_CHECK_WCHAR PHP_SUBST(PSI_SHARED_LIBADD) @@ -72,7 +74,7 @@ if test "$PHP_PSI" != no; then AC_DEFINE_UNQUOTED([PSI_REDIRS], [$PSI_REDIRS], [Redirected functions]) AC_DEFINE_UNQUOTED([PSI_DECLS], [$PSI_DECLS], [Predefined functions]) AC_DEFINE_UNQUOTED([PSI_VA_DECLS], [$PSI_VA_DECLS], [Predefined vararg functions]) - + PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src) PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src) diff --git a/m4/stdio.m4 b/m4/stdio.m4 index 82aaa1b..7d601f5 100644 --- a/m4/stdio.m4 +++ b/m4/stdio.m4 @@ -71,13 +71,13 @@ AC_DEFUN(PSI_CHECK_STDIO, [ PSI_DECL(FILE *tmpfile, [(void)]) PSI_DECL(char *tmpnam, [(char *s)]) PSI_DECL(int ungetc, [(int c, FILE *stream)]) - - PSI_DECL(int dprintf, [(int fd, char *fmt)], vararg) - PSI_DECL(int fprintf, [(FILE *stream, char *fmt)], vararg) - PSI_DECL(int fscanf, [(FILE *stream, char *fmt)], vararg) - PSI_DECL(int printf, [(char *fmt)], vararg) - PSI_DECL(int scanf, [(char *fmt)], vararg) - PSI_DECL(int snprintf, [(char *str, size_t size, char *fmt)], vararg) - PSI_DECL(int sprintf, [(char *str, char *fmt)], vararg) - PSI_DECL(int sscanf, [(char *str, char *fmt)], vararg) + + PSI_DECL(int dprintf, [(int fd, char *format)], vararg) + PSI_DECL(int fprintf, [(FILE *stream, char *format)], vararg) + PSI_DECL(int fscanf, [(FILE *stream, char *format)], vararg) + PSI_DECL(int printf, [(char *format)], vararg) + PSI_DECL(int scanf, [(char *format)], vararg) + PSI_DECL(int snprintf, [(char *str, size_t size, char *format)], vararg) + PSI_DECL(int sprintf, [(char *str, char *format)], vararg) + PSI_DECL(int sscanf, [(char *str, char *format)], vararg) ]) diff --git a/m4/wchar.m4 b/m4/wchar.m4 index 97a0b9e..ebffee9 100644 --- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -1,9 +1,13 @@ AC_DEFUN(PSI_CHECK_WCHAR, [ AC_CHECK_HEADERS(wchar.h) - + PSI_TYPE(wint_t, int) - + PSI_CONST(WINT_MIN, int) PSI_CONST(WINT_MAX, int) PSI_CONST(WEOF, int) + + PSI_DECL(int wprintf, [(wchar_t *format)], vararg) + PSI_DECL(int fwprintf, [(FILE *stream, wchar_t *format)], vararg) + PSI_DECL(int swprintf, [(wchar_t *wcs, size_t maxlen, wchar_t *format)], vararg) ]) diff --git a/psi.d/stdio.psi b/psi.d/stdio.psi index 0741874..685d6c8 100644 --- a/psi.d/stdio.psi +++ b/psi.d/stdio.psi @@ -65,8 +65,8 @@ function psi\rewind(object $stream) : void { return void(rewind); } -//extern int printf(const char *fmt, ...); +//extern int printf(const char *format, ...); function psi\printf(string $fmt, mixed ...$args) : int { - let fmt = strval($fmt); + let format = strval($fmt); return to_int(printf); } diff --git a/src/context.c b/src/context.c index 3b5c734..64fce37 100644 --- a/src/context.c +++ b/src/context.c @@ -77,6 +77,9 @@ #ifdef HAVE_TIME_H # include #endif +#ifdef HAVE_SYSLOG_H +# include +#endif #ifdef HAVE_WCHAR_H # include #endif -- 2.30.2