changeset 3725:cf8933dabc95 HEAD

Forgot to add in syslog_facility commit
author Timo Sirainen <tss@iki.fi>
date Sat, 03 Dec 2005 00:15:22 +0200
parents d22c883021da
children ad1e6b8a5109
files src/master/syslog-util.c src/master/syslog-util.h
diffstat 2 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/master/syslog-util.c	Sat Dec 03 00:15:22 2005 +0200
@@ -0,0 +1,43 @@
+/* Copyright (C) 2005 Timo Sirainen */
+
+#include "lib.h"
+#include "syslog-util.h"
+#include <syslog.h>
+
+struct syslog_facility_list syslog_facilities[] = {
+	{ "auth", LOG_AUTH },
+	{ "authpriv", LOG_AUTHPRIV },
+	{ "cron", LOG_CRON },
+	{ "daemon", LOG_DAEMON },
+	{ "ftp", LOG_FTP },
+	{ "kern", LOG_KERN },
+	{ "local0", LOG_LOCAL0 },
+	{ "local1", LOG_LOCAL1 },
+	{ "local2", LOG_LOCAL2 },
+	{ "local3", LOG_LOCAL3 },
+	{ "local4", LOG_LOCAL4 },
+	{ "local5", LOG_LOCAL5 },
+	{ "local6", LOG_LOCAL6 },
+	{ "local7", LOG_LOCAL7 },
+	{ "lpr", LOG_LPR },
+	{ "mail", LOG_MAIL },
+	{ "news", LOG_NEWS },
+	{ "syslog", LOG_SYSLOG },
+	{ "user", LOG_USER },
+	{ "uucp", LOG_UUCP },
+
+	{ NULL, 0 }
+};
+
+int syslog_facility_find(const char *name, int *facility_r)
+{
+	int i;
+
+	for (i = 0; syslog_facilities[i].name != NULL; i++) {
+		if (strcmp(syslog_facilities[i].name, name) == 0) {
+			*facility_r = syslog_facilities[i].facility;
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/master/syslog-util.h	Sat Dec 03 00:15:22 2005 +0200
@@ -0,0 +1,14 @@
+#ifndef __SYSLOG_UTIL_H
+#define __SYSLOG_UTIL_H
+
+struct syslog_facility_list {
+	const char *name;
+	int facility;
+};
+
+extern struct syslog_facility_list syslog_facilities[];
+
+/* Returns TRUE if found. */
+int syslog_facility_find(const char *name, int *facility_r);
+
+#endif