]> Pileus Git - ~andy/fetchmail/commitdiff
Move some code.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 3 Nov 1998 06:41:13 +0000 (06:41 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 3 Nov 1998 06:41:13 +0000 (06:41 -0000)
svn path=/trunk/; revision=2170

driver.c
fetchmail.h
sink.c

index b1617fcacd616d84dad85a59222accb361487a5c..e3d18a50c59f481c428fa00fe02474d11acb090c 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -1206,63 +1206,6 @@ static void clean_skipped_list(struct idlist **skipped_list)
     *skipped_list = head;
 }
 
-static open_warning_by_mail(struct query *ctl)
-/* set up output sink for a mailed warning to calling user */
-{
-    int        good, bad;
-
-    /*
-     * We give a null address list as arg 3 because we actually *want*
-     * this message to go to run.postmaster.  The zero length arg 4 means
-     * we won't pass a SIZE option to ESMTP; the message length would
-     * be more trouble than it's worth to compute.
-     */
-    return(open_sink(ctl, "FETCHMAIL-DAEMON", NULL, 0, &good, &bad));
-}
-
-#if defined(HAVE_STDARG_H)
-void stuff_warning_line(struct query *ctl, const char *fmt, ... )
-#else
-void stuff_warning_line(struct query *ctl, fmt, va_alist)
-struct query *ctl;
-const char *fmt;       /* printf-style format */
-va_dcl
-#endif
-/* format and ship a warning message line by mail */
-{
-    char       buf[POPBUFSIZE];
-    va_list ap;
-
-    /*
-     * stuffline() requires its input to be writeable (for CR stripping),
-     * so we needed to copy the message to a writeable buffer anyway in
-     * case it was a string constant.  We make a virtue of that necessity
-     * here by supporting stdargs/varargs.
-     */
-#if defined(HAVE_STDARG_H)
-    va_start(ap, fmt) ;
-#else
-    va_start(ap);
-#endif
-#ifdef HAVE_VSNPRINTF
-    vsnprintf(buf, sizeof(buf), fmt, ap);
-#else
-    vsprintf(buf, fmt, ap);
-#endif
-    va_end(ap);
-
-    strcat(buf, "\r\n");
-
-    stuffline(ctl, buf);
-}
-
-static close_warning_by_mail(struct query *ctl)
-/* sign and send mailed warnings */
-{
-    stuff_warning_line(ctl, "--\r\n\t\t\t\tThe Fetchmail Daemon\r\n");
-    close_sink(ctl, TRUE);
-}
-
 static void send_size_warnings(struct query *ctl)
 /* send warning mail with skipped msg; reset msg count when user notified */
 {
index 721a4b8a733383074ec19bc0cae7b29f3f541617..c0550202df696cb457679cbb85257bce8a7257b9 100644 (file)
@@ -364,6 +364,13 @@ int stuffline(struct query *, char *);
 int open_sink(struct query*, const char*, struct idlist*, long reallen, int*, int*);
 void release_sink(struct query *);
 int close_sink(struct query *, flag);
+int open_warning_by_mail(struct query *);
+#if defined(HAVE_STDARG_H)
+void stuff_warning_line(struct query *, const char *, ... );
+#else
+void stuff_warning_line();
+#endif
+void close_warning_by_mail(struct query *);
 
 /* rfc822.c: RFC822 header parsing */
 char *reply_hack(char *, const char *);
diff --git a/sink.c b/sink.c
index 17e6406c58ea2a87ec79579a153d78304187916c..d802e4931ec6239337308c515e51b55e07757864 100644 (file)
--- a/sink.c
+++ b/sink.c
 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>
 #endif
+#if defined(HAVE_STDARG_H)
+#include  <stdarg.h>
+#else
+#include  <varargs.h>
+#endif
 
 #include  "fetchmail.h"
 #include  "socket.h"
@@ -684,4 +689,61 @@ int close_sink(struct query *ctl, flag forward)
     return(TRUE);
 }
 
+int open_warning_by_mail(struct query *ctl)
+/* set up output sink for a mailed warning to calling user */
+{
+    int        good, bad;
+
+    /*
+     * We give a null address list as arg 3 because we actually *want*
+     * this message to go to run.postmaster.  The zero length arg 4 means
+     * we won't pass a SIZE option to ESMTP; the message length would
+     * be more trouble than it's worth to compute.
+     */
+    return(open_sink(ctl, "FETCHMAIL-DAEMON", NULL, 0, &good, &bad));
+}
+
+#if defined(HAVE_STDARG_H)
+void stuff_warning_line(struct query *ctl, const char *fmt, ... )
+#else
+void stuff_warning_line(struct query *ctl, fmt, va_alist)
+struct query *ctl;
+const char *fmt;       /* printf-style format */
+va_dcl
+#endif
+/* format and ship a warning message line by mail */
+{
+    char       buf[POPBUFSIZE];
+    va_list ap;
+
+    /*
+     * stuffline() requires its input to be writeable (for CR stripping),
+     * so we needed to copy the message to a writeable buffer anyway in
+     * case it was a string constant.  We make a virtue of that necessity
+     * here by supporting stdargs/varargs.
+     */
+#if defined(HAVE_STDARG_H)
+    va_start(ap, fmt) ;
+#else
+    va_start(ap);
+#endif
+#ifdef HAVE_VSNPRINTF
+    vsnprintf(buf, sizeof(buf), fmt, ap);
+#else
+    vsprintf(buf, fmt, ap);
+#endif
+    va_end(ap);
+
+    strcat(buf, "\r\n");
+
+    stuffline(ctl, buf);
+}
+
+void close_warning_by_mail(struct query *ctl)
+/* sign and send mailed warnings */
+{
+    stuff_warning_line(ctl, "--\r\n\t\t\t\tThe Fetchmail Daemon\r\n");
+    close_sink(ctl, TRUE);
+}
+
 /* sink.c ends here */