[comp.sources.misc] smail 2.5 installation under SCO XENIX

allbery@ncoast.UUCP (11/29/87)

{{{ Daniel - I have received over a dozen requests for the following	}}}
{{{ package, so I though it might be best to post to comp.sources.misc.	}}}
{{{ It is used to install smail V2.5 under SCO XENIX.			}}}
{{{  -chip								}}}

#! /bin/sh
# this is a 'shar' archive - run through sh(C) to extract:
# -rw-r--r--   1 root     root        2837 Nov 25 13:03 Makefile.sco
# -rw-r--r--   1 root     root        4386 Nov 25 13:44 README.sco
# -rw-r--r--   1 root     root        2095 Nov 25 13:42 execmail.c
# 3 files total
echo "x - README.sco (file 1 of 3)"
sed -e 's/.//' << 'END_OF_FILE_README.sco' > README.sco
#
#This package implements the stock "smail V2.5" distribution under SCO XENIX.
#
#The main problem with using "smail" under XENIX is that the installation
#really doesn't correspond to the standard BSD or SYSV installation,
#although it is closest to the "SYSV without sendmail" installation.  Some
#of the issues are:
#
#    - there is neither "binmail" nor "mailx" under SCO XENIX
#    - the mail executables are mostly in "/usr/bin", not "/bin"
#    - "rmail" is a seperate program, not just a link to "mail"
#    - the standard mail interface barfs on internet (user@site) addresses
#
#Aside from the installation issues, there are a couple of other things
#you need to watch for:
#
#1)	SCO XENIX is distributed with an empty "nodename" entry in the
#        kernal's "uname" structure.  If you haven't placed your system's
#        name there, you will either need to do so or define your system
#        name in the "defs.h" file (the HOSTNAME definiton).
#
#2)	There are several places in the source where NULL is used to
#        terminate a string.  Since NULL is defined as "(char *)0" in the
#        SCO XENIX "stdio.h" file, compiler warnings are generated by
#        this.  Although "smail" will work in spite of these errors, you
#        might want to clean them up by changing NULL to '\0' in the
#        following places:
#
#	    file	line(s)
#	    =======	=======
#	    alias.c	461
#	    deliver.c	284
#	    nptx.c	128,165
#
#3)	You need to compile "smail" as a pure executable (-i) and extend
#        the stack size.  This has been done in the attached "Makefile".
#
#In regards to the internet address (user@site) problem -- this is a
#limitation of /usr/bin/mail.  If it does the mailing, it complains about
#the "@" character.  The solution is to force /usr/bin/mail to let
#/usr/lib/mail/execmail do the mailing.  This is done by placing a "set
#execmail" line in the /usr/lib/mail/mailrc file.  The included "execmail"
#program replaces the standard execmail.  It forces all mail to go through
#"smail" to handle the internet addresses.
#
#The "Flow.Diagram" file shows how mail works in various situations -- none
#of which correspond to how mail works with SCO XENIX.  The following
#diagrams show the mail flow for SCO XENIX:
#
#========================================================================
#
#vanilla SCO XENIX mail flow
#
#    mail	 is /usr/bin/mail
#    rmail	 is /usr/bin/rmail
#    execmail	 is /usr/lib/mail/execmail
#
#LOCAL	mail  ---------\		/--------------------- LOCAL
#			+-- execmail --+
#REMOTE	rmail ---------/		\------- uux --------- REMOTE
#
#Note that there is no "mailx" in XENIX.  Also note that "rmail" is
#a seperate program, not just a link to "mail".  This flow is the
#case only if "set execmail" is defined in /usr/lib/mail/mailrc.
#
#========================================================================
#
#Modified SCO XENIX mail flow
#
#    /usr/bin/rmail is renamed to /usr/bin/rmail.old and is ignored
#    /usr/lib/mail/execmail is renamed to /usr/lib/mail/execmail.old and ignored
#
#    mail	 is still /usr/bin/mail
#
#    smail	 is smail copied to /bin/smail
#    rmail	 is a link from /bin/smail to /bin/rmail
#    lmail	 is a link from /usr/lib/mail/mail.local to /bin/lmail
#    execmail	 is execmail copied to /usr/lib/mail/execmail
#
#LOCAL   mail --- execmail --- smail ---\	 /--- lmail -------- LOCAL
#					+-------+
#REMOTE  rmail -------------------------/	 \--- uux ---------- REMOTE
#
#========================================================================
#
#To install smail under SCO XENIX, do the following:
#
#(1)	Ensure "smail" can find out your host name (see note 1 near the
#	beginning of this message).
#
#(2)	Make sure "defs.h" contains what you want.  (The only change I
#	made was to redefine ALIASES to "/usr/lib/mail/aliases".)
#
#(3)	See if the makefile definitions look reasonable to you.
#
#(4)	Type "make" to compile the sources.
#
#(5)	Type "make install" to put everything in its place.
#
#There is a "make remove" option which deinstalls "smail" and returns
#you to a stock SCO XENIX mail configuration.
#
#If you want to make you setup more System V-ish, you could rename
#"/usr/bin/mail" to "/usr/bin/mailx" and install the "svbinmail" included
#in the smail package as "/bin/mail".  You would, however, have to change
#READER to "/usr/bin/mailx" in "svbinmail.c".
#
#I'd be interested in any suggestions or comments you might have.
#
#Chip Rosenthal
#chip@vector.UUCP
#25 Nov 87
#
END_OF_FILE_README.sco
echo "original file size:      113    632   4386 README.sco"
echo "extracted file size: `wc README.sco`"
echo "x - Makefile.sco (file 2 of 3)"
sed -e 's/.//' << 'END_OF_FILE_Makefile.sco' > Makefile.sco
## Makefile for smail under SCO XENIX
##
## Wed Nov 25 13:02:54 CST 1987 - C. Rosenthal
##	Documented for net distribution.
#
## @(#)Makefile	2.5 (smail) 9/15/87
#
## Things to do:
##	make			make executables
##	make all		 "       "
##	make install		perform XENIX installation
##	make remove		de-install smail
##	make clean		cleanup this directory
##	make clobber		...and remove executables from this dir
#
#SHELL=		/bin/sh
#CFLAGS	=	-i -O
##LIBS	=	-lmalloc	** don't use -lmalloc!! it causes core dumps **
#
#OBJECTS =	main.o map.o resolve.o deliver.o misc.o alias.o pw.o headers.o getpath.o str.o getopt.o
#
#all:		smail execmail
##all:		smail svbinmail lcasep pathproc mkfnames nptx
#
#smail:		$(OBJECTS)
#		cc -F 5000 $(CFLAGS) $(OBJECTS) -o smail $(LIBS)
#
#$(OBJECTS):	defs.h
#		cc $(CFLAGS) -c $<
#
#svbinmail:	svbinmail.c defs.h
#		cc $(CFLAGS) svbinmail.c -o $@
#
#lcasep:		lcasep.c
#		cc $(CFLAGS) lcasep.c -o lcasep
#
#pathproc:	pathproc.sh
#		cp pathproc.sh pathproc
#		chmod 755 pathproc
#
#mkfnames:	mkfnames.sh
#		cp mkfnames.sh mkfnames
#		chmod 755 mkfnames
#
#nptx:		nptx.o pw.o str.o
#		cc $(CFLAGS) nptx.o pw.o str.o -o nptx $(LIBS)
#
#nptx.o:		nptx.c
#		cc $(CFLAGS) -c nptx.c
#
#execmail:	execmail.c
#		cc $(CFLAGS) execmail.c -o execmail
#
#clean:
#		rm -f *.o *.ln a.out core
#
#clobber:	clean
#		rm -f smail rmail lcasep pathproc mkfnames svbinmail nptx execmail
#
###########################
## SCO XENIX Installation #
###########################
#
#INSTALL=	/bin/lmail /bin/rmail /bin/smail /usr/lib/mail/execmail
#CHANGE=		/usr/bin/rmail.old /usr/lib/mail/execmail.old
#MANDIR=		/usr/man/local/man8
#MANSUF=		8L
#MANPAGES=	$(MANDIR)/aliases.$(MANSUF)	\
#		$(MANDIR)/lcasep.$(MANSUF)	\
#		$(MANDIR)/mkfnames.$(MANSUF)	\
#		$(MANDIR)/nptx.$(MANSUF)	\
#		$(MANDIR)/pathproc.$(MANSUF)	\
#		$(MANDIR)/paths.$(MANSUF)	\
#		$(MANDIR)/smail.$(MANSUF)
#
#install:	all $(CHANGE) $(INSTALL) $(MANPAGES)
#		@echo "=== Your global mailrc needs to contain 'set execmail'."
#		@echo "=== I'll check and add it if required..."
#		grep 'set execmail' /usr/lib/mail/mailrc > /dev/null || \
#		    echo 'set execmail' >> /usr/lib/mail/mailrc
#
#remove:		
#		-rm $(INSTALL)
#		-rm $(MANPAGES)
#		-mv /usr/bin/rmail.old /usr/bin/rmail
#		-mv /usr/lib/mail/execmail.old /usr/lib/mail/execmail
#
#/usr/bin/rmail.old:				; mv /usr/bin/rmail $@
#/usr/lib/mail/execmail.old:			; mv /usr/lib/mail/execmail $@
#
#/bin/smail:		smail				; cp $? $@
#/bin/rmail:		/bin/smail			; -ln $? $@
#/bin/lmail:		/usr/lib/mail/mail.local	; ln $? $@
#/usr/lib/mail/execmail:	execmail			; cp $? $@
#
#$(MANDIR)/aliases.$(MANSUF):	aliases.8		; cp $? $@
#$(MANDIR)/lcasep.$(MANSUF):	lcasep.8		; cp $? $@
#$(MANDIR)/mkfnames.$(MANSUF):	mkfnames.8		; cp $? $@
#$(MANDIR)/nptx.$(MANSUF):	nptx.8			; cp $? $@
#$(MANDIR)/pathproc.$(MANSUF):	pathproc.8		; cp $? $@
#$(MANDIR)/paths.$(MANSUF):	paths.8			; cp $? $@
#$(MANDIR)/smail.$(MANSUF):	smail.8			; cp $? $@
#
END_OF_FILE_Makefile.sco
echo "original file size:      103    356   2837 Makefile.sco"
echo "extracted file size: `wc Makefile.sco`"
echo "x - execmail.c (file 3 of 3)"
sed -e 's/.//' << 'END_OF_FILE_execmail.c' > execmail.c
#/*
# * execmail - Replacement for execmail for smail under SCO XENIX
# *
# * This program is derived from an article from Chip Salzenberg (chip@ateng).
# * Below is his news article and the program.  Note that his article suggests
# * that "/usr/lib/mail/execmail" (the original one--not the replacement)
# * be used as the local delivery agent.  Unfortunately, this munges up
# * the "From" line in the mail header.  Instead, "/usr/lib/mail/mail.local"
# * should be used.
# *
# * Wed Nov 25 13:41:01 CST 1987 - C. Rosenthal
# *	Commented for net distribution.
# */
#
#/*
# * From: chip@ateng.UUCP (Chip Salzenberg)
# * Newsgroups: comp.unix.xenix
# * Subject: RFC822 addresses and Xenix `mail'
# * Message-ID: <92@ateng.UUCP>
# * Date: 2 Nov 87 15:19:09 GMT
# * Organization: A.T. Engineering, Tampa, FL
# * Lines: 96
# * 
# * In article <536@bms-at.UUCP> stuart@bms-at.UUCP (Stuart D. Gathman) writes:
# * >
# * >Unfortunately, SCO mail screens addresses for garbage characters
# * >(e.g. '@' & '.') before passing mail to /bin/rmail.  As I say on
# * >many occasions, "Gee, they sure went to a lot of trouble to make
# * >it not work!"
# * 
# * This `feature' is easy to defeat.
# * 
# * In the /usr/lib/news/mailrc file, add this line:
# * 
# * 	set execmail
# * 
# * This causes the mail program to hand all mail to /usr/lib/mail/execmail.
# * (This gem is courtesy of Tom Walsh <uunet!foobar!tw> -- thanks, Tom.)
# * 
# * It is then necessary to rename the existing /usr/lib/mail/execmail to
# * something else, say execmail.x, and then have smail use execmail.x as the
# * local delivery agent.
# * 
# * And of course, you need to install a replacement for execmail.  This is
# * my execmail replacement:
# *
# */
#
##include <stdio.h>
##define SMAIL	"/bin/smail"
#
#main(argc, argv)
#int     argc;
#char    **argv;
#{
#	char *progname = argv[0];
#
#	/*
#	 * Drop the execmail options.
#	 */
#	while (argv[1][0] == '-') {
#		switch (argv[1][1]) {
#		case 'f':
#		case 'h':
#			argv += 2;
#			break;
#		default:
#			++argv;
#			break;
#		}
#	}
#
#	argv[0] = progname;
#	execv(SMAIL, argv);
#	fprintf(stderr, "%s: can't execute smail!\n", progname);
#	exit(1);
#}
#
END_OF_FILE_execmail.c
echo "original file size:       78    331   2095 execmail.c"
echo "extracted file size: `wc execmail.c`"
echo "extracted 3 files"
exit 0