adjust axtls level
[project/luci.git] / libs / nixio / src / syslog.c
index 081e836..89f1b1d 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "nixio.h"
 #include <string.h>
+
+#ifndef __WINNT__
 #include <syslog.h>
 
 
@@ -35,7 +37,9 @@ static int nixio_openlog(lua_State *L) {
                } else if (!strcmp(flag, "pid")) {
                        option |= LOG_PID;
                } else if (!strcmp(flag, "perror")) {
+#ifdef LOG_PERROR
                        option |= LOG_PERROR;
+#endif
                } else if (!strcmp(flag, "ndelay")) {
                        option |= LOG_NDELAY;
                } else if (!strcmp(flag, "odelay")) {
@@ -55,7 +59,7 @@ static int nixio_closelog(lua_State *L) {
        return 0;
 }
 
-static int nixio__syslogmasg(lua_State *L, int dolog) {
+static int nixio__syslogmask(lua_State *L, int dolog) {
        int priority;
 
        const char *flag = luaL_checkstring(L, 1);
@@ -82,7 +86,7 @@ static int nixio__syslogmasg(lua_State *L, int dolog) {
 
        if (dolog) {
                const char *msg = luaL_checkstring(L, 2);
-               syslog(priority, msg);
+               syslog(priority, "%s", msg);
        } else {
                setlogmask(LOG_UPTO(priority));
        }
@@ -90,11 +94,11 @@ static int nixio__syslogmasg(lua_State *L, int dolog) {
 }
 
 static int nixio_setlogmask(lua_State *L) {
-       return nixio__syslogmasg(L, 0);
+       return nixio__syslogmask(L, 0);
 }
 
 static int nixio_syslog(lua_State *L) {
-       return nixio__syslogmasg(L, 1);
+       return nixio__syslogmask(L, 1);
 }
 
 /* module table */
@@ -109,3 +113,10 @@ static const luaL_reg R[] = {
 void nixio_open_syslog(lua_State *L) {
        luaL_register(L, NULL, R);
 }
+
+#else /* __WINNT__ */
+
+void nixio_open_syslog(lua_State *L) {
+}
+
+#endif /* __WINNT__ */