[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
router syslog
Hi,
I thought it would be useful to have syslog interface in
router. It works pretty much like logger(1) utility.
alexis
*** zmailer-2.99.49p10/router/functions.c Thu Nov 13 20:10:53 1997
--- zmailer/router/functions.c Tue Feb 24 15:02:58 1998
***************
*** 38,43 ****
--- 38,44 ----
#endif /* HAVE_DIRENT_H */
#include "zmsignal.h"
+ #include "zsyslog.h"
#include "mail.h"
#include "interpret.h"
#include "io.h"
***************
*** 86,91 ****
--- 87,93 ----
static int run_822syntax ARGCV;
static int run_dequote ARGCV;
static int run_condquote ARGCV;
+ static int run_syslog ARGCV;
#if defined(XMEM) && defined(CSRIMALLOC)
static int run_malcontents ARGCV;
***************
*** 137,142 ****
--- 139,146 ----
{ "rfc822syntax", run_822syntax, NULL, NULL, 0 },
{ "dequote", run_dequote, NULL, NULL, 0 },
{ "condquote", run_condquote, NULL, NULL, 0 },
+ { "syslog", run_syslog, NULL, NULL, 0 },
+ { "logger", run_syslog, NULL, NULL, 0 },
#if defined(XMEM) && defined(CSRIMALLOC)
{ "malcontents", run_malcontents,NULL, NULL, 0 },
#endif /* CSRIMALLOC */
***************
*** 2230,2235 ****
--- 2234,2285 ----
}
static int
+ run_syslog(argc, argv)
+ int argc;
+ const char *argv[];
+ {
+ int c;
+ int prio = LOG_INFO;
+ int errflg = 0;
+ optind = 1;
+
+ while ((c = getopt(argc, (char*const*)argv, "p:")) != EOF) {
+ switch (c) {
+ case 'p': /* priority */
+ if(!strcmp(optarg, "debug")) {
+ prio = LOG_DEBUG;
+ } else if(!strcmp(optarg, "info")) {
+ prio = LOG_INFO;
+ } else if(!strcmp(optarg, "notice")) {
+ prio = LOG_NOTICE;
+ } else if(!strcmp(optarg, "warning")) {
+ prio = LOG_WARNING;
+ } else if(!strcmp(optarg, "err")) {
+ prio = LOG_ERR;
+ } else if(!strcmp(optarg, "crit")) {
+ prio = LOG_CRIT;
+ } else if(!strcmp(optarg, "alert")) {
+ prio = LOG_ALERT;
+ } else if(!strcmp(optarg, "emerg")) {
+ prio = LOG_EMERG;
+ } else {
+ ++errflg;
+ }
+ break;
+ default:
+ ++errflg;
+ break;
+ }
+ }
+
+ if (errflg || optind != argc - 1) {
+ fprintf(stderr, "Usage: %s [-p prio] string\n", argv[0]);
+ return 1;
+ }
+ zsyslog((prio, "%s", argv[optind]));
+ }
+
+ static int
run_recase(argc, argv)
int argc;
const char *argv[];
--
You can't teach a new mouse old clicks
- Follow-Ups:
- Re: router syslog
- From: Matti Aarnio <matti.aarnio@tele.fi> (Tue, 24 Feb 1998 16:16:51 +0200)