diff -u -P ./Makefile new/Makefile
--- ./Makefile	Wed Nov 19 08:27:17 1997
+++ new/Makefile	Wed Nov 19 08:55:24 1997
@@ -718,10 +718,10 @@
 qmail-clean qmail-send qmail-start splogger qmail-queue qmail-inject \
 predate datemail mailsubj qmail-upq qmail-config qmail-showctl \
 qmail-newu qmail-pw2u qmail-qread qmail-qstat qmail-tcpto qmail-pop3d \
-qmail-popup qmail-qmtpd qmail-smtpd sendmail tcp-env dnscname dnsptr \
-dnsip dnsmxip dnsfq hostname ipmeprint qlist qlist2 qreceipt qsmhook \
-qbiff forward preline condredirect maildirmake maildir2mbox \
-maildirwatch qail elq pinq qmail-hier install instcheck
+qmail-popbull qmail-popup qmail-qmtpd qmail-smtpd sendmail tcp-env \
+dnscname dnsptr dnsip dnsmxip dnsfq hostname ipmeprint qlist qlist2 \
+qreceipt qsmhook qbiff forward preline condredirect maildirmake \
+maildir2mbox maildirwatch qail elq pinq qmail-hier install instcheck
 
 load: \
 make-load warn-auto.sh systype
@@ -857,7 +857,7 @@
 qmail-rspawn.0 qmail-clean.0 qmail-send.0 qmail-start.0 splogger.0 \
 qmail-queue.0 qmail-inject.0 mailsubj.0 qmail-showctl.0 qmail-newu.0 \
 qmail-pw2u.0 qmail-qread.0 qmail-qstat.0 qmail-tcpto.0 qmail-pop3d.0 \
-qmail-popup.0 qmail-qmtpd.0 qmail-smtpd.0 tcp-env.0 qlist.0 \
+qmail-popbull.0 qmail-popup.0 qmail-qmtpd.0 qmail-smtpd.0 tcp-env.0 qlist.0 \
 qreceipt.0 qbiff.0 forward.0 preline.0 condredirect.0 maildirmake.0 \
 maildir2mbox.0 maildirwatch.0 qmail.0 qmail-upgrade.0 qmail-limits.0 \
 qmail-log.0 qmail-control.0 qmail-header.0 qmail-users.0 dot-qmail.0 \
@@ -1271,6 +1271,18 @@
 qmail-pop3d.c readwrite.h qmail-pop3d.c
 	./compile qmail-pop3d.c
 
+qmail-popbull: \
+load qmail-popbull.o now.o substdio.a stralloc.a alloc.a str.a error.a
+	./load qmail-popbull now.o substdio.a stralloc.a alloc.a fs.a str.a error.a
+
+qmail-popbull.0: \
+qmail-popbull.8
+	nroff -man qmail-popbull.8 > qmail-popbull.0
+
+qmail-popbull.o: \
+compile qmail-popbull.c direntry.h substdio.h stralloc.h fmt.h str.h
+	./compile qmail-popbull.c
+
 qmail-popup: \
 load qmail-popup.o now.o fd.a sig.a wait.a getln.a stralloc.a alloc.a \
 substdio.a error.a str.a fs.a
@@ -1771,54 +1783,54 @@
 mbox.5 preline.1 qbiff.1 qlist.1 qmail-clean.8 qmail-command.8 \
 qmail-control.5 qmail-getpw.9 qmail-header.5 qmail-inject.8 \
 qmail-limits.9 qmail-local.8 qmail-log.5 qmail-lspawn.8 qmail-newu.8 \
-qmail-pop3d.8 qmail-popup.8 qmail-pw2u.9 qmail-qmtpd.8 qmail-qread.8 \
-qmail-qstat.8 qmail-queue.8 qmail-remote.8 qmail-rspawn.8 \
-qmail-send.9 qmail-showctl.8 qmail-smtpd.8 qmail-start.8 \
-qmail-tcpto.8 qmail-upgrade.9 qmail-users.5 qmail.7 qreceipt.1 \
-splogger.8 tcp-env.1 qmail-clean.c qmail-config.sh qmail-getpw.c \
-qmail-hier.c qmail-inject.c qmail-local.c qmail-lspawn.c qmail-newu.c \
-qmail-pop3d.c qmail-popup.c qmail-pw2u.c qmail-qmtpd.c qmail-qread.c \
-qmail-qstat.sh qmail-queue.c qmail-remote.c qmail-rspawn.c \
-qmail-send.c qmail-showctl.c qmail-smtpd.c qmail-start.c \
-qmail-tcpto.c spawn.c dnscname.c dnsfq.c dnsip.c dnsmxip.c dnsptr.c \
-hostname.c ipmeprint.c tcp-env.c sendmail.c qlist.c qreceipt.c \
-qsmhook.c qbiff.c forward.c preline.c predate.c condredirect.c \
-maildirmake.c maildir2mbox.c maildirwatch.c splogger.c qail.sh elq.sh \
-pinq.sh qlist2.sh qmail-upq.sh datemail.sh mailsubj.sh qlx.h \
-constmap.h constmap.c dnsdoe.h dnsdoe.c fmtqfn.h fmtqfn.c gfrom.h \
-gfrom.c myctime.h myctime.c newfield.h newfield.c qsutil.h qsutil.c \
-readsubdir.h readsubdir.c received.h received.c tcpto.h tcpto.c \
-tcpto_clean.c trigger.h trigger.c triggerpull.h triggerpull.c \
-trynpbg1.c trysyslog.c conf-cc conf-ld find-systype.sh \
-make-compile.sh make-load.sh make-makelib.sh trycpp.c warn-auto.sh \
-auto-str.c auto-int.c auto-int8.c auto-gid.c auto-uid.c install.c \
-instcheck.c alloc.3 alloc.h alloc.c alloc_re.c case.3 case.h \
-case_diffb.c case_diffs.c case_lowerb.c case_lowers.c case_starts.c \
-cdb.3 cdb.h cdb_hash.c cdb_seek.c cdb_unpack.c cdbmake.h \
-cdbmake_add.c cdbmake_hash.c cdbmake_pack.c cdbmss.h cdbmss.c coe.3 \
-coe.h coe.c fd.h fd_copy.3 fd_copy.c fd_move.3 fd_move.c fifo_make.3 \
-fifo.h fifo.c trymkffo.c fork.h1 fork.h2 tryvfork.c now.3 now.h now.c \
-open.h open_append.c open_excl.c open_read.c open_trunc.c \
-open_write.c seek.h seek_cur.c seek_end.c seek_set.c seek_trunc.c \
-conf-qmail auto_qmail.h qmail.h qmail.c gen_alloc.h gen_allocdefs.h \
-stralloc.3 stralloc.h stralloc_eady.c stralloc_pend.c stralloc_copy.c \
-stralloc_opyb.c stralloc_opys.c stralloc_cat.c stralloc_catb.c \
-stralloc_cats.c stralloc_arts.c strerr.h strerr_sys.c strerr_die.c \
-substdio.h substdio.c substdi.c substdo.c substdio_copy.c subfd.h \
-subfderr.c subfdouts.c subfdout.c subfdins.c subfdin.c readwrite.h \
-exit.h timeoutconn.h timeoutconn.c timeoutread.h timeoutread.c \
-timeoutwrite.h timeoutwrite.c remoteinfo.h remoteinfo.c uint32.h1 \
-uint32.h2 tryulong32.c wait.3 wait.h wait_pid.c wait_nohang.c \
-trywaitp.c sig.h sig_alarm.c sig_block.c sig_catch.c sig_pause.c \
-sig_pipe.c sig_child.c sig_term.c sig_hup.c sig_misc.c sig_bug.c \
-trysgact.c trysgprm.c env.3 env.h env.c envread.c byte.h byte_chr.c \
-byte_copy.c byte_cr.c byte_diff.c byte_rchr.c byte_zero.c str.h \
-str_chr.c str_cpy.c str_diff.c str_diffn.c str_len.c str_rchr.c \
-str_start.c lock.h lock_ex.c lock_exnb.c lock_un.c tryflock.c getln.3 \
-getln.h getln.c getln2.3 getln2.c sgetopt.3 sgetopt.h sgetopt.c \
-subgetopt.3 subgetopt.h subgetopt.c error.3 error_str.3 error_temp.3 \
-error.h error.c error_str.c error_temp.c fmt.h fmt_str.c fmt_strn.c \
-fmt_uint.c fmt_uint0.c fmt_ulong.c scan.h scan_ulong.c scan_8long.c \
+qmail-pop3d.8 qmail-popbull.8 qmail-popup.8 qmail-pw2u.9 qmail-qmtpd.8 \
+qmail-qread.8 qmail-qstat.8 qmail-queue.8 qmail-remote.8 \
+qmail-rspawn.8 qmail-send.9 qmail-showctl.8 qmail-smtpd.8 \
+qmail-start.8 qmail-tcpto.8 qmail-upgrade.9 qmail-users.5 qmail.7 \
+qreceipt.1 splogger.8 tcp-env.1 qmail-clean.c qmail-config.sh \
+qmail-getpw.c qmail-hier.c qmail-inject.c qmail-local.c qmail-lspawn.c \
+qmail-newu.c qmail-pop3d.c qmail-popbull.c qmail-popup.c qmail-pw2u.c \
+qmail-qmtpd.c qmail-qread.c qmail-qstat.sh qmail-queue.c \
+qmail-remote.c qmail-rspawn.c qmail-send.c qmail-showctl.c \
+qmail-smtpd.c qmail-start.c qmail-tcpto.c spawn.c dnscname.c dnsfq.c \
+dnsip.c dnsmxip.c dnsptr.c hostname.c ipmeprint.c tcp-env.c sendmail.c \
+qlist.c qreceipt.c qsmhook.c qbiff.c forward.c preline.c predate.c \
+condredirect.c maildirmake.c maildir2mbox.c maildirwatch.c splogger.c \
+qail.sh elq.sh pinq.sh qlist2.sh qmail-upq.sh datemail.sh mailsubj.sh \
+qlx.h constmap.h constmap.c dnsdoe.h dnsdoe.c fmtqfn.h fmtqfn.c \
+gfrom.h gfrom.c myctime.h myctime.c newfield.h newfield.c qsutil.h \
+qsutil.c readsubdir.h readsubdir.c received.h received.c tcpto.h \
+tcpto.c tcpto_clean.c trigger.h trigger.c triggerpull.h triggerpull.c \
+trynpbg1.c trysyslog.c conf-cc conf-ld find-systype.sh make-compile.sh \
+make-load.sh make-makelib.sh trycpp.c warn-auto.sh auto-str.c \
+auto-int.c auto-int8.c auto-gid.c auto-uid.c install.c instcheck.c \
+alloc.3 alloc.h alloc.c alloc_re.c case.3 case.h case_diffb.c \
+case_diffs.c case_lowerb.c case_lowers.c case_starts.c cdb.3 cdb.h \
+cdb_hash.c cdb_seek.c cdb_unpack.c cdbmake.h cdbmake_add.c \
+cdbmake_hash.c cdbmake_pack.c cdbmss.h cdbmss.c coe.3 coe.h coe.c fd.h \
+fd_copy.3 fd_copy.c fd_move.3 fd_move.c fifo_make.3 fifo.h fifo.c \
+trymkffo.c fork.h1 fork.h2 tryvfork.c now.3 now.h now.c open.h \
+open_append.c open_excl.c open_read.c open_trunc.c open_write.c seek.h \
+seek_cur.c seek_end.c seek_set.c seek_trunc.c conf-qmail auto_qmail.h \
+qmail.h qmail.c gen_alloc.h gen_allocdefs.h stralloc.3 stralloc.h \
+stralloc_eady.c stralloc_pend.c stralloc_copy.c stralloc_opyb.c \
+stralloc_opys.c stralloc_cat.c stralloc_catb.c stralloc_cats.c \
+stralloc_arts.c strerr.h strerr_sys.c strerr_die.c substdio.h \
+substdio.c substdi.c substdo.c substdio_copy.c subfd.h subfderr.c \
+subfdouts.c subfdout.c subfdins.c subfdin.c readwrite.h exit.h \
+timeoutconn.h timeoutconn.c timeoutread.h timeoutread.c timeoutwrite.h \
+timeoutwrite.c remoteinfo.h remoteinfo.c uint32.h1 uint32.h2 \
+tryulong32.c wait.3 wait.h wait_pid.c wait_nohang.c trywaitp.c sig.h \
+sig_alarm.c sig_block.c sig_catch.c sig_pause.c sig_pipe.c sig_child.c \
+sig_term.c sig_hup.c sig_misc.c sig_bug.c trysgact.c trysgprm.c env.3 \
+env.h env.c envread.c byte.h byte_chr.c byte_copy.c byte_cr.c \
+byte_diff.c byte_rchr.c byte_zero.c str.h str_chr.c str_cpy.c \
+str_diff.c str_diffn.c str_len.c str_rchr.c str_start.c lock.h \
+lock_ex.c lock_exnb.c lock_un.c tryflock.c getln.3 getln.h getln.c \
+getln2.3 getln2.c sgetopt.3 sgetopt.h sgetopt.c subgetopt.3 \
+subgetopt.h subgetopt.c error.3 error_str.3 error_temp.3 error.h \
+error.c error_str.c error_temp.c fmt.h fmt_str.c fmt_strn.c fmt_uint.c \
+fmt_uint0.c fmt_ulong.c scan.h scan_ulong.c scan_8long.c \
 scan_nbblong.c slurpclose.h slurpclose.c quote.h quote.c hfield.h \
 hfield.c headerbody.h headerbody.c token822.h token822.c control.h \
 control.c datetime.3 datetime.h datetime.c datetime_un.c prioq.h \
diff -u -P ./qmail-popbull.8 new/qmail-popbull.8
--- ./qmail-popbull.8	Wed Dec 31 19:00:00 1969
+++ new/qmail-popbull.8	Wed Nov 19 08:53:24 1997
@@ -0,0 +1,50 @@
+.TH qmail-popbull 8
+.SH NAME
+qmail-popbull \- insert bulletins
+.SH SYNOPSIS
+.B qmail-popbull
+.I bulletin-directory
+.I pop3d-program
+.I Maildir
+.SH DESCRIPTION
+.B qmail-popbull
+examines a directory of bulletins whenever a user checks their pop3 mail.
+When a new bulletin is seen, it inserts the bulletin into the user's
+.I Maildir .
+
+It compares the time on the
+.I Maildir 's
+.B cur
+directory and compares it to the time on the bulletin.  If the bulletin
+is newer,
+.B qmail-popbull
+inserts a symlink to the bulletin into the user's Maildir/new directory.
+The bulletin should be an ordinary email message.  One reasonable use
+of
+.B qmail-popbull
+is to point it to the
+.B new
+directory of a special user's Maildir.  When you send that user mail,
+it becomes a bulletin.
+
+When it is finished, it execs the
+.I pop3d-program
+with the remainder of its arguments as arguments to
+.I pop3d-program .
+
+.I pop3d-program
+can be any program, but that program's first argument must be the user's
+.I Maildir .
+
+Suggested invocation:
+.EX
+   qmail-popup YOURHOST /bin/checkpassword /var/qmail/bin/qmail-popbull
+.br
+   /var/spool/bulletins /var/qmail/bin/qmail-pop3d Maildir
+.br
+   (all on one line)
+.EE
+
+.SH "SEE ALSO"
+qmail-popup(8),
+qmail-pop3d(8)
diff -u -P ./qmail-popbull.c new/qmail-popbull.c
--- ./qmail-popbull.c	Wed Dec 31 19:00:00 1969
+++ new/qmail-popbull.c	Wed Nov 19 08:40:07 1997
@@ -0,0 +1,108 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "direntry.h"
+#include "substdio.h"
+#include "stralloc.h"
+#include "subfd.h"
+#include "fmt.h"
+#include "error.h"
+#include "datetime.h"
+#include "now.h"
+#include "str.h"
+
+void die() { _exit(100); }
+void die_temp() { _exit(111); }
+void die_usage() {
+ substdio_putsflush(subfderr,"qmail-popbull: usage: qmail-popbull bulldir pop3d maildir\n"); die_temp(); }
+void die_nobulldir() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: unable to read bulldir\n"); die_temp(); }
+void die_nomaildir() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: unable to write to maildir\n"); die_temp(); }
+void die_nomem() {
+ substdio_putsflush(subfderr,"qmail-popbull: fatal: out of memory\n"); die_temp(); }
+
+stralloc cur_name = {0};
+stralloc fn = {0};
+stralloc fn2 = {0};
+char fntmptph[80 + FMT_ULONG * 2];
+
+void fnmake_maildir(dir)
+char *dir; 
+{  
+ unsigned long pid;
+ unsigned long time;
+ char host[64];
+ char *s;
+ int loop;
+ struct stat st; 
+ int fd; 
+ 
+ pid = getpid();
+ host[0] = 0;
+ gethostname(host,sizeof(host));
+ for (loop = 0;;++loop)
+  {
+   time = now();
+   s = fntmptph;
+   s += fmt_str(s,"new/");
+   s += fmt_ulong(s,time); *s++ = '.';
+   s += fmt_ulong(s,pid); *s++ = '.';
+   s += fmt_strn(s,host,sizeof(host)); *s++ = 0;
+   if (stat(fntmptph,&st) == -1) if (errno == error_noent) break;
+   /* really should never get to this point */
+   if (loop == 2) _exit(1);
+   sleep(2);  
+  }  
+}
+
+
+void main(argc,argv)
+int argc;
+char **argv;
+{
+ int fd;
+ struct stat st;
+ datetime_sec cur_date;
+ char *bulldirname;
+ char *programname;
+ char *maildirname;
+ DIR *bulldir;
+ direntry *d;
+ char **childargs;
+
+ if (!(bulldirname = argv[1])) die_usage();
+ if (!(programname = argv[2])) die_usage();
+ if (!(maildirname = argv[3])) die_usage();
+
+ if (!stralloc_copys(&cur_name, maildirname)) die_nomem();
+ if (!stralloc_cats(&cur_name, "/cur")) die_nomem();
+ if (!stralloc_0(&cur_name)) die_nomem();
+
+ if (stat(cur_name.s, &st) == -1) die_nomaildir();
+ cur_date = st.st_atime;
+ 
+ bulldir = opendir(bulldirname);
+ if (!bulldir) die_nobulldir();
+ while(d = readdir(bulldir))
+  {
+   if (str_equal(d->d_name,".")) continue;
+   if (str_equal(d->d_name,"..")) continue;
+   if (!stralloc_copys(&fn, bulldirname)) die_nomem();
+   if (!stralloc_cats(&fn, "/")) die_nomem();
+   if (!stralloc_cats(&fn, d->d_name)) die_nomem();
+   if (!stralloc_0(&fn)) die_nomem();
+   if (stat(fn.s, &st) == -1) die();
+   if (st.st_mtime > cur_date)
+    {
+     fnmake_maildir();
+     if (!stralloc_copys(&fn2, maildirname)) die_nomem();
+     if (!stralloc_cats(&fn2, "/")) die_nomem();
+     if (!stralloc_cats(&fn2, fntmptph)) die_nomem();
+     if (!stralloc_0(&fn2)) die_nomem();
+     symlink(fn.s, fn2.s);
+    }
+  }
+  closedir(bulldir);
+  childargs = argv + 2;
+  execvp(*childargs,childargs);
+}

