This patch modifies the UW-IMAP server so that it logs to STDERR instead of syslog. This is great when you run imapd under the tcpserver and cyclog programs instead of init. Get these programs from the daemontools and ucspi-tcp packages from: ftp://koobera.math.uic.edu/www/software.html You will have to tidy up the patch to src/osdep/unix/Makefile because this patch was made to apply on top of my multiple-accounts-in-a-single-uid patch for UW-IMAPD. But that should be really easy to do. Also, this patch only works for linux right now ("make lnp" and "make lnx", I think). to make it work for another operating system, port the changes I made to the src/osdep/unix/os_lnx.h OS specific header file to the appropriate file for your OS such as src/osdep/unix/os_sol.h. I just didn't see the need to change all 39 os_???.h files when I only really needed one changed. David Harris Mon Nov 22 1999 diff -rNu3 imap-4.6_syslog_orig/src/osdep/unix/Makefile imap-4.6_syslog_my/src/osdep/unix/Makefile --- imap-4.6_syslog_orig/src/osdep/unix/Makefile Fri Nov 5 23:33:39 1999 +++ imap-4.6_syslog_my/src/osdep/unix/Makefile Sat Nov 6 01:28:24 1999 @@ -104,7 +104,7 @@ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \ rfc822.o nntp.o smtp.o imap4r1.o pop3.o \ unix.o mbox.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o \ - vpop.o md5.o md5_crypt.o + vpop.o md5.o md5_crypt.o syslog_replace.o CFLAGS=$(BASECFLAGS) $(EXTRACFLAGS) MAKE=make MV=mv diff -rNu3 imap-4.6_syslog_orig/src/osdep/unix/os_lnx.h imap-4.6_syslog_my/src/osdep/unix/os_lnx.h --- imap-4.6_syslog_orig/src/osdep/unix/os_lnx.h Tue Apr 29 19:16:20 1997 +++ imap-4.6_syslog_my/src/osdep/unix/os_lnx.h Fri Nov 5 23:38:38 1999 @@ -42,6 +42,12 @@ #include #include +/* this replaces syslog with printing to stderr */ +#define openlog syslog_replace__openlog +#define syslog syslog_replace__syslog +#define closelog syslog_replace__closelog +#include "syslog_replace.h" + /* Linux gets this wrong */ diff -rNu3 imap-4.6_syslog_orig/src/osdep/unix/syslog_replace.c imap-4.6_syslog_my/src/osdep/unix/syslog_replace.c --- imap-4.6_syslog_orig/src/osdep/unix/syslog_replace.c Wed Dec 31 19:00:00 1969 +++ imap-4.6_syslog_my/src/osdep/unix/syslog_replace.c Sat Nov 6 01:50:04 1999 @@ -0,0 +1,45 @@ + +#define _GNU_SOURCE +#include +#include +#include +#include + +char* syslog_replace__ident = NULL; +int syslog_replace__pid = 0; + +void syslog_replace__openlog( char *ident, int option, int facility) +{ + if (option & LOG_PID) + syslog_replace__pid = (int) getpid(); + + if (ident) + syslog_replace__ident = ident; +} + +void syslog_replace__syslog( int priority, char *format, ...) +{ + char message[10002]; + va_list ap; + + va_start(ap, format); + vsnprintf(message, 10000, format, ap); + va_end(ap); + + if (syslog_replace__ident && syslog_replace__pid) + fprintf(stderr, "%s[%d]: %s\n", syslog_replace__ident, syslog_replace__pid, message); + + if (!syslog_replace__ident && syslog_replace__pid) + fprintf(stderr, "[%d]: %s\n", syslog_replace__pid, message); + + if (syslog_replace__ident && !syslog_replace__pid) + fprintf(stderr, "%s: %s\n", syslog_replace__ident, message); + + if (!syslog_replace__ident && !syslog_replace__pid) + fprintf(stderr, "%s\n", message); + +} + +void syslog_replace__closelog( void ) +{ +} diff -rNu3 imap-4.6_syslog_orig/src/osdep/unix/syslog_replace.h imap-4.6_syslog_my/src/osdep/unix/syslog_replace.h --- imap-4.6_syslog_orig/src/osdep/unix/syslog_replace.h Wed Dec 31 19:00:00 1969 +++ imap-4.6_syslog_my/src/osdep/unix/syslog_replace.h Sat Nov 6 01:27:36 1999 @@ -0,0 +1,5 @@ + +void syslog_replace__openlog( char *ident, int option, int facility); +void syslog_replace__syslog( int priority, char *format, ...); +void syslog_replace__closelog( void ); +