[comp.unix.xenix] Summary: How I replaced Xenix rmail.

tony@oha.UUCP (Tony Olekshy) (06/06/90)

First, I obtained and installed pathalias (version 9, from volume 12 of
comp.sources.unix), smail (version 2.5, shown as smail3 in volume 11 of
comp.sources.unix), and deliver (version 2.0 from volume 20 of
comp.sources.unix, patched - with help - to level 11 from comp.sources.bugs).

The installation of pathalias was uneventful, I set Xenix stuff in config.h
and told Makefile not to use DBM.

I set up the smail defs.h to non-BSD, non-sendmail, HOSTNAME = "oha", adjusted
the path names as appropriate, and turned on LOG.  I defined RMAIL to not use
-a, and pointed the non-BSD LMAIL to the deliver binary.  I also set QUEUECOST
to 205 to make non-toll calls queue immediately.  I modified the Makefile to
install things where I wanted them.  Smail had a couple warnings from cc,
which I cheerfully ignored.

I set up the deliver config.h to define USG, set signal type to int, define
SETVBUF_TYPE_BUF, added the local bin directory to SAFEPATH, set the MBX_MODE
to 0600 and MBX_GROUP to "mail", and modified path names as appropriate.  I
also modified the makefile to install things where I wanted them.

After saving copies of the originals with .sco suffixes, smail was linked to
/usr/bin/rmail and /usr/lib/mail/execmail, and deliver was linked to
/usr/lib/mail/mail.local.

Then, honoring the path names I set up in the various configuration files,
I set up a pathalias input file containing:

	oha = .oha.UUCP
	alberta = .cs.UAlberta.CA
	smart-host = alberta
	oha alberta(DIRECT)
	oha thor(DIRECT)
	oha vacuum(DIRECT)

and used:

	pathalias -f pathalias.in | (cd /lcl/cmd/smail; pathproc) > paths

to generate the paths file for smail.  I also generated a full name alias
file with the input:

	tony	Tony Olekshy (A.G.)
	al	Alison Machum (A.A.)

using:

	(cd /lcl/cmd/smail; mkfnames -) < fullnames.in > fullnames

Also, I created an smail aliases file with entries like:

	ctree		tony
	ctree-info	tony
	ctree-request	tony
	edm-announce	tony
	postmaster	tony
	root		tony
	uucp		tony

For deliver, I created the following three delivery files.  The system
delivery file contains:

	:
	# System-wide Deliver File.
	for user in ${1+"$@"}; do
	    echo $user;
	    done

The error delivery file contains:

	:
	# Error Handling Delivery File.

	# Send a copy to the postmaster.
	(   echo "Subject: Trouble Delivering Mail...\n"
	    echo "\t[See /sys/etc/deliver/ErrorLog.]\n"
	    sed 's/^/| /' $HEADER $BODY
	    ) | smail postmaster

	# Send to requested users.
	for user in ${1+"$@"}; do
	    echo $user;
	    done

And the post-user delivery file contains:

	:
	# Post-user Deliver File.

	getsit=1	# Will be set to 0 to turn off ~/mail/post.

	FROM=`header -f from $HEADER`
	case "$FROM" in
	    "oha!ctree")	getsit=0	;;
	    *)					;;
	    esac

	# See if the sender is one of the recepients.
	for user in ${1+"$@"}; do
	    [ "$user" = "$SENDER" ] && getsit=0
	    done

	# Copy to the sender?
	homedir=`echo $SENDER | sed 's/^oha!//'`
	[ $getsit = 1 -a -w "/u/$homedir/mail/post" ] && {
	    cat $HEADER $BODY | deliver -n -b "/u/$homedir/mail/post"
	    }

	# Send to requested users.
	for user in ${1+"$@"}; do
	    echo "$user";
	    done

I turned off recording of out-going messages in my mush startup code,
so now I get a copy of the actual outgoing message, including message
id, in the sender's ~mail/post file, via the PostUser deliver file,
unless the message is to the user or from one of the special users.

I also added the log file names to my log-file clean-up daemon's list.

Finally, I modified by mailing-list posting routine to build its own letter
for each subscriber, with headers specifying oha!ctree as the sender, and
send it with:

    	smail $subscriber < $letter

While I was preparing this article I received the Xenix patches for smail
by email.  I modified smail/deliver.c to use deliver for uux mail.
It looks like the only other things I missed were the replacement for
execmail, which doesn't seem to matter with mush, and a couple bug fixes.
Your mileage may vary.  I'll try installing the patches later.

--
Yours etc., Tony Olekshy.               Internet: oha!tony@CS.UAlberta.CA
					    uucp: alberta!oha!tony