[mod.sources] v06i026: Elm mail system

sources-request@mirror.UUCP (06/27/86)

Submitted by: Dave Taylor <pyramid!hplabs!hpldat!taylor>
Mod.sources: Volume 6, Issue 26
Archive-name: elm/Part01

[  ELM is the new release of Dave's MSG mail system, published
   in mod.sources Volume 4, Numbers 5 through 11.  This release
   consists of 14 parts.  Starting today, I will post three
   parts/day.  If there is interest, I may make available laser'd
   copies of the documentation; send mail mirror!sources-request
   to get put on the list.  --r$ ]

# Shell Archive created by hpldat!taylor at Sun Jun 22 16:14:44 1986

# To unpack the enclosed files, please use this file as input to the
# Bourne (sh) shell.  This can be most easily done by the command;
#     sh < thisfilename

# This archive contains;
#  ALPHA-MAIL       CHANGES             Instructions        Makefile            
#  Overview         README              bin                 doc                 
#  hdrs             src                 test                utils


# ---------- file ALPHA-MAIL ----------

filename="ALPHA-MAIL"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file ALPHA-MAIL...
fi

sed 's/^X//' << 'END-OF-FILE' > $filename
XFrom taylor  Sun Jun  8 18:31:15 1986
XReceived: by hpldat ; Sun, 8 Jun 86 18:31:15 pdt
XFrom: Dave Taylor <taylor>
XReturn-Path: <taylor>
XMessage-Id: <8606090131.AA23586@hpldat>
XTo: alpha
XDate: Sun, 8 Jun 86 18:31:12 PDT
XSubject: Usenix & printed ELM documents...
XOrganization: Hewlett-Packard Laboratories, Knowledge Technologies Lab.
XX-Mailer: ELM [version 1.1]
X
X
X
XFor those of you who are going to be at Usenix, I am too!  In fact, I'll
Xbe dragging along a couple of copies of the latest (ready to mail to 
Xmod.sources, in fact) version of Elm.  If you can't find me during the
Xconference, I'm staying at the Hilton Wednesday & Thursday nights, so
Xleave me a note...
X
XThe new version is pretty slick.  Thanks for all the help!!!
X
X						-- Dave Taylor
X
X    taylor/HP1900/UX,   taylor@HPLABS.{CSNET, ARPA}  or  ..hplabs!taylor
X
XFrom hpfcla!hpbbn!hpbbsz!gatm@hplabs.HP.COM  Wed Jun 11 02:52:36 1986
XReceived: from hplabs.HP.COM by hpldat ; Wed, 11 Jun 86 02:52:36 pdt
XFrom: hpfcla!hpbbn!hpbbsz!gatm@hplabs.HP.COM
XReturn-Path: <hpfcla!hpbbn!hpbbsz!gatm@hplabs.HP.COM>
XReceived: by hplabs.HP.COM ; Wed, 11 Jun 86 02:49:03 pdt
XReceived: by hpbbn.UUCP (5.4/30-Jul-85)
X	id AA00155; Wed, 11 Jun 86 11:01:28 mez
XMessage-Id: <8606111001.AA00155@hpbbn.UUCP>
XTo: hpbbn!hpfcla!hplabs!hpldat!alpha@hplabs.HP.COM
XDate: Wed, 11 Jun 86 10:53:14 MSZ
XSubject: more elm bugs
XX-Mailer: ELM [version 1.0]
X
XHello Alpha Testers,
X
Xmore problems are here:
X
X
X--- Mi., 11.Juni, 1986 10:48:12 MSZ
X
X9. forwarding without editing *******************************************
X
XThis is a dangerous bug which fills your file system.
X
XIf you forward a message from a folder without editing it elm creates in
Xan (endless?) loop a snd.???? file which grows and grows.
X
X
X10. nmail.paths
X
XElm doesn't understand the first line in nmail.paths. You have to have a
Xdummy line if you want to use all those system aliases.
X
X
XGerd
X
X
X
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1888 ]
  then
    echo $filename changed - should be 1888 bytes, not $size bytes
  fi

  chmod 666 $filename
fi

# ---------- file CHANGES ----------

filename="CHANGES"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file CHANGES...
fi

sed 's/^X//' << 'END-OF-FILE' > $filename
X
X                        A List of Changes Between 
X                    MSG 3.1 (as posted to mod.sources)
X                               and ELM 1.1
X                                        
X
X	There are a significant number of things that have changed
Xsince the mailer was posted to the network on March 1st in the group
Xmod.sources.  This file lists some of those changes (in the couple of
Xmonths that have passed a LOT of stuff has been changed!!!  If you're
Xfamiliar with the old system it's recommended that you simply install
Xthe new one - if you didn't LIKE the old one, try the new one - if you
Xstill don't like it, well, then use "dd" and see if it makes you more
Xproductive!! *HAH!* )...
X
XThe most noticable change right off is the change of names!  For various
Xreasons, including my finding out about another mailer called "MSG", I
Xchanged the name to 'ELM' - ELectronic Mail system...
X
XMachines now supported in the "Configuration" systems...
X
X  System V, BSD, Sun, Pyramid, UTS,   and the HP SPECTRUM system.
X	    ^^^	 ^^^  ^^^^^^^  ^^^	      ^^^^^^^^^^^
X	   FIXED NEW    NEW    FIXED	       SUPER NEW
X
XIn the file "sysdefs.h" (configuration);
X	
X  domains now indicates the domain information file as used also by
X	the latest version of uumail.  See the general note and the
X	section entitled "Domain Based Addressing" in the "Elm Alias
X	Guide".
X
X  NO_VM has been added so that machines with VM can use vfork()
X	rather than fork() to improve the speed of system commands.
X
X  LOOK_CLOSE_AFTER_SEARCH has been added to change the machine 
X	lookup scheme to check the machine name against the names in
X	L.sys AFTER trying the uupath database first.  The default is
X	the current behaviour, however.
X
X  NO_VAR_ARGS has been added for those machines that don't have the ability
X	to gracefully deal with variable argument lists.
X
X  DONT_ADD_FROM has been added for those sites that would rather not have
X	Elm add the From: line to outbound mail.
X
X  INTERNET_ADDRESS_FORMAT has also been added to allow the From: lines on 
X	outbound mail to have the Internet format user@host notation instead 
X	of the (default) host!user notation.
X
XIn the ".elmrc" file;
X
X  pointnew	- start up with current message pointer pointing at the
X		  first new message in the mailfile, not just the first
X	 	  message.
X
X  fullname      - Override the name obtained from the "gecos" field of
X		  /etc/passwd
X
X  bounceback=n  - On messages to UUCP destinations of greater than 'n'
X		  hops, prompt for a copy to be bounced off the remote
X		  machine and back to you, for verification of transmission
X		  of the message and so on.
X
X  keypad        - Same as starting with "-k", but more convenient
X
X  softkeys      - Same as starting with "-s", but more convenient
X
X  signature     - If set, all messages will automatically have the
X		  contents of the user file ".signature" in their
X		  home directory appended to the edit buffer BEFORE
X		  the initial invocation of the editor.
X
X  alwaysleave   - Changes the default answer to the 'keep messages in
X		  incoming mailbox' to YES rather than NO.
X
X  alwaysdelete  - Changes the default answer to the 'delete messages' to 
X		  YES rather than NO.
X
XFrom the command line;
X
X  The '-s' flag has been changed to "-K", which now also implies (as it
X  	should) the "-k" flag.
X
X  The '-s' flag is now used to specify a subject for single mailings.
X
X  Starting the mailer with metacharacters in the filenames is okay now,
X	too (e.g. "elm -f =/unix-junk" will now work).
X
X  Finally, the batchmail/piped mail now works okay.
X
XGeneral changes;
X
X  <control>-D and <control>-T are now 'meta' operations that support 
X        functions like "delete all messages from Joey".
X
X  "+" and "%" are now synonymous with the "=" character in filenames.
X
X  Replying to a message that was sent to someone (that is, a message
X	in the $savemail file) now correctly extracts the valid To:
X	address from the message and uses that instead of the incorrect
X	"To:xyz" address in the From line.
X
X  The format of the messages saved in the $savemail file has been altered
X	to more closely resemble that of the message actually sent, and 
X	now also includes the specified user headers.
X
X  The "Elm Alias Guide" has been written and included.
X
X  The "readmsg" program is now considerably smarter, and can work better 
X	in conjunction with the mailer itself.  For example, if you're
X	responding to a message from someone, "readmsg" without any
X	arguments will now display that message to the screen.  The
X	"readmsg" program can also now be invoked with a string to try
X	to match in one of the messages in the mailbox.
X
X  For those people porting to Xenix systems, a file UNIX_SYMS (actually
X	a 'sed' script) has been included to aid in this process...
X
X  Searches "/" and "//" are now case insensitive.
X
X  strchr() has been added to the opt_utils.c file.
X
X  The "what" command now correctly describes the release version of the
X	software.
X
X  "newmail" can now be used with files other than the default incoming
X	mail file, to allow keeping track of ANY file at all.
X
X   Addresses can now use a domain based syntax for those sites that
X	have installed the /usr/lib/domains file.  The format of this
X	file is as for the uumail program, and is discussed in the
X	"Elm Alias Guide"
X
X   On Berkeley systems, the mailer can now expand "&" into the login
X	name of the user, so a setup like loginname=dave and the 
X	gecos field in /etc/passwd being "& Taylor" will now correctly 
X	generate Dave Taylor as the full name!  (On the other hand, 
X	you could use the "fullname" entry in your .elmrc file too!)
X
X   "from" now knows how to expand the '='/'+'/'%' metacharacter into 
X	the users mailhome setting...
X
X   The screen display when reading messages has been enhanced for 
X	better performance.
X
X   The use of <return> versus <space> has been redone.
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 5831 ]
  then
    echo $filename changed - should be 5831 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file Instructions ----------

filename="Instructions"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file Instructions...
fi

cat << 'END-OF-FILE' > $filename

				Instructions
				------------

			Last Update: March 12th, 1986


	This file contains instructions on how to create and install
the entire ELM mail system.  It should be read BEFORE any attempts
are made at actually creating and/or installing any of the software
contained herein!

	First off, you'll need to create the documents so that you
can read the "ELM Configuration Guide" and configure the system
correctly for your local site needs...

	$ make documentation

This will create two documents - the "ELM Users Guide", and the "ELM
Configuration Guide".  For our purposes, you're only interested in the 
configuration guide, so at this point print out the file 

		"doc/Config.fmtd" 

and then continue reading with that document.

--------

I assume you've read and followed the directions in the Configuration
guide if you're back here!  If not, GO DO IT!!!

--------

Try again - ready?

Okay.  Now that we've configured the ELM system so that it will all
be happy with the file locations, node type, memory requirements,
and so on of your system we can actually try to make the system!

The first step is to edit the Makefile so that the define for the
macro "DEFINE" is correct for your OS.  The choices are "BSD", "UTS"
or the default of Bell/HP-UX.

When you're done, type:

	$ make all

This will take a fair while, so it's recommended that you go and eat 
lunch or play a game for a while!! (alternatively, spend lots of money
on a really FAST machine and blink your eyes a few times...)

Assuming there are no errors during compilation (we'll have to assume
that for the moment) you should now be able to list the directory "bin"
and find the following files:

  "answer", "arepdaemon", "autoreply", "cutfile", "fastmail", "from", 
  "elm", "newalias", "newmail", "printmail", and "readmsg".

at this point you need to check the system level Makefile (in this
directory) to check that the defines for the following are correct
for your system:

	TAPE=   /dev/rct
	DEST=   /usr/local/bin
	LIB=    /usr/local/lib
	MAN=	/usr/man/man1

(these are the Bell System V defaults, more or less).  Once they're 
altered to your satisfaction, you can install all the software by
becoming root on your machine (you'll need write permission to the
directories above) then typing:

	$ make install
	
Note: the mailer runs as setuid root to have the ability to WRITE
to the /usr/mail directory (for lock files).   If you have a different
scheme at your site, feel free to set it up to use that instead.

Finally, we're just about done!   The final checks can be made
by the following commands:

	$ /usr/local/bin/elm -z

should say "no mail" if nothing's in the mailbox

	$ /usr/local/bin/elm -f test/test.mail

should read in EIGHT messages from various people.  While here, try to
A)lias C)urrent message for each of the eight messages to confirm that
the reply/address system is working okay.   Now try to C)hange mailboxes
to the file "test/test.note" and use the '%' key to see if the mailer is
generating valid return addresses for the notes (If not, then you might
need to install the pathalias database - see "sysdefs.h" for more info)
Change back to "test/test.mail" and Q)uit without having marked anything 
for deletion...answer the questions accordingly.

If you get this far you're in Wonderful shape!  In fact, you're done!

Congratulations!  You've just installed one of the best electronic mail
systems available today on your machine (if I say so myself!)

HANDY HINTS:  If you want to create a print of the entire set of
sources, including this file, use the command:

	$ make listing

If, on the other hand, you just want to create a listing file of 
just the ELM sources, try:

	$ make elm-listing

Also, if you have a number of machines on a network, you can rlogin
to the remote machine and then do a remote install (after checking
to ensure that the networking copy method in the Makefile under the
target "remote-install" is correct) by typing:

	$ make -f <remote Makefile> REMOTE=<remote file system> rmt-install

(for example, if we had installed the system on machine "machx" and 
 wanted to install it on "machy", with the Makefile in /src/Elm on
 "machx", we could type from "machy";
	 $ make -f machx:/src/Elm/Makefile REMOTE=machx: rmt-install
 to have it install the system on machine y!)

One final note for non-US distribution - the program might complain
at link time that it can't find "crypt()".  If so, and if you cannot
obtain a copy, you should merely instruct your users to not use the
encrypted mail option on outgoing mail.

That's it!
----------

Oh!  One final note: if you'd like a nicely typeset copy of the documentation,
feel free to drop me a line with your full (overland) mail address!!  I'll
try to get it back to you within a week or two.

-----------

	Author's address:	taylor@HPLABS
				hplabs!taylor

	Mail address:		Dave Taylor
				Hewlett Packard Laboratories
				1501 Page Mill Road
				Palo Alto CA
				94304

  This document and the entire mail system is

	(C) Copyright 1986, Dave Taylor
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 5058 ]
  then
    echo $filename changed - should be 5058 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file Makefile ----------

filename="Makefile"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file Makefile...
fi

cat << 'END-OF-FILE' > $filename
#
#  Makefile for the entire ELM mail system
#
#         (C) Copyright 1986, Dave Taylor
#
#  Last modification: March 3rd, 1986

SHELL=/bin/sh
 
#########################
#
# The following entries need to be customized for the local site:  
#    The first is the address of the data-cassette drive to allow
# easy tape copies to be made, and the second is the final location 
# that all the software should be installed in when 'make install'
# is run.
#
#########################

TAPE=   /dev/thor
DEST=   /usr/local/bin

LIB=    /usr/local/lib
MAN=	/usr/man/man1
CATMAN= /usr/man/cat1
SHAR=   /usr/local/bin/shar -s 60000

# See the Configuration Guide for further information on this stuff;
#
# if on a Berkeley system:
#   DEFINE = -DBSD
#   LIB2   = -lcurses
# else if on a UTS system:
#DEFINE = -DUTS
#LIB2   = -la
# else if on a Sun system:
#   DEFINE = -DBSD -DSUN
#   LIB2   = -lcurses
# else if on a Pyramid system:
#   DEFINE = -DBSD -DNO_VAR_ARGS
#   LIB2   = -lcurses
# otherwise;

    DEFINE=
    LIB2   = 

# If you're on ACSnet (Australia) you'll want to define
# the following;

#   DEFINE=${DEFINE} -DACSNET

#########################

LIBS=   -ltermcap
CFLAGS= -O
CC=	/bin/cc
RM=	/bin/rm -f
MV=     /bin/mv -f
CP=	/bin/cp

# if you want to use "nroff", change this...

FORMATTER = troff
TBL       = tbl

DOCS=   Config.guide Users.guide Ref.guide Alias.guide elm.1 from.1 \
	printmail.1 newalias.1 newmail.1 answer.1 \
	grabalias.1 fastmail.1 readmsg.1 autoreply.1 wnewmail.1

UTILSRC= utils/answer.c utils/arepdaemon.c utils/autoreply.c           \
	utils/fastmail.c utils/from.c utils/newalias.c \
	utils/newmail.c utils/printmail.c utils/readmsg.c utils/wnewmail.c

ELMSRC=	src/addr_utils.c src/alias.c src/aliasdb.c src/aliaslib.c     \
	src/args.c src/bounceback.c src/connect_to.c src/curses.c     \
	src/date.c src/delete.c src/domains.c src/edit.c src/encode.c \
	src/errno.c src/file.c src/file_utils.c src/fileio.c src/hdrconfg.c \
	src/help.c src/initialize.c src/input_utils.c src/leavembox.c \
	src/mailmsg1.c src/mailmsg2.c src/mailtime.c src/mkhdrs.c     \
	src/elm.c src/newmbox.c src/notesfile.c src/opt_utils.c       \
	src/output_utils.c src/pattern.c src/quit.c src/read_rc.c     \
	src/remail.c src/reply.c src/return_addr.c src/savecopy.c     \
	src/screen.c src/showmsg.c src/signals.c src/softkeys.c       \
	src/strings.c src/syscall.c src/utils.c src/validname.c       \
	src/calendar.c src/sort.c src/getopt.c src/string2.c

################

all:	bin/elm utils 
	@echo Everything is up to date!

documentation:  doc/Users.fmtd doc/Ref.fmtd doc/Config.fmtd  doc/Alias.fmtd
	
doc/Users.fmtd: doc/Users.guide
	${TBL} doc/Users.guide | ${FORMATTER} -mm > doc/Users.fmtd

doc/Ref.fmtd: doc/Ref.guide
	${FORMATTER} -mm doc/Ref.guide > doc/Ref.fmtd

doc/Config.fmtd:  doc/Config.guide
	${FORMATTER} -mm doc/Config.guide > doc/Config.fmtd

doc/Alias.fmtd:  doc/Alias.guide
	${FORMATTER} -mm doc/Alias.guide > doc/Alias.fmtd

bin/elm: ${ELMSRC}
	cd src; make DEFINE=${DEFINE} LIB2=${LIB2} ../bin/elm; cd ..
	
bin/utils: ${UTILSRC}
	cd utils; make DEFINE=${DEFINE} LIBS=${LIB2} all; cd ..
	@touch bin/utils

install: all
	${CP} bin/elm          ${DEST}/elm
	${CP} bin/from         ${DEST}/from
	${CP} bin/newalias     ${DEST}/newalias
	${CP} bin/printmail    ${DEST}/printmail
	${CP} bin/fastmail     ${DEST}/fastmail
	${CP} bin/readmsg      ${DEST}/readmsg
	${CP} bin/newmail      ${DEST}/newmail
	${CP} bin/wnewmail     ${DEST}/wnewmail
	${CP} bin/checkalias   ${DEST}/checkalias
	${CP} bin/arepdaemon   ${DEST}/arepdaemon
	${CP} bin/autoreply    ${DEST}/autoreply
	${RM} ${CATMAN}/elm.1 ${CATMAN}/from.1 \
	      ${CATMAN}/newalias.1 ${CATMAN}/printmail.1 \
	      ${CATMAN}/fastmail.1 ${CATMAN}/elm.1 \
	      ${CATMAN}/readmsg.1 ${CATMAN}/answer.1 \
	      ${CATMAN}/newmail.1 ${CATMAN}/checkalias.1 \
	      ${CATMAN}/autoreply.1 ${CATMAN}/wnewmail.1
	${CP} doc/elm.1        ${MAN}/elm.1
	${CP} doc/from.1       ${MAN}/from.1
	${CP} doc/newalias.1   ${MAN}/newalias.1
	${CP} doc/printmail.1  ${MAN}/printmail.1
	${CP} doc/fastmail.1   ${MAN}/fastmail.1
	${CP} doc/checkalias.1 ${MAN}/checkalias.1
	${CP} doc/autoreply.1  ${MAN}/autoreply.1
	${CP} doc/answer.1     ${MAN}/answer.1
	${CP} doc/readmsg.1    ${MAN}/readmsg.1
	${CP} doc/newmail.1    ${MAN}/newmail.1
	${CP} doc/wnewmail.1   ${MAN}/wnewmail.1
	${CP} doc/helpfile     ${LIB}/elm-help.main
	chmod a+rx ${DEST}/from ${DEST}/newalias \
		   ${DEST}/printmail ${DEST}/fastmail \
		   ${DEST}/readmsg \
		   ${DEST}/checkalias ${DEST}/autoreply \
		   ${DEST}/newmail ${DEST}/wnewmail
	chgrp mail ${DEST}/elm
	chmod 2755 ${DEST}/elm
	@echo Done with installation.

rmt-install: remote-defined
	@echo " "
	@echo Warning: This assumes "install" has been done on the
	@echo "         remote machine.  If this is not the case you"
	@echo "         better hit BREAK quickly!"
	@echo " "
	${CP} ${REMOTE}${DEST}/elm          ${DEST}/elm
	${CP} ${REMOTE}${DEST}/from         ${DEST}/from
	${CP} ${REMOTE}${DEST}/newalias     ${DEST}/newalias
	${CP} ${REMOTE}${DEST}/printmail    ${DEST}/printmail
	${CP} ${REMOTE}${DEST}/fastmail     ${DEST}/fastmail
	${CP} ${REMOTE}${DEST}/readmsg      ${DEST}/readmsg
	${CP} ${REMOTE}${DEST}/wnewmail     ${DEST}/wnewmail
	${CP} ${REMOTE}${DEST}/newmail      ${DEST}/newmail
	${CP} ${REMOTE}${DEST}/checkalias   ${DEST}/checkalias
	${CP} ${REMOTE}${DEST}/arepdaemon   ${DEST}/arepdaemon
	${CP} ${REMOTE}${DEST}/autoreply    ${DEST}/autoreply
	${RM} ${CATMAN}/elm.1 \
	      ${CATMAN}/from.1 \
              ${CATMAN}/newalias.1 \
	      ${CATMAN}/printmail.1 \
	      ${CATMAN}/fastmail.1 \
              ${CATMAN}/checkalias.1 \
              ${CATMAN}/autoreply.1 \
	      ${CATMAN}/readmsg.1 \
	      ${CATMAN}/answer.1 \
	      ${CATMAN}/newmail.1 \
	      ${CATMAN}/wnewmail.1 \
              ${CATMAN}/elm.1
	${CP} ${REMOTE}${MAN}/elm.1        ${MAN}/elm.1
	${CP} ${REMOTE}${MAN}/from.1       ${MAN}/from.1
	${CP} ${REMOTE}${MAN}/newalias.1   ${MAN}/newalias.1
	${CP} ${REMOTE}${MAN}/printmail.1  ${MAN}/printmail.1
	${CP} ${REMOTE}${MAN}/fastmail.1   ${MAN}/fastmail.1
	${CP} ${REMOTE}${MAN}/checkalias.1 ${MAN}/checkalias.1
	${CP} ${REMOTE}${MAN}/autoreply.1  ${MAN}/autoreply.1
	${CP} ${REMOTE}${MAN}/readmsg.1    ${MAN}/readmsg.1
	${CP} ${REMOTE}${MAN}/answer.1     ${MAN}/answer.1
	${CP} ${REMOTE}${MAN}/wnewmail.1   ${MAN}/wnewmail.1
	${CP} ${REMOTE}${MAN}/newmail.1    ${MAN}/newmail.1
	${CP} ${REMOTE}${LIB}/elm-help.main ${LIB}/elm-help.main
	chmod a+rx ${DEST}/from ${DEST}/newalias ${DEST}/printmail \
	           ${DEST}/fastmail ${DEST}/readmsg \
		   ${DEST}/checkalias ${DEST}/autoreply ${DEST}/wnewmail \
		   ${DEST}/newmail 
	chgrp mail ${DEST}/elm
	chmod 2755 ${DEST}/elm
	@echo everything is installed based on files from ${REMOTE}

source: 
	tar cvf ${TAPE} bin/makelisting utils/*.c src/*.c doc/* hdrs/* \
	Instructions Makefile UNIQ_SYMS README utils/Makefile src/Makefile \
	test/* utils/*.awk CHANGES Overview

# Note that the production for SHAR assumes a pretty snazzy shar program
# that can break down the output into a number of files as needed...
#   The current threshold is 60,000 bytes per file, for email/netnews

shar:   
	${SHAR} *

lint:
	lint ${UTILSRC} > lint.out

listing:
	@echo listing all source files 
	@/bin/echo \\f > LISTING
	@echo adding file 'README'...
	@cat README >> LISTING
	@/bin/echo \\f >> LISTING
	@echo adding file 'Instructions...
	@cat Instructions >> LISTING
	@/bin/echo \\f >> LISTING
	@echo adding file 'Makefile'...
	@cat Makefile >> LISTING
	@bin/makelisting Makefile ${UTILSRC} src/Makefile src/*.c hdrs/*.h
	@echo LISTING generated.

elm-listing: 
	@echo listing just the ELM system source files
	@echo ' ' > src/LISTING
	@cd src ; make listing ; cd ..
	@echo LISTING generated \(in directory /src\).

clean:
	@cd src ; make clean ; cd ..
	@cd utils; make clean ; cd ..
	@echo All spurious files removed

elm: bin/elm
utils: bin/utils
utils/checkalias:
doc/Users.guide:
doc/Ref.guide:
doc/Alias.guide:
doc/Config.guide:

remote-defined:
	@if ( "${REMOTE}" == "" ) then; \
	   echo " " ; \
	   echo "You need to define 'REMOTE' as the remote file system" ; \
	   echo "for this particular command.   The easiest way to do " ; \
	   echo "this is to type:" ;\
	   echo "    make -f <makefile> REMOTE=<remote file system> rmt-install" ; \
	   echo " " ; \
	 endif
	@if ( "${REMOTE}" == "" ) exit 1
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 8398 ]
  then
    echo $filename changed - should be 8398 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file Overview ----------

filename="Overview"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file Overview...
fi

cat << 'END-OF-FILE' > $filename
			An Overview of the Elm Mail System
			----------------------------------

Introduction

	This file discusses the functionality of the Elm mail system
and explains some of the motivation behind the creation and of various
features.

1. What is Elm?

	Currently on Unix, there seems to be a preponderence of line-oriented 
software.  This is most unfortunate as most of the software on Unix tends to
be pretty darn hard to use!  I believe that there is more than a slight
correlation between the two, and, since I was myself having problems using
"mailx" with high-volume mail, I created a new mail system.

	In the lingo of the mail guru, Elm is a "User Agent" system,  it's
designed to run with "sendmail" or "/bin/rmail" (according to what's on
your system) and is a full replacement of programs like "/bin/mail" and
"mailx".  The system is more than just a single program, however, and
includes programs like "from" to list a 'table of contents' of your
mail, "printmail" to quickly paginate mail files (to allow 'clean'
printouts), and "autoreply", a systemwide daemon that can autoanswer
mail for people while they're on vacation without having multiple
copies spawned on the system.

2. What's New about Elm?

	The most significant difference between Elm and earlier mail
systems is that Elm is screen-oriented.  Upon further use, however,
users will find that Elm is also quite a bit easier to use, and quite
a bit more "intelligent" about sending mail and so on.   For example,
say you're on "usenet" and receive a message from someone on the
ARPANET.  The sender also "cc'd" another person on ARPA.  With Elm
you can simply G)roup reply and it will build the correct return
addresses.

	There are lots of subtleties like that in the program, most of
which you'll probably find when you need them.

3. What systems does it work on?

	Elm was originally written on HP-UX, HP's proprietary version
of Bell system V, with a little BSD thrown in.  Since then, it has been
ported to Bell, Berkeley, Sun, UTS and the Pyramid and should run on 
all these systems without any modifications (if there turn out to be 
modifications, please notify the author as soon as possible).

	Some people have expressed interest in porting the mail system
to Xenix.  If it is indeed 100% system V compatible it should be rather
trivial...

4. Does it obey existing mail standards?

	Yes!  That's another of the basic reasons the program was 
originally written!  To ensure that the date field, the "From:" line
and so on were all added in the correct format.  The program is 100%
correct according to the RFC-822 electronic mail header protocol
guide.

5. What were the main motivating factors?

	The first two I've already mentioned, but here's a (somewhat
partial) list;

	-  To have a mail system that exploited the CRT instead of
	   assuming I'm on a teletype.

	- To have a mailer that was 100% correct when dealing with	 
	  network mail (ie RFC-822).

	- To create a system that needed no documentation for the
	  casual user, but was still powerful enough and sophisticated
	  enough for a mail expert.

	- To write a "significant" piece of software as a learning
	  experience (I admit it!)

	- To find out how reasonable it is to try to modify a program
	  to meet the expectations of the users, rather than vice-versa.

	- To basically correct some of the dumb things that the current
	  mailers do, like letting you send mail to addresses that it
	  could trivially figure out are going to result in 'dead.letter'

	- To tie in intimately with the pathalias program output, and
	  allow users to specify machine!user or user@machine and have
	  the COMPUTER do the work of figuring out addresses...

6. Is it reliable?

	The mailer, in various incarnations, has logged literally
thousands upon thousands of hours without any problems that aren't
now corrected.  As new problems arise they're dealt with in as
rapid a manner as possible...

7. What should I do now?

	The first step would be to install the mail system and have
the "elm" mailbox/alias expand to my email address (hplabs!taylor).
Then, once it's all up and running, drop me a line letting me know
that your site is running the system (bookkeeping) and what you and
your site think of it.

	REMEMBER: The product is evolving so if you'd like to have a
something change, or have something new added, LET ME KNOW!!!  I'd 
much rather make the change myself than start getting change reports
mailed from around the world!!

8. Disclaimers 

	The author of this program will deny all liability for any
damages, either real or imagined, due to the execution of this program
or anything related to either the software or the system.  Furthermore,
the entire system and all source within, including the presentation
screens and commands, are legally copyrighted by the author, and while
they can be used, and abused for public domain systems, will be in 
violation of the law if used in systems or programs sold for profit.

	By installing the mailer or even extracting it from the network,
you are agreeing to the above disclaimer.

9. Finally

	I think it's a good program, and I can cite at least 75 people
who would (begrudgingly, I'm sure) agree.  You should most certainly
install the program and try it!!


				-- Dave Taylor
				
				hplabs!taylor

March 13th, 1986
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 5333 ]
  then
    echo $filename changed - should be 5333 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file README ----------

filename="README"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file README...
fi

cat << 'END-OF-FILE' > $filename
				ELM 1.1

Files contained within this release are;

CHANGES		-  a list of changes since 3.2 (as posted to mod.sources)
Instructions	-  how to make the entire system
Makefile	-  entire system make file
Overview	-  a brief overview of the mail system
README          -  this file

in directory "bin"
  makelisting	-  tool to help create nice listings

in directory "doc"
  Alias.guide   -  A short guide on using the alias system
  Config.guide	-  A Guide on how to configure the ELM system
  Users.guide	-  The Users guide on the mail system
  Ref.guide	-  The Reference guide on the mail system
  answer.1	-  The manual entry for the 'answer' command
  autoreply.1	-  The manual entry for the 'autoreply' command
  checkalias.1	-  The manual entry for the 'checkalias' command
  fastmail.1	-  The manual entry for the 'fastmail' command
  from.1	-  The manual entry for the 'from' command
  helpfile	-  The ELM system main helpfile
  elm.1		-  The manual entry for the 'elm' command
  elmrc.sample	-  A sample '.elmrc' file for reference
  newalias.1	-  The manual entry for the 'newalias' command
  newmail.1	-  The manual entry for the 'newmail' command
  printmail.1	-  The manual entry for the 'prntmail' command
  readmsg.1	-  The manual entry for the 'readmsg' command
  	
in directory "hdrs"
  curses.h	-  Include file for the cursor control library
  defs.h	-  Generic defines,  stuff like string lengths
  headers.h	-  External routine global variable defs
  elm.h		-  Main routine global variable defs
  sysdefs.h	-  System dependent defines.   Alter for your site!

in directory "src"
  Makefile	-  The make file for the ELM mailer itself...
  addr_utils.c  -  Utilities for manipulating addresses
  alias.c	-  The main alias routines
  aliasdb.c	-  The alias database (pathalias) routines
  aliaslib.c	-  Utility routines for the alias routines
  args.c	-  Starting arguments parsing routines
  bounceback.c  -  Generate a bounceback "cc" if desired
  connect_to.c  -  Routines to figure out whom this machine talks to
  curses.c	-  The cursor control package
  date.c	-  Routines that deal with dates and/or times
  delete.c	-  Delete message routines
  domains.c	-  The domain database routines
  encode.c	-  Crypt/decrypt routines
  file.c	-  File related commands
  file_utils.c	-  Utilities to do with files
  fileio.c	-  Reading and/or writing files
  hdrconfg.c	-  Edit message headers on outbound mail
  help.c	-  Help routine
  initialize.c  -  Initialize the system
  input_utils.c -  Utilities for data (keyboard) input
  leavembox.c   -  Processing for leaving a mailbox (quit or change)
  mailmsg1.c    -  Send a message (user input section)
  mailmsg2.c    -  Send a message (editing and system section)
  mailtime.c    -  When did we last read mail and so on
  mkhdrs.c      -  Create outgoing message headers 
  elm.c	        -  The main program!
  newmbox.c	-  Read in a new mailbox
  notesfile.c   -  Notes-related routines
  opt_utils.c   -  Optional utilities according to local Unix version
  output_utils.c-  Utilities for data (screen) output
  pattern.c     -  Pattern matching routines
  quit.c	-  Quit, removing deleted messages, etc
  read_rc.c	-  Read the users ".elmrc" file
  reply.c	-  Reply or Forward mail
  return_addr.c -  Compute return address, full or compressed
  savecopy.c 	-  To save a copy of an outbound message
  screen.c	-  Screen oriented routines
  showmsg.c	-  Show the current message on the screen
  softkeys.c	-  Routines to allow HP terminal softkey usage
  strings.c	-  General string library
  syscall.c	-  Make calls to the system
  utils.c	-  Generic utility routines for the system
  validname.c	-  Check to see if the specified name is a legal address

in directory "test"
  test.empty	-  An empty mailfile
  test.mail	-  Mail with all sorts of return addresses & headers
  test.notes	-  Notes for testing too

in directory "utils"
  Makefile	-  To make all the utilities herein.
  answer.c	-  Answering machine interface (for secretaries)
  arepdaemon.c	-  Daemon works in conjunction with autoreply
  autoreply.c	-  Automatically reply to users mail (vacation, etc)
  breakup.c	-  Test routine - not part of ELM!!!
  cutfile.c	-  Extract a specified piece of a file (internals)
  fastmail.c	-  Batch mail interface. 
  from.c	-  Display who messages are from in specified mailbox
  mailrc.awk	-  Awk script - see Alias Users Guide
  newalias.c	-  Install new aliases
  newmail.c	-  Daemon to keep you notified of new mail
  printmail.c	-  Interface to allow graceful printing of mailboxes
  wnewmail.c	-  Same as "newmail" but for windowing systems.
  readmsg.c	-  Read a specific message NOW
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 4669 ]
  then
    echo $filename changed - should be 4669 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

if [ ! -d bin ]
then
  echo creating directory bin
  mkdir bin
fi

# ---------- file bin/makelisting ----------

filename="bin/makelisting"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file bin/makelisting...
fi

cat << 'END-OF-FILE' > $filename
#!/bin/sh

# Shell script to make a listing file..

for file in `echo $* | tr -s ' ' '\012' | sort`
do
  /bin/echo \\f >> LISTING
  echo adding $file...
  cat $file >> LISTING
done
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 181 ]
  then
    echo $filename changed - should be 181 bytes, not $size bytes
  fi

  chmod 777 $filename
fi

# ---------- file bin/checkalias ----------

filename="bin/checkalias"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file bin/checkalias...
fi

cat << 'END-OF-FILE' > $filename
#!/bin/sh
if [ -z "$*" ]; then
  echo Usage: checkalias alias \[or aliases\]
  exit 1
fi
 
exec elm -c 
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 104 ]
  then
    echo $filename changed - should be 104 bytes, not $size bytes
  fi

  chmod 777 $filename
fi

# ---------- file bin/quickscreen ----------

filename="bin/quickscreen"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file bin/quickscreen...
fi

cat << 'END-OF-FILE' > $filename
 
# Mindbogglingly wierd script to allow UTS to use the Quickscreen 
#   cursor control package (don't ask) and also to have the other
#   systems just whiz along (so to speak)...

# Usage: quickscreen <define> <filename>.q

# if you're on a UTS system, you might want to put the absolute path
#   here for that 2 billionth of a femtosecond speedup...

quickscreen=qs

if [ $# != 1 ]
then 
  echo $0 called with more than one argument: $*
  exit 1
fi

(uname > /dev/null 2>&1)

if [ "$?" != "0" ]
then
 # hey!  maybe berkeley...it ain't UTS, fer sure!
  cfile=`basename $1 .q`.c
  if [ ! -f $cfile ] 
  then
    echo Warning: Can\'t find a $cfile in this directory\!\!
    exit 1
  fi
  touch $cfile
  exit 0
fi

if [ "`uname -s`" != "uts" ] 
then
  cfile=`basename $1 .q`.c
  if [ ! -f $cfile ] 
  then
    echo Warning: Can\'t find a $cfile in this directory\!\!
    exit 1
  fi
  touch $cfile
  exit 0
fi

# Oh my god - we're cruisin' along on a UTS system and have to
#             worry about this stuff for REAL!!

echo "	$quickscreen -q $1"
$quickscreen -q $2

exit $?
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1076 ]
  then
    echo $filename changed - should be 1076 bytes, not $size bytes
  fi

  chmod 777 $filename
fi

# ---------- file bin/mail.elm ----------

filename="bin/mail.elm"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file bin/mail.elm...
fi

cat << 'END-OF-FILE' > $filename

# 
# Script to mail off the shar files to a specified user...

if [ "$*" = "" ]
then
  echo Usage: $0 username or list-of-usernames
  exit 1
fi

for name in SH-Archive.*
do
  echo /usr/local/bin/elm -s \"Elm source - $name\" $* \< $name
  /usr/local/bin/elm -s "Elm source - $name" $* < $name
  echo sleeping...\\c
  sleep 900
  echo \\rwaking up..
done

exit 0
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 363 ]
  then
    echo $filename changed - should be 363 bytes, not $size bytes
  fi

  chmod 777 $filename
fi

if [ ! -d doc ]
then
  echo creating directory doc
  mkdir doc
fi

# ---------- file doc/answer.1 ----------

filename="doc/answer.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/answer.1...
fi

cat << 'END-OF-FILE' > $filename
.TH ANSWER 1L 
.ad b
.SH NAME
answer - phone message transcription system
.SH SYNOPSIS
.B answer
.PP
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Answer\^
is a part of the 
.B Elm
mail system and is designed for secretaries and the like
to allow them to answer phones and|or listen to phone message
machines and quickly and easily transcribe the messages into
electronic mail.
.P
The program uses it's own alias set (usually a subset of the
system aliases, with more fields per user (ie unique first
names, unique last names, first-initial lastname, and so on)).
Note this means that you must create and then install, using
.I newalias,
a separate alias table for the account this program is to 
be run from.
.P
Interface-wise, the program is a breeze to use - type 'answer'
to start it up and then merely type a user name at the
.nf
	
	Message to:

.fi
prompt, and then enter the message, ending with a blank line.
Names can be entered as 'Firstname Lastname' and the system
will try to find a mail alias based on the first letter of the
first name plus the last name.  For example, 'Dave Taylor'
will cause the program to search for an alias 'd_taylor' in
the file (note the transliteration into lower case).   The 
program will loop until killed or quit.
.P
.I Answer
can be easily exited by typing any of 'quit', 'exit' 'done', 
or 'bye' at the 'Message to:' prompt.
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories
.SH SEE ALSO
.I "Elm Alias Users Guide", 
by Dave Taylor
.sp
.br
newalias(1L), checkalias(1L), mail(1), mailx(1), from(1L), printmail(1L)
.SH FILES
$home/.alias_hash             individual alias hash table
.br
$home/.alias_data             individual alias data table
.br
/tmp/snd*                     edit buffer for outgoing mail
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1811 ]
  then
    echo $filename changed - should be 1811 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/autoreply.1 ----------

filename="doc/autoreply.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/autoreply.1...
fi

cat << 'END-OF-FILE' > $filename
.TH AUTOREPLY 1L 
.ad b
.SH NAME
autoreply - Automatic mail reply system
.SH SYNOPSIS
.B autoreply
.br
.B "autoreply off"
.br
.B autoreply
<
.B filename
>
.PP
.SH HP-UX COMPATIBILITY
.TP 10
Systems:
AT&T System V and Berkeley BSD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Autoreply\^
is a part of the 
.B Elm
mail system and is designed to enable users to easily set up
an automatic response to all mail they receive.  This is
typically during a vacation or some other period of time that
the user is not available to reply to mail (although some
people get enough mail that they have it permanently running
to simply send an "ack" to each message)
.PP
The system is quite easy to use...
You can type "autoreply" and be informed of your current
status in the system (on or off), or "autoreply off" will
turn your autoreplying off.
.PP
To add yourself to the system, you need merely to compose a
form response in a file somewhere, then type "autoreply <file>"
where <file> is the name of the file.
.SH "SPECIAL NOTE"
For this to function correctly, the program "arepdaemon" must
be running as a daemon in background.  This program automatically
checks all the currently enrolled users for new mail in their
mailboxes...
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories.
.SH SEE ALSO
.I "Elm Users Guide", 
by Dave Taylor
.sp
.br
mail(1), mailx(1), elm(1L)
.SH "BUGS"
Unfortunately, this program isn't too brilliant about identifying
mail that shouldn't be responded to (like mail from other
daemons, or your mother) but that's a more general problem anyway.
.sp
Also, occasionally a user will remove themselves from the
autoreply system and the system won't turn their autoreply
off.  This is a problem that hasn't been solved yet (obviously
since it's in the "bugs" section!!) and any further information
would be appreciated!
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1836 ]
  then
    echo $filename changed - should be 1836 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/checkalias.1 ----------

filename="doc/checkalias.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/checkalias.1...
fi

cat << 'END-OF-FILE' > $filename
.TH CHECKALIAS 1L
.ad b
.SH NAME
checkalias - check to see if an alias is defined.
.SH SYNOPSIS
.B checkalias
alias, alias, ...
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Checkalias
checks the user file first, and then the system alias file
to try to find the specified alias or aliases.  If found, 
the value of the alias is printed out, otherwise an error
is generated.
.P
Note: this is in fact a one-line shell script;
.nf

	elm -c $*

.fi
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories
.SH SEE\ ALSO
newalias(1L), elm(1L), mail(1), mailx(1)
.SH BUGS
Note that the precedence of aliases is user file then system
file.  This means that a user can 'overload' an alias by having
one defined in the system file also defined in theirs.  This
shouldn't turn out to be a problem, but is something for
the system administrator to keep in mind when creating the
system alias file.
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 938 ]
  then
    echo $filename changed - should be 938 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/fastmail.1 ----------

filename="doc/fastmail.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/fastmail.1...
fi

sed 's/^X//' << 'END-OF-FILE' > $filename
X.TH FASTMAIL 1L
X.ad b
X.SH NAME
Xfastmail - quick batch mail interface to a single address
X.SH SYNOPSIS
X.B fastmail
X[-b bcc-list] [-c cc-list] [-d] [-f fromname] [-r replyto] 
X[-s subject] filename address-list
X.br
X.SH HP-UX COMPATIBILITY
X.TP 10
XLevel:
XHP-UX/STANDARD
X.TP
XOrigin:
XHewlett-Packard
X.SH DESCRIPTION
X.I Fastmail
Xis a low-level interface to the mail system that allows batch
Xprocessing of mail.  It's intended for mailing to very large
Xgroups of people in a staggered fashion. 
X.PP
XThe starting options are;
X.TP 1.0i
X.B "-b bcc-list"
XThis allows a list of people to receive blind-carbon copies, or BCCs, of
Xthe message.  This list should be full email addresses.
X.TP
X.B "-c cc-list"
XThis allows a list of people to receive carbon copies, or CCs, of
Xthe message.  This list should be full email addresses.
X.TP
X.B "-d"
XDebug.  This is helpful for strange, unfriendly errors from
Xthe program (etc).
X.TP
X.B "-f from"
XThis overrides the users name in the From: line, so that if
Xthe user was x@y, and their name was MrX then the default 
XFrom: line would be "From: x@y (MrX)".  Using "-f Joe" when
Xinvoking this, though, would change it to "From: x@y (Joe)"
X.TP
X.B "-r replyto"
XOccasionally, you might send mail but want the replies to go
Xto a different address (very common with mailing lists).  
XThere is a header for this purpose called "Reply-To:" which
Xcan be utilized by using this starting option.  For example,
Xwe could send mail with a reply-to to list-request by
Xusing "-r list-request".  The header generated would then
Xbe of the form "Reply-To: list-request".
X.TP
X.B "-s subject"
XThe subject of the message is specified by using 
Xthis starting option.
X.SH EXAMPLE
XLet's say we're user "big" on machine "big-vax" and we have a
Xshell script called 'batch-mail' that contains the following
Xlines:
X.nf
X
X   #
X   # Batch Mail - batch mailing of a file to a LOT of users
X   #  
X   # Usage: batch-mail "from" "subject" filename
X
X   sender_copy = $LOGIN
X   replto = "The-Mr-Big-list"
X
X   fastmail -b $sender_copy -r $replyto -f "$1" -s "$2" $3 person1
X   sleep 10
X   fastmail -r $replyto -f "$1" -s "$2" $3 person2
X   sleep 10
X   fastmail -r $replyto -f "$1" -s "$2" $3 person3
X   sleep 10
X   fastmail -r $replyto -f "$1" -s "$2" $3 person4
X
X   < etc >
X
Xwith the invocation:
X
X   batch-mail "Mr. Big" "Warning to all" warning.text
X
X.fi
Xwould mail a copy of the 'warning.text' file to person1, person2, 
Xperson3, etc.  "$LOGIN" will also receive a copy of the first message
Xin the mail, \fIsilently\fR.  Each resultant message will include the headers:
X.nf
X
X    From: big-vax!big (Mr. Big)
X    Subject: Warning to all
X    Reply-To: The-Mr-Big-list
X
X.fi
XThis program should turn out to be considerably
Xfaster than the alternative methods of accomplishing this task.
X.SH FILES
X/usr/lib/sendmail       sendmail transport if available
X.br
X/bin/rmail              transport if no sendmail
X.br
X/tmp/fastmail.$$        temporary file 
X.SH AUTHOR
XDave Taylor, Hewlett-Packard Laboratories
X.SH SEE\ ALSO
Xsendmail(1), rmail(1), elm(1L)
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 3030 ]
  then
    echo $filename changed - should be 3030 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/from.1 ----------

filename="doc/from.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/from.1...
fi

cat << 'END-OF-FILE' > $filename
.TH FROM 1L
.ad b
.SH NAME
from - list from and subject of all messages in mailbox or file
.SH SYNOPSIS
.B from
[ filename ]
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I From
outputs a line per message in the current users mailbox 
of the form;
.PP
<from> [subject]
.PP
If a filename is specified, the program reads that file
rather than the default file.
.PP
Note that this program accepts the standard UNIX mail
headers and also accepts the modified headers that the
Shared Resource Manager mailer outputs...
.PP
Filename can be specified with the same notation as
when invoking the \fBElm\fR mailer.
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories.
.SH SEE\ ALSO
elm(1L), mail(1), mailx(1)
.SH BUGS
Occasionally it gets confused about whether a message has
a subject or not.  This, unfortunately, is due to the
vast number of possible headers in the messages...
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 925 ]
  then
    echo $filename changed - should be 925 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/elmrc.sample ----------

filename="doc/elmrc.sample"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/elmrc.sample...
fi

cat << 'END-OF-FILE' > $filename
#
# .msgrc - automatic variable defines for the 'msg' mailer.
#
# Personalized for ??
# 

# where to save my mail to, default directory
maildir  = ~/Mail

# where to save messages to, default file
mailbox  = ~/Mail/mailbox

# what editor to use
editor   = $EDITOR

# where to save mail if not specified somewhere else
savemail = ~/Mail/mail.sent

# how to print a message ('%s' is the filename)
print    = /usr/local/bin/print -p lpn -f %s

# prefix sequence for including message text in other messages...
prefix = > 

# what headers I DON'T want to see, ever.

weedout  = "Via:"  "Sent:"  "Date:"  "Status:"  "Original"
	   "From"  "Phase"  "Subject:"  "Fruit"  "Sun"
	   "Lat"  "Buzzword"  "Return"  "Posted" "Telephone"
	   "Postal-Address" "Origin" "X-Sent-By-Nmail-V"
	   "Resent" "X-Location"  "Source" "Mood"  "Neuron"
	   "Libido" "To:" "X-Mailer:"  "Full-Name:" "X-HPMAIL"
	   "Cc:" "cc:" "Mmdf" "Network-"

# automatically copy message being replied to into buffer? 
autocopy = OFF

# save a copy of all outbound messages? 
copy     = ON

# emulate the mailx message increment mode (only increment after something
# has been 'done' to a message, either saved or deleted)
resolve  = ON

# enable the weedout list to be read...
weed     = ON

# when messages are copied into the outbound buffer, don't include headers
noheader = ON

# display message title when displaying pages of message
titles	 = ON

# alternative addresses that I could receive mail from (usually a
# forwarding mailbox)

# alternatives = 
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1520 ]
  then
    echo $filename changed - should be 1520 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/newalias.1 ----------

filename="doc/newalias.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/newalias.1...
fi

cat << 'END-OF-FILE' > $filename
.TH NEWALIAS 1L
.ad b
.SH NAME
newalias - install new elm aliases for user and/or system
.SH SYNOPSIS
.B newalias
[-q]
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Newalias
creates new hash and data files from a text file.  If the
program is invoked by any account other than the superuser
account, the program looks for a file 
called $home/.alias_text
and, upon finding it, creates files $home/.alias_hash and
$home/.alias_data for the 
.I Elm
program.
.PP
If the superuser invokes the program, they are given the
option of either updating their personal alias files or
the system alias files.
The question can be supressed, with the default being
the user files for the superuser, if the ``-q'' flag is
present upon invokation.
.PP
The format that the program expects is;
.sp
.nf
	alias, alias, .. : comment : address
or
	alias, alias, .. : comment : alias, alias, ...
   
The first form is for an individual user such as;

	dave, taylor : Dave Taylor : veeger!hpcnou!dat

and the second is for defining a group alias such as;

	gurus : Unix Gurus : alan, john, dave, mike, richard,
		             larry, t_richardson

.fi
.sp
Note that lines can be continued at will, blank lines are accepted
without error, and that any line starting with '#' is considered a
comment and is not processed.
.PP
The comment field is thrown away by this program, but it is 
recommended that it contain the name of the user who the alias
is for.
.PP
Finally, aliases can contain other aliases, and/or groups;
.sp
.nf
	unix : Unix people : gurus, taylor, jonboy
.fi
' onto the next page, if you please
.sp 3
.SH FILES
$home/.alias_text               alias source for user 
.br
$home/.alias_hash               alias hash table for user
.br
$home/.alias_data               alias data file for user
.br
/usr/mail/.alias_text           alias source for system
.br
/usr/mail/.alias_hash           alias hash table for system
.br
/usr/mail/.alias_data           alias data file for system
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories.
.SH SEE\ ALSO
elm(1L), checkalias(1L), mail(1), mailx(1)
.SH DIAGNOSTICS
Newalias has a couple of descriptive error messages which
don't need to be detailed here.  It is, however, worth
noting that the
.I checkalias
program can be used to ensure that the aliases are in the
proper order and are available for the 
.I Elm
system.
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 2404 ]
  then
    echo $filename changed - should be 2404 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/newmail.1 ----------

filename="doc/newmail.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/newmail.1...
fi

cat << 'END-OF-FILE' > $filename
.TH NEWMAIL 1L 
.ad b
.SH NAME
newmail - daemon to asynchronously notify of new mail
.SH SYNOPSIS
.B newmail
.br
.B newmail
filename
.PP
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Newmail\^
is a daemon designed to run in background and every 60 seconds
check to see if there is any new mail for the user that
started it up.
.P
If there is new mail, the program will asynchronously write to
the terminal that it was started on a message of the form
.nf

   New mail from <name> - <subject>

.fi
where <name> is either the name of the person sending it,
if available (the ARPA 'From:' line) or machine!login where
machine is the machine the mail was sent from.  If there
is no subject, the message "<no subject>" will appear on
the screen.
.P
This program will run forever, and can internally reset 
itself if mail is deleted from the incoming mailbox while
trying to monitor it.
.P
If \fBnewmail\fR is started up with a filename, it will
perform exactly the same, but with the specified file as
the one to check rather than the default users mailbox.
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories.
.SH SEE ALSO
notify in sh(1) or csh(1), announce(1L)
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 1214 ]
  then
    echo $filename changed - should be 1214 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

# ---------- file doc/printmail.1 ----------

filename="doc/printmail.1"

if [ -f $filename ]
then
  echo File \"$filename\" already exists\!  Skipping...
  filename=/dev/null		# throw it away
else
  echo extracting file doc/printmail.1...
fi

cat << 'END-OF-FILE' > $filename
.TH PRINTMAIL 1L
.ad b
.SH NAME
printmail - format mail in a readable fashion for printing
.SH SYNOPSIS
.B printmail
{-d}
{filename}
.SH HP-UX COMPATIBILITY
.TP 10
Level:
HP-UX/STANDARD
.TP
Origin:
Hewlett-Packard
.SH DESCRIPTION
.I Printmail
copies all messages from either the file specified or the
default user mailbox separated by form feeds to standard output.  
With the
.B \-d
option, the messages are separated by a dashed line
rather than the formfeed (for lots of little mail).
.sp
.P
If the program is given a file as standard input, it will
use that instead of the default mailbox for the operation
specified.
.SH EXAMPLE
A typical usage of this command is;
.nf
	printmail -d | print 
.fi
.SH AUTHOR
Dave Taylor, Hewlett-Packard Laboratories.
.SH SEE\ ALSO
elm(1L), mail(1), mailx(1), from(1L)
END-OF-FILE

if [ "$filename" != "/dev/null" ]
then
  size=`wc -c < $filename`

  if [ $size != 806 ]
  then
    echo $filename changed - should be 806 bytes, not $size bytes
  fi

  chmod 644 $filename
fi

echo end of this archive file....
exit 0