#include "nixio.h"
#include <string.h>
+
+#ifndef __WINNT__
#include <syslog.h>
} 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")) {
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);
if (dolog) {
const char *msg = luaL_checkstring(L, 2);
- syslog(priority, msg);
+ syslog(priority, "%s", msg);
} else {
setlogmask(LOG_UPTO(priority));
}
}
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 */
void nixio_open_syslog(lua_State *L) {
luaL_register(L, NULL, R);
}
+
+#else /* __WINNT__ */
+
+void nixio_open_syslog(lua_State *L) {
+}
+
+#endif /* __WINNT__ */