[comp.mail.elm] Elm 2.1 PL 1 part 1 of 22

syd@dsinc.UUCP (Syd Weinstein) (12/11/88)

This is the source to Elm as of Patch Level 1, All documentation
is enclosed near the front of the 22 parts.  Please see my prior
message to comp.mail.elm for details on problems.
---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  README
#	  Overview
#	  NOTICE
#	  MANIFEST
#	  Instruct
#	  Changes
#	  Configure
#	  Makefile.mt
#	  doc/Alias.guide
#	  doc/Config.guid
#	  doc/Elm.cover
#	  doc/Filter.guid
#	  doc/Form.guide
#	  doc/Ref.guide
#	  doc/Users.guide
#	  doc/answer.1
#	  doc/autoreply.1
#	  doc/chkalias.1
#	  doc/elm-help.0
#	  doc/elm-help.1
#	  doc/elm-help.2
#	  doc/elm.1
#	  doc/elmrc-info
#	  doc/elmrc.samp
#	  doc/fastmail.1
#	  doc/filter.1
#	  doc/frm.1
#	  doc/listalias.1
#	  doc/messages.1
#	  doc/newalias.1
#	  doc/newmail.1
#	  doc/printmail.1
#	  doc/readmsg.1
#	  doc/wnewmail.1
#	  filter/Makefile.mt
#	  filter/actions.c
#	  filter/buffer.c
#	  filter/filter.c
#	  filter/lock.c
#	  filter/parse.c
#	  filter/rules.c
#	  filter/summarize.c
#	  filter/utils.c
#	  filter/utils2.c
#	  hdrs/curses.h
#	  hdrs/defs.h
#	  hdrs/elm.h
#	  hdrs/filter.h
#	  hdrs/headers.h
#	  hdrs/patchlevel.h
#	  hdrs/save_opts.h
#	  hdrs/shortname.1
#	  hdrs/shortname.2
#	  hdrs/shortname.h
#	  hdrs/sysdefs.mt
#	  src/Makefile.mt
#	  src/addr_util.c
#	  src/alias.c
#	  src/aliasdb.c
#	  src/aliaslib.c
#	  src/args.c
#	  src/bouncebk.c
#	  src/builtin.c
#	  src/calendar.c
#	  src/conn_to.c
#	  src/curses.c
#	  src/date.c
#	  src/delete.c
#	  src/domains.c
#	  src/edit.c
#	  src/editmsg.c
#	  src/elm.c
#	  src/encode.c
#	  src/errno.c
#	  src/expires.c
#	  src/file.c
#	  src/file_util.c
#	  src/fileio.c
#	  src/forms.c
#	  src/getopt.c
#	  src/hdrcfg_b.c
#	  src/hdrconfg.c
#	  src/help.c
#	  src/in_utils.c
#	  src/init.c
#	  src/leavembox.c
#	  src/limit.c
#	  src/mailmsg1.c
#	  src/mailmsg2.c
#	  src/mailtime.c
#	  src/mkhdrs.c
#	  src/newmbox.c
#	  src/opt_utils.c
#	  src/options.c
#	  src/out_utils.c
#	  src/pattern.c
#	  src/pmalloc.c
#	  src/quit.c
#	  src/read_rc.c
#	  src/remail.c
#	  src/reply.c
#	  src/returnadd.c
#	  src/save_opts.c
#	  src/savecopy.c
#	  src/screen.c
#	  src/showmsg.c
#	  src/showmsg_c.c
#	  src/signals.c
#	  src/softkeys.c
#	  src/sort.c
#	  src/string2.c
#	  src/strings.c
#	  src/syscall.c
#	  src/utils.c
#	  src/validname.c
#	  test/test.empty
#	  test/test.mail
#	  utils/Makefile.mt
#	  utils/answer.c
#	  utils/arepdaem.c
#	  utils/autoreply.c
#	  utils/expand.c
#	  utils/fastmail.c
#	  utils/from.c
#	  utils/getopt.c
#	  utils/listalias.c
#	  utils/mailrc.awk
#	  utils/newalias.c
#	  utils/newmail.c
#	  utils/postmail.c
#	  utils/readmsg.c
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
for i in doc filter hdrs src test utils
do
	if test ! -d $i
	then
		echo "Creating $i directory"
		mkdir $i
	fi
done
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XThis is the 2.1 version of Dave Taylor's Elm mail system.
X
XElm 2.1 is Dave's 2.0 gamma with a the portability and bug issues fixed by
Xthe elm development group and the elm testing group.
X
XSee the NOTICE and README files for further details.
X
X					Syd Weinstein
X					Elm Coordinator
X					syd@dsinc.UUCP
X					(dsinc!syd)
SHAR_EOF
chmod 0444 README || echo "restore of README fails"
echo "x - extracting Overview (Text)"
sed 's/^X//' << 'SHAR_EOF' > Overview &&
X			An Overview of the Elm Mail System
X			----------------------------------
X
XIntroduction
X
X	This file discusses the functionality of the Elm mail system
Xand explains some of the motivation behind the various features.
X
X1. What is Elm?
X
X	Currently on Unix, there seems to be a preponderence of line-oriented 
Xsoftware.  This is most unfortunate as most of the software on Unix tends to
Xbe pretty darn hard to use!  I believe that there is more than a slight
Xcorrelation between the two, and, since I was myself having problems using
X"mailx" with high-volume mail, I created a new mail system.
X
X	In the lingo of the mail guru, Elm is a "User Agent" system,  it's
Xdesigned to run with "sendmail" or "/bin/rmail" (according to what's on
Xyour system) and is a full replacement of programs like "/bin/mail" and
X"mailx".  The system is more than just a single program, however, and
Xincludes programs like "from" to list a 'table of contents' of your
Xmail, "printmail" to quickly paginate mail files (to allow 'clean'
Xprintouts), and "autoreply", a systemwide daemon that can autoanswer
Xmail for people while they're on vacation without having multiple
Xcopies spawned on the system.
X
X2. What's New about Elm?
X
X	The most significant difference between Elm and earlier mail
Xsystems is that Elm is screen-oriented.  Upon further use, however,
Xusers will find that Elm is also quite a bit easier to use, and quite
Xa bit more "intelligent" about sending mail and so on.   For example,
Xsay you're on "usenet" and receive a message from someone on the
XARPANET.  The sender also "cc'd" another person on ARPA.  With Elm
Xyou can simply G)roup reply and it will build the correct return
Xaddresses.
X
X	There are lots of subtleties like that in the program, most of
Xwhich you'll probably find when you need them.
X
X3. What systems does it work on?
X
X	Elm was originally written on HP-UX, HP's proprietary version
Xof Bell system V, with a little BSD thrown in.  Since then, it has been
Xported to Bell, Berkeley, Sun, UTS and the Pyramid and should run on 
Xall these systems without any modifications (if there turn out to be 
Xmodifications, please notify the author as soon as possible).
X
X	Some people have expressed interest in porting the mail system
Xto Xenix.  If it is indeed 100% system V compatible it should be rather
Xtrivial...
X
X4. Does it obey existing mail standards?
X
X	Yes!  That's another of the basic reasons the program was 
Xoriginally written!  To ensure that the date field, the "From:" line
Xand so on were all added in the correct format.  The program is 100%
Xcorrect according to the RFC-822 electronic mail header protocol
Xguide.
X
X5. What were the main motivating factors?
X
X	The first two I've already mentioned, but here's a (somewhat
Xpartial) list;
X
X	-  To have a mail system that exploited the CRT instead of
X	   assuming I'm on a teletype.
X
X	- To have a mailer that was 100% correct when dealing with	 
X	  network mail (ie RFC-822).
X
X	- To create a system that needed no documentation for the
X	  casual user, but was still powerful enough and sophisticated
X	  enough for a mail expert.
X
X	- To write a "significant" piece of software as a learning
X	  experience (I admit it!)
X
X	- To find out how reasonable it is to try to modify a program
X	  to meet the expectations of the users, rather than vice-versa.
X
X	- To basically correct some of the dumb things that the current
X	  mailers do, like letting you send mail to addresses that it
X	  could trivially figure out are going to result in 'dead.letter'
X
X	- To tie in intimately with the pathalias program output, and
X	  allow users to specify machine!user or user@machine and have
X	  the COMPUTER do the work of figuring out addresses...
X
X6. Is it reliable?
X
X	The mailer, in various incarnations, has logged literally
Xthousands upon thousands of hours without any problems that aren't
Xnow corrected.  As new problems arise they're dealt with in as
Xrapid a manner as possible...
X
X7. What should I do now?
X
X	The first step would be to install the mail system and have
Xthe "elm" mailbox/alias expand to my email address (hplabs!taylor).
XThen, once it's all up and running, drop me a line letting me know
Xthat your site is running the system (bookkeeping) and what you and
Xyour site think of it.
X
X	REMEMBER: The product is evolving so if you'd like to have a
Xsomething change, or have something new added, LET ME KNOW!!!  I'd 
Xmuch rather make the change myself than start getting change reports
Xmailed from around the world!!
X
X8. Disclaimers 
X
X	The author of this program will deny all liability for any
Xdamages, either real or imagined, due to the execution of this program
Xor anything related to either the software or the system.  Furthermore,
Xthe entire system and all source within, including the presentation
Xscreens and commands, are legally copyrighted by the author, and while
Xthey can be used, and abused, for public domain systems, it will be in 
Xviolation of the law if used in systems or programs sold for profit.
X
X	By installing the mailer or even extracting it from the network,
Xyou are agreeing to the above disclaimer.
X
X9. Finally
X
X	I think it's a good program, and I can cite at least 75 people
Xwho would (begrudgingly, I'm sure) agree.  You should most certainly
Xinstall the program and try it!!
X
X
X				-- Dave Taylor
X				
X				taylor@hplabs.HP.COM
X
XMarch 13th, 1986
SHAR_EOF
chmod 0444 Overview || echo "restore of Overview fails"
echo "x - extracting NOTICE (Text)"
sed 's/^X//' << 'SHAR_EOF' > NOTICE &&
X
X                The Elm(tm) Mail System General Public License
X  		 
X
X		    (C) Copyright 1986, 1987, 1988, by Dave Taylor
X
X
X			  	COPYING POLICIES
X
X     Permission is hereby granted for copying and distribution of copies of
X  the Elm source files, and that of any part thereof, subject to the following 
X  license conditions:
X
X        1. You may, without additional permission from the author, distribute 
X           Elm or components of Elm, with or without additions developed by 
X           you or by others at no charge.  You may also distribute Elm along 
X           with any other product for sale, provided that the cost of the 
X           bundled package is the same regardless of whether Elm is included,
X           and provided that those interested only in Elm must be notified 
X           that it is a product freely available from the author.
X
X        2. Furthermore, if you distribute Elm software or parts of Elm, with 
X           or without additions developed by you or others, then you must 
X           either make available the source to all portions of the Elm system 
X           (exclusive of any additions made by you or by others) upon request, 
X           or instead you may notify anyone requesting source that it is 
X           freely available from the author.
X
X        3. In addition, you may not omit any of the copyright notices
X           on either the source files, the executable file, or the 
X           documentation, and
X
X        4. Also, you may not omit transmission of this License agreement with 
X           whatever portions of Elm that are distributed.
X
X        5. Lastly, any users of this software must be notified that it is
X           without warrantee or guarantee of any nature, express or implied, 
X           nor is there any fitness for use represented.
X
XSoftware is a malleable thing - especially Unix - and the author can in no
Xway guarantee that using this program will not cause grevious damage to your
Xsystem.  Of course this isn't anticipated, but if it does happen, the author
Xcannot be held liable for any damages either directly or indirectly caused
Xby this event.
X
XModification of the system is encouraged, providing that the portions of 
Xthe system that are from the original still carry the appropriate copyright
Xnotices and that the changed sections are clearly delimited as such.  The
Xauthor requests copies of any changes made to ensure that the various versions
Xstay reasonably in sync with each other.
X
XNOTE that it is not permitted to copy, sublicense, distribute or transfer any
Xof the Elm software except as expressly indicated herein.  Any attempts to
Xdo otherwise will be considered a violation of this license and your rights
Xto the Elm software will be voided.
X
X
XComments on the system and/or this licensing agreement is encouraged.  Send
Xelectronic mail to "taylor@hplabs.HP.COM".  This license was written with
Xhelp from Scott McGregor.  Thanks Scott!
X
X----
XElm is a trademark of Dave Taylor. 
X
XNOTE: Elm is now in the public trust. Comments, suggestions, bug reports and the
Xlike should be sent to Syd Weinstein; syd@dsinc.UUCP (dsinc!syd)
SHAR_EOF
chmod 0444 NOTICE || echo "restore of NOTICE fails"
echo "x - extracting MANIFEST (Text)"
sed 's/^X//' << 'SHAR_EOF' > MANIFEST &&
XREADME
XOverview
XNOTICE
XMANIFEST
XInstruct
XChanges
XConfigure
XMakefile.mt
Xdoc/Alias.guide
Xdoc/Config.guid
Xdoc/Elm.cover
Xdoc/Filter.guid
Xdoc/Form.guide
Xdoc/Ref.guide
Xdoc/Users.guide
Xdoc/answer.1
Xdoc/autoreply.1
Xdoc/chkalias.1
Xdoc/elm-help.0
Xdoc/elm-help.1
Xdoc/elm-help.2
Xdoc/elm.1
Xdoc/elmrc-info
Xdoc/elmrc.samp
Xdoc/fastmail.1
Xdoc/filter.1
Xdoc/frm.1
Xdoc/listalias.1
Xdoc/messages.1
Xdoc/newalias.1
Xdoc/newmail.1
Xdoc/printmail.1
Xdoc/readmsg.1
Xdoc/wnewmail.1
Xfilter/Makefile.mt
Xfilter/actions.c
Xfilter/buffer.c
Xfilter/filter.c
Xfilter/lock.c
Xfilter/parse.c
Xfilter/rules.c
Xfilter/summarize.c
Xfilter/utils.c
Xfilter/utils2.c
Xhdrs/curses.h
Xhdrs/defs.h
Xhdrs/elm.h
Xhdrs/filter.h
Xhdrs/headers.h
Xhdrs/patchlevel.h
Xhdrs/save_opts.h
Xhdrs/shortname.1
Xhdrs/shortname.2
Xhdrs/shortname.h
Xhdrs/sysdefs.mt
Xsrc/Makefile.mt
Xsrc/addr_util.c
Xsrc/alias.c
Xsrc/aliasdb.c
Xsrc/aliaslib.c
Xsrc/args.c
Xsrc/bouncebk.c
Xsrc/builtin.c
Xsrc/calendar.c
Xsrc/conn_to.c
Xsrc/curses.c
Xsrc/date.c
Xsrc/delete.c
Xsrc/domains.c
Xsrc/edit.c
Xsrc/editmsg.c
Xsrc/elm.c
Xsrc/encode.c
Xsrc/errno.c
Xsrc/expires.c
Xsrc/file.c
Xsrc/file_util.c
Xsrc/fileio.c
Xsrc/forms.c
Xsrc/getopt.c
Xsrc/hdrcfg_b.c
Xsrc/hdrconfg.c
Xsrc/help.c
Xsrc/in_utils.c
Xsrc/init.c
Xsrc/leavembox.c
Xsrc/limit.c
Xsrc/mailmsg1.c
Xsrc/mailmsg2.c
Xsrc/mailtime.c
Xsrc/mkhdrs.c
Xsrc/newmbox.c
Xsrc/opt_utils.c
Xsrc/options.c
Xsrc/out_utils.c
Xsrc/pattern.c
Xsrc/pmalloc.c
Xsrc/quit.c
Xsrc/read_rc.c
Xsrc/remail.c
Xsrc/reply.c
Xsrc/returnadd.c
Xsrc/save_opts.c
Xsrc/savecopy.c
Xsrc/screen.c
Xsrc/showmsg.c
Xsrc/showmsg_c.c
Xsrc/signals.c
Xsrc/softkeys.c
Xsrc/sort.c
Xsrc/string2.c
Xsrc/strings.c
Xsrc/syscall.c
Xsrc/utils.c
Xsrc/validname.c
Xtest/test.empty
Xtest/test.mail
Xutils/Makefile.mt
Xutils/answer.c
Xutils/arepdaem.c
Xutils/autoreply.c
Xutils/expand.c
Xutils/fastmail.c
Xutils/from.c
Xutils/getopt.c
Xutils/listalias.c
Xutils/mailrc.awk
Xutils/newalias.c
Xutils/newmail.c
Xutils/postmail.c
Xutils/readmsg.c
SHAR_EOF
chmod 0644 MANIFEST || echo "restore of MANIFEST fails"
echo "x - extracting Instruct (Text)"
sed 's/^X//' << 'SHAR_EOF' > Instruct &&
X				Instructions
X				------------
X
X		        Last Update: $Date: 88/09/15 19:43:13 $
X
X
X	This file contains instructions on how to create and install
Xthe entire ELM mail system.  It should be read BEFORE any attempts
Xare made at actually creating and/or installing any of the software
Xcontained herein!
X
X	There is actually really one step needed - unpack all the shar
Xfiles and then;
X
X	$ cd <where-ever you're keeping the Elm sources>
X
X	$ sh Configure
X
X	Answer the questions of that program,, then let it create the
Xlocalized Makefiles and system definition files for you.  When it's
Xdone you can double check the configuration (or customize it further)
Xby reading the Configuration Guide + editing the file
X"hdrs/sysdefs.h".  There are lots of neat features that are unique to
Xthis mailer - it's worth a quick perusal at least!  Especially since
XConfigure does not change all of the possible options.
X
X	Once you're happy with the localized files, you then need to
X	create the documentation (so there's a bit of a catch-22 that
Xyou need to format the Configuration guide before you are happy with
Xthe localization but can't do that until you're happy with the
Xlocalization...oh well).
X
X	$
X
X	$ make documentation
X
X    When that's done, or even if it fails (don't worry too much about
Xit), do the following:
X
X	$ mkdir bin
X	$ make -i all > MAKELOG 2>&1 &
X	$ tail -f MAKELOG
X
X    (if you're in "csh", substitute: "make -i all >& MAKELOG &")
X
XThis will take a fair while, so it's recommended that you go and eat 
Xlunch or play a game for a while!! (alternatively, spend lots of money
Xon a really FAST machine and blink your eyes a few times...)
X
XAssuming there are no errors during compilation (we'll have to assume
Xthat for the moment) you should now be able to list the directory "bin"
Xand find the following files:
X
X  answer        checkalias     filter         messages      printmail
X  arepdaemon    elm            frm            newalias      readmsg
X  autoreply     fastmail       listalais      newmail
X
Xnext, you can install all the software on your system by;
X
X	$ make -i install
X	
XNote: the mailer runs as setgid mail to have the ability to WRITE
Xto the mail directory (for lock files).   If you have a different
Xscheme at your site, feel free to set it up to use that instead.
X
XFinally, we're just about done!   The final checks can be made
Xby the following commands:
X
X	$ elm -z
X
Xshould say "no mail" if nothing's in your incoming mailbox or should
Xstart up the Elm program if there is, and
X
X	$ elm -f test/test.mail
X
Xshould read in EIGHT messages from various people.  While here, try to
XA)lias C)urrent message for each of the eight messages to confirm that
Xthe reply/address system is working okay.  Now Q)uit without having 
Xmarked anything for deletion...answer the questions accordingly.
X
XIf you get this far you're in wonderful shape!  In fact, you're done!
X
XCongratulations!  You've just installed one of the best electronic mail
Xsystems available today on your machine (if I say so myself!)
X
XHANDY HINTS:  If you want to create a print of the entire set of
Xsources, including this file, use the command:
X
X	$ make listing
X
XIf, on the other hand, you just want to create a listing file of 
Xjust the Elm sources, try:
X
X	$ make elm-listing
X
XAlso, if you have a number of machines on a network, you can rlogin
Xto the remote machine and then do a remote install (after checking
Xto ensure that the networking copy method in the Makefile under the
Xtarget "remote-install" is correct) by typing:
X
X	$ make -f <remote Makefile> REMOTE=<remote file system> rmt-install
X
X(for example, if we had installed the system on machine "machx" and 
X wanted to install it on "machy", with the Makefile in /src/Elm on
X "machx", we could type from "machy";
X	 $ make -f machx:/src/Elm/Makefile REMOTE=machx: rmt-install
X to have it install the system on machine y!)
X
XOne final note for non-US distribution - the program might complain
Xat link time that it can't find "crypt()".  If so, and if you cannot
Xobtain a copy, you should merely instruct your users to not use the
Xencrypted mail option on outgoing mail.
X
XThat's it!
X----------
X
X	Author's address:	taylor@hplabs.HP.COM
X				{ucbvax,ihnp4,inria,...}!hplabs!taylor
X
X	Mail address:		Dave Taylor
X				Hewlett Packard Laboratories - 3L
X				1501 Page Mill Road
X				Palo Alto CA
X				94304
X
X  This document and the entire mail system is
X
X	(C) Copyright 1986, 1987 by Dave Taylor
X
XElm is now in the public trust.  Bug reports, comments, suggestions,
Xetc. should be sent to:
X
X	Elm group's address:	syd@dsinc.UUCP
X				dsinc!syd
X
X	Mail address:		Syd Weinstein
X				Datacomp Systems, Inc.
X				3837 Byron Road
X				Huntingdon Valley, PA 19006-2320
SHAR_EOF
chmod 0444 Instruct || echo "restore of Instruct fails"
echo "x - extracting Changes (Text)"
sed 's/^X//' << 'SHAR_EOF' > Changes &&
XThis file describes changes made to the Elm source distribution, and at
Xleast some attempt to justify those changes.
X
X        Syd Weinstein		Thu Sep 15 19:23:31 EDT 1988
X
X************************************************************************
X*       The 2.1 release is essentially the 2.0 gamma HP internal
X	release with all posted patches for portibility issues
X	and fixes applied. NO patches for new features were applied.
X	I may have let a few slip in, some of you made them too
X	seamless.
X
X*       All .c and .h files (plus a few others that seem important)
X	have been put under RCS control on my machine.
X
X*       The following filenames have been changed. This is so that
X	those of us still stuck with 14 character filenames (*sigh*
X	thanks AT&T) can use RCS (which needs the ,v suffix) and
X	dist, which needs to apply the patchnumber.  Thus there is now
X	an 11 character limit on file names. (* boo *)
X	Affected files are:
X
X		Configure.sh		--->	Configure
X		Instructions		--->	Instruct
X                Makefile.mstr		--->    Makefile.mt
X		doc/Filter.guide	--->	doc/Filter.guid
X		doc/Config.guide	--->	doc/Config.guid
X		doc/checkalias.1	--->	doc/chkalias.1
X		doc/elmrc.sample	--->	doc/elmrc.samp
X                filter/Makefile.mstr	--->    filter/Makefile.mt
X		hdrs/shortnames.1	--->	hdrs/shortname.1
X		hdrs/shortnames.2	--->	hdrs/shortname.2
X		hdrs/shortnames.h	--->	hdrs/shortname.h
X		hdrs/sysdefs.mast	--->	hdrs/sysdefs.mt
X                src/Makefile.mstr	--->    src/Makefile.mt
X		src/addr_utils.c	--->	src/addr_util.c
X		src/bounceback.c	--->	src/bouncebk.c
X		src/connect_to.c	--->	src/conn_to.c
X		src/returnaddr.c	--->	src/returnadd.c
X		src/file_utils.c	--->	src/file_util.c
X		src/hdrconfg_b.c	--->	src/hdrcfg_b.c
X		src/initialize.c	--->	src/init.c
X		src/showmsgcmd.c	--->	src/showmsg_c.c
X                utils/Makefile.mstr	--->    utils/Makefile.mt
X		utils/arepdaemon.c	--->	utils/arepdaem.c
X
X
X*       All the roff .c and .h files have had a header added to them.
X	This includes the RCS log info, so we know what we've done. In
X	addition, each source file has a ident char array defined. It
X	looks weird to you RCS types because I've included the SCCS
X	what(1) token in it too.  This will allow both RCS ident(1) and
X	SCCS what(1) utilities to check versions on the compiled files.
X	If you plan on doing any substantial development work on Elm, I
X	suggest putting it under RCS control. This can be done quite
X	easily by using "ci -k". This will search the files for keyword
X	values to establish the correct revision, date, author and
X	state.
X
SHAR_EOF
chmod 0444 Changes || echo "restore of Changes fails"
echo "x - extracting Configure (Text)"
sed 's/^X//' << 'SHAR_EOF' > Configure &&
X: Use /bin/sh
X# $Id: Configure,v 2.1.1.2 88/09/23 syd Exp $
X# 
X#
X# Configure.sh, a shell script for configuring the Elm mail system for
X# 	your site and desires.  This script uses some ideas ripped out
X#	of the 'rn' install script.  Thanks Larry!
X#
X
X
Xexport PATH || (sh $0 ; kill $$)
X
XSHELL=/bin/sh
X
XSED1=/tmp/Elm.sed1
XSED2=/tmp/Elm.sed2
X
Xif [ -f /bin/rm ]
Xthen
X  rm=/bin/rm
Xelse
X  rm=rm
Xfi
X
X$rm -f $SED1 $SED2
Xtouch $SED1 $SED2
Xchmod 777 $SED1 $SED2
X
X# first test - is stdin still free for answering questions??
Xif [ ! -t 0 ]
Xthen
X  echo "Please use 'sh Configure.sh' rather than 'sh < Configure.sh'"
X  exit 1
Xfi
X
X# next let's see what sorta echo flag we have here...
X
Xif [ "`echo -n`" = "-n" ]
Xthen
X  nflag=""
X  cflag="\\c" 
Xelse
X  nflag="-n"
X  cflag=""
Xfi
X
X# now the intro blurb
X
Xcat << END_OF_INTRO
X
X       		    elm Configuration Script$Revision: 2.1.1.2 $
X       
X      
X    This is the configuration script for the Elm mail system.  By using
X    it rather than editing the "hdrs/sysdefs.h" file, it is hoped that
X    the installation process will be considerably easier.
X
X    On all questions, the value in [square brackets] is the default that 
X    will be used if you just press RETURN...
X
X
XEND_OF_INTRO
X
Xecho "Trying to figure out what sort of OS you're on..."
X
X# next interesting part - figure out what OS we're on
X
Xos_name=""
X
X$rm -f .osname
Xtouch .osname
X
Xcat << 'EOF' > .get_osname
X
Xuname
X
Xif [ $? != 0 ] 
Xthen
X  if [ -f /xenix ]
X  then
X      case "`uname -p`" in
X	i80286) echo "xenix286" > .osname ;;
X	i80386) echo "xenix386" > .osname ;;
X      esac
X      exit 0
X  fi
X  if [ -f /vmunix ]
X  then
X    echo "bsd" > .osname
X  else
X    if [ -f /dynix ]
X    then
X      echo "sequent" > .osname
X    else
X      exit 0
X    fi
X  fi
Xfi
X
Xif [ "`uname -s`" != "" ]
Xthen
X   uname -s | tr '[A-Z]' '[a-z]' > .osname
Xfi
X
Xif [ -d /.attbin ]
Xthen
X  echo "pyramid" > .osname
Xfi
X
Xexit 0
X 
XEOF
X
Xsh .get_osname > /dev/null 2>&1
X
Xif [ -f .osname ] 
Xthen
X  os_name="`cat .osname`"
X  $rm -f .osname
Xfi
X
X$rm -f .get_osname
X
Xif [ "$os_name" = "" ] 
Xthen
X  cat << THE_END
X
XI cannot figure out what sort of operating system you're running here.  Please
Xtype in the NAME of the OS you're running or the name of the machine you're
XTHE_END
X
X  echo $nflag "running on.  I'll check the name in a minute : " $cflag
X
X  read junk morejunk
X  
X  os_name=`echo $junk | tr '[A-Z]' '[a-z]'`
Xfi
X
XOS_FLAG="HUH??"
X
Xwhile [ "$OS_FLAG" = "HUH??" ]
Xdo
X
X  case $os_name in
X    hp)		NAME="HP-UX"; OS_FLAG=""		;;
X    hp-ux) 	NAME="HP-UX"; OS_FLAG="";   		;;
X    vax)	NAME="BSD"; OS_FLAG="BSD";  	;;
X    vaxen)	NAME="BSD"; OS_FLAG="BSD";  	;;
X    bsd)	NAME="BSD"; OS_FLAG="BSD";  	;;
X    uts)	NAME="UTS"; OS_FLAG="UTS";  	;;
X    sun)	NAME="Sun"; OS_FLAG="BSD";		;;
X    pyramid|osx*)NAME="Pyramid BSD"; OS_FLAG="PYRAMID";	;;
X    amdahl)	NAME="UTS"; OS_FLAG="UTS";  	;;
X    sv_*)	NAME="System V"; OS_FLAG="";		;;
X    svii_*)	NAME="System VII"; OS_FLAG="";		;;
X    v5)		NAME="System V"; OS_FLAG="";		;;
X    system?5)	NAME="System V"; OS_FLAG="";		;;
X    sequent)	NAME="Sequent BSD"; OS_FLAG="BSD"; sequent=1; ;;
X    v7)		NAME="System VII"; OS_FLAG="";		;;
X    v.3)	NAME="System V.3"; OS_FLAG="SYSV_3";    ;;
X    eunice)	NAME="Eunice"; OS_FLAG="";		;;
X    convergent)	NAME="Convergent BSD"; OS_FLAG="BSD";		;;
X    berkeley)	NAME="BSD"; OS_FLAG="BSD";		;;
X    ultrix)	NAME="System V" ; OS_FLAG="";		;;
X    xenix286)	NAME="XENIX System V 80286" ; OS_FLAG="XENIX286" ;;
X    xenix386)	NAME="XENIX System V 80386" ; OS_FLAG="XENIX386" ;;
X    *)		cat << THE_END
X
XI don't know what OS you're specifying!  The only one's I know of are;
X
Xhp-ux	- Hewlett-Packard's HP-UX
Xbsd	- Fairly vanilla BSD (i.e 4.2 & 4.3 - might work on earlier versions)
Xuts	- Amdahl's UTS     
Xeunice  - Quasi UNIX running under VMS. It's not pretty, but it sorta works...
Xxenix   - Xenix 5 with a semi smart compiler that groks long identifiers.
Xultrix  - DEC's bastardized BSD dirivative.
Xv.3	- AT&T System V release 3. Also for UNIX V/386 (which is close enough)
Xv5	- AT&T System V release 2. Should also work with release 0 and 1.
Xv7 	- AT&T System VII - If you don't know what this is, you don't need it.
X
XI also know the machines
X
X  HP, Amdahl, Sun, Vaxen, Convergent and Pyramid
X
XIf you're not among this list, you'll need to pick the closest OS name.  
XTHE_END
X
X    echo " "
X    echo $nflag "Please choose again: " $cflag
X    read os_name
X    ;;
X  esac
X
Xdone
X
Xecho " "
Xecho " "
Xecho you\'re on the following version of Unix: $NAME
X
Xecho " "
Xecho "Now we can get down to those questions..."
Xecho " "
X
Xcat << THE_END
X
XFirst off, should the program use "uuname" rather than trying to read 
XTHE_END
X
Xnot_using_lsys_file=0
X
Xanswer="yes"
Xif [ "$OS_FLAG" = "SYSV_3" ]; then
X  echo $nflag "the Systems file (y/n) [yes] ? "  $cflag
X  echo "s/L\.sys/Systems/" >> $SED1
Xelif [ -f /usr/lib/uucp/Systems ]; then
X  echo $nflag "the Systems file (y/n) [yes] ? "  $cflag
X  echo "s/L\.sys/Systems/" >> $SED1
Xelse
X  echo $nflag "the L.sys file (y/n) [yes] ? "  $cflag
Xfi
Xread answer
X
Xif [ "$answer" = "n" -o "$answer" = "no" ]
Xthen
X  not_using_lsys_file=1
X  echo "s/#define USE_UUNAME/\/** #define USE_UUNAME **\//" >> $SED1
Xfi
X
Xcat << THE_END
X
XNext, some sites are configured so that the low level transport mechanism
Xis supposed to resolve and rewrite uucp paths, unreachable domains/networks,
Xand so on.  Is your site running either "smail", a "gateway" configuration 
Xof sendmail, or some similar software? (you can also view this as meaning
XTHE_END
X
Xanswer="no"
Xdont_touch_addresses=0
Xecho $nflag \
X  "that Elm shouldn't touch any outbound mail addresses.) (y/n) [no] ? " \
X  $cflag
Xread answer
X
Xif [ "$answer" = "y" -o "$answer" = "yes" ]
Xthen
X  dont_touch_addresses=1
X  echo \
X"s/\/\*\* #define DONT_TOUCH_ADDRESSES \*\*\//#define DONT_TOUCH_ADDRESSES /" \
X  >> $SED1
X# The following code will only add the -s flag on System V release 3 machines
X# that are not running smail, sendmail or some such (vanilla rmail):
Xelif [ "$OS_FLAG" = "SYSV_3" ]; then
X  echo "s./bin/rmail./bin/rmail -s." >> $SED1
Xfi
X
Xcat << THE_END
X
XOne of the more annoying quirks of the UUCP network and various other systems
Xthat interact with it are that everyone seems to have different ideas about
Xhow to do routing, etc.  Therefore, a lot of times email will arrive from
Xoffsite with corrupt, unreply-able "Reply-To:" and "From:" fields.  This
Xnext question relates to whether your site is liable to get mangled fields
Xor not...
X
XDoes your site receive email with valid "Reply-To:" and "From:" fields in
XTHE_END
X
Xanswer="no"
Xecho $nflag "the headers (y/n) [no] ? " $cflag
Xread answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" ]
Xthen
X  echo \
X"s/#define USE_EMBEDDED_ADDRESSES/\/** #define USE_EMBEDDED_ADDRESSES **\//" \
X  >> $SED1
Xfi
X
Xcat << THE_END
X
X-------------------------------------------------------------------------------
X
XHow about memory?  If you have a lot, you can enter a fairly large number
Xfor the next few questions...if not, you'll probably want to enter the
Xsuggested small-system values.  (This applies to the speed of the swapping
Xon your system too - if you're on a FAST system, use the big values!)
X
XFirst, how many aliases should be allowed for an individual user? The suggested
Xvalues are 503 for blindly fast systems, 251 for average systems and 127 for
XTHE_END
X
Xmax_ualiases="NONE"
X
Xwhile [ "$max_ualiases" = "NONE" ] 
Xdo 
X
X  echo $nflag "slow systems.  Number of aliases [251] ? " $cflag 
X
X  read junk
X
X  if [ "$junk" = "" ] 
X  then
X    junk=251
X  fi
X
X  if [ "$junk" -lt 50 -o "$junk" -gt 1000 ] 
X  then
X    echo \
X"Pretty strange answer!  I think you should reconsider and try this question "\
X    echo "again..."
X    echo " "
X  else
X    max_ualiases=$junk
X    echo "s/>251</$max_ualiases/" >> $SED1
X    case "$junk" in
X	127) default=223	;;
X	503) default=739	;;
X	*  ) default=503	;;
X    esac
X  fi
Xdone
X
Xmax_saliases="NONE"
X
Xwhile [ "$max_saliases" = "NONE" ] 
Xdo 
X
X  echo $nflag "Max number of system aliases available  [$default] ? " $cflag
X
X  read junk
X
X  if [ "$junk" = "" ] 
X  then
X   junk=$default
X  fi
X
X  if [ "$junk" -lt 50 -o "$junk" -gt 1000 ] 
X  then
X    echo "Pretty far out value for this question!  I think you should reconsider"
X    echo "your answer and try this question again..."
X    echo " "
X  else
X    max_saliases=$junk
X    echo "s/>503</$max_saliases/" >> $SED1
X  fi
Xdone
X
Xcat << THE_END
X
XThe next pair of questions have to do with what to do when another program has 
Xlocked a mailbox...
X
XFirst, how many times should the program check for the removal of the lock
XTHE_END
X
Xdefault=6
X
Xmax_attempts="NONE"
X
Xwhile [ "$max_attempts" = "NONE" ] 
Xdo 
X
X  echo $nflag "file before giving up? [6] " $cflag
X
X  read junk
X
X  if [ "$junk" = "" ] 
X  then
X   junk=$default
X  fi
X
X  if [ "$junk" -lt 3 -o "$junk" -gt 10 ] 
X  then
X    echo \
X"The recommended range is 3-10   ...Number of times to check lock"
X  else
X    max_attempts=$junk
X    echo "s/>6</$max_attempts/" >> $SED1
X  fi
Xdone
X
Xecho " "
Xanswer="no"
Xecho $nflag "Should it REMOVE the lockfile after $max_attempts checks [no] ?" \
X     $cflag
Xread answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" ]
Xthen
X  echo \
X"s/#define REMOVE_AT_LAST/\/** #define REMOVE_AT_LAST **\//" \
X  >> $SED1
Xfi
X
Xcat << EOF
X
XA lot of sites that install the Elm Mail System find that the function
XE)dit mailbox from within Elm is dangerous and confusing.  If you choose,
Xyou can instead disable that function, with the program being slightly
Xsmaller and presenting an appropriate error message to the user if they
Xtry to E)dit their mailbox.
X
XEOF
Xecho " "
Xanswer="no"
Xecho $nflag "Would you like to enable the E)dit Mailbox function? [no] ?" \
X     $cflag
Xread answer
X
Xif [ "$answer" = "y" -o "$answer" = "yes" ]
Xthen
X  echo \
X"s/\/\*\* #define ALLOW_MAILBOX_EDITING \*\*\//#define ALLOW_MAILBOX_EDITING/" \
X  >> $SED1
Xfi
X
Xif [ "$OS_FLAG" = "BSD" ]
Xthen 
X  ps="ps -cax"
Xelse
X  ps="ps -ef"
Xfi
X
Xecho " "
Xecho " "
Xecho "poking about a bit.."
X
Xresult="`$ps | grep sendmail | grep -v grep`"
X
Xif [ "$result" = "" ]
Xthen
X  if [ -x /usr/lib/sendmail -a -f /usr/lib/sendmail.cf ]
X  then
X    echo \(sendmail available - assuming you don\'t run it as a daemon\)
X    result="ok"
X  fi
Xfi
X
Xif [ "$result" != "" ]
Xthen
X  echo "You're running sendmail.  Well done, I guess..."
X  echo "s/\/\*\* #define ALLOW_BCC \*\*\//#define ALLOW_BCC/" \
X    >> $SED1
X  echo "s/\/\*\* #define DONT_ADD_FROM \*\*\//#define DONT_ADD_FROM/" \
X    >> $SED1
X    echo \
X "s/#define USE_DOMAIN/\/** #define USE_DOMAIN **\//" \
X    >> $SED1
Xelse
X
X  cat << THE_END
X
XSince you're not running sendmail, should I check local user entered addresses
XTHE_END
X
Xanswer="yes"
Xecho $nflag "against the valid mailboxes on this system [yes] ? " $cflag
Xread answer
X
Xif [ "$answer" = "y" -o "$answer" = "yes" -o "$answer" = "" ]
Xthen
X  echo \
X"s/#define NOCHECK_VALIDNAME/\/** #define NOCHECK_VALIDNAME **\//" \
X  >> $SED1
Xfi
X
Xcat << THE_END
X
XAre you running a machine where you want to have a domain name appended to the
XTHE_END
X
Xanswer="yes"
Xecho $nflag "hostname on outbound mail [no] ? " $cflag
Xread answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" ]
Xthen
X    echo \
X "s/#define USE_DOMAIN/\/** #define USE_DOMAIN **\//" \
X    >> $SED1
Xelse
X  echo " "
X  echo $nflag "Enter the domain name (include leading '.') : " $cflag
X  read answer
X  echo "s/<enter your domain here>/$answer/" >> $SED1
Xfi
X
Xfi
X
X# If we're not a BSD system, do we have utimbuf defined somewhere?        
X
Xcat << EOF > .test.c
X#include <stdio.h>
X#include <fcntl.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#define far /* to keep XENIX from complaining */
X#include <sys/file.h>
X#include <time.h>
Xmain()
X{
Xstruct utimbuf test;
Xexit(1);
X}
XEOF
X
Xif [ "$OS_FLAG" = "UTS" ]
Xthen
Xcat << EOF > .utimb
Xcc -la .test.c
XEOF
Xelse
Xcat << EOF > .utimb
Xcc .test.c
XEOF
Xfi
X
Xif [ "$OS_FLAG" != "BSD" ]
Xthen
X  sh .utimb > .log 2>& 1
X
X  if [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
X  then
X    echo "You're system defines utimbuf. Excellent!!!"
X  else
X    cat << THE_END
X
XYour machine doesn't seem to define utimbuf! That's ok though, you're not 
Xalone. I'll define one for you.
XTHE_END
X
X    echo "s/\/\*\* #define NOUTIMBUF \*\*\//#define NOUTIMBUF/" >>$SED1
X  fi
Xfi
Xrm -f a.out .test.c .utimb .log .test.o
X
X# next let's see if we can find the mkdir command on this system..
X
Xcat << EOF > .test.c
Xmain()
X{
X	(void) mkdir();
X}
XEOF
X
Xif [ "$OS_FLAG" = "UTS" ]
Xthen
Xcat << EOF > .mkdir
Xcc -la .test.c
XEOF
Xelse
Xcat << EOF > .mkdir
Xcc .test.c
XEOF
Xfi
X
Xsh .mkdir > .log 2>& 1
X
Xif [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
Xthen
X  echo "You have the mkdir call..."
Xelse
X  cat << THE_END
X
XYour machine doesn't seem to have the mkdir() call. I guess we'll have to use
Xthe mkdir(1) command instead. (*sigh*)
XTHE_END
X
X    echo "s/\/\*\* #define NOMKDIR \*\*\//#define NOMKDIR/" >> $SED1
Xfi
X
X$rm -f a.out .test.c .mkdir .log .test.o
X
X# next let's see if we can find the vfork command on this system..
X
Xcat << EOF > .test.c
Xmain()
X{
X	(void) vfork();
X}
XEOF
X
Xif [ "$OS_FLAG" = "UTS" ]
Xthen
Xcat << EOF > .vfork
Xcc -la .test.c
XEOF
Xelse
Xcat << EOF > .vfork
Xcc .test.c
XEOF
Xfi
X
Xsh .vfork > .log 2>& 1
X
Xif [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
Xthen
X  echo "You have virtual memory system calls available.  Cool..."
Xelse
X  cat << THE_END
X
XYour machine doesn't seem to have the vfork command available.  Should I assume
XTHE_END
X
X  answer="no"
X  echo $nflag "you have it, anyway [no] ? " $cflag
X  read answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" ]
X  then
X    echo "s/\/\*\* #define NO_VM \*\*\//#define NO_VM/" >> $SED1
X  fi
Xfi
X
X$rm -f a.out .test.c .vfork .log .test.o
X
X# next let's see if we have the gethostname() system call...
X
Xcat << EOF > .test.c
Xmain()
X{
X	(void) gethostname();
X}
XEOF
X
Xcat << EOF > .hostname
Xcc .test.c
XEOF
X
Xsh .hostname > .log 2>& 1
X
Xif [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
Xthen
X  echo "You have the 'gethostname()' system call..."
Xelse
X  echo "s/\/\*\* #define NEED_GETHOSTNAME \*\*\//#define NEED_GETHOSTNAME/" \
X  >> $SED1
Xfi
X
X$rm -f a.out .test.c .hostname .log .test.o
X
X# how about the cuserid() routine?
X
Xcat << EOF > .test.c
Xmain()
X{
X	(void) cuserid();
X}
XEOF
X
Xcat << EOF > .cuserid
Xcc .test.c
XEOF
X
Xsh .cuserid > .log 2>& 1
X
Xif [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
Xthen
X  echo "You have the 'cuserid()' system call..."
Xelse
X  echo "s/\/\*\* #define NEED_CUSERID \*\*\//#define NEED_CUSERID/" \
X  >> $SED1
Xfi
X
X$rm -f a.out .test.c .cuserid .log .test.o
X
X# next let's see if we have long variable names...
X
Xcat << EOF > .test.c
Xmain()
X{
X	int this_is_a_long_variable=0;
X
X	(void) this_is_a_long_variable_routine_name(this_is_a_long_variable);
X	
X}
Xthis_is_a_long_variable_routine_name() { }
XEOF
X
Xcat << EOF > .varnames
Xcc .test.c
XEOF
X
Xsh .varnames > .log 2>& 1
X
Xif [ "`cat .log | sed -e '/opyrigh/d' -e '/^\.test\.c$/d' | wc -l`" -eq "0" ]
Xthen
X  echo "You have long variable names.  Well done!!!!!"
Xelse
X  echo "How embarassing.  Your C compiler doesn't support long variables..."
X  echo "s/\/\*\* #define SHORTNAMES \*\*\//#define SHORTNAMES/" \
X  >> $SED1
Xfi
X
X$rm -f a.out .test.c .varnames .log .test.o
X
Xif [ "$dont_touch_addresses" = 0 ]
Xthen
Xcat << THE_END
X
XWhen given a machine that you talk to directly, should the 'pathalias' route to
XTHE_END
X
X answer="no"
X echo $nflag "the machine be used instead [no] ? " $cflag
X read answer
X
X if [ "$answer" != "y" -a "$answer" != "yes" ]
X then
X    echo \
X "s/#define LOOK_CLOSE_AFTER_SEARCH/\/** #define LOOK_CLOSE_AFTER_SEARCH **\//"\
X    >> $SED1
X fi
Xfi
X
Xanswer="yes"
Xecho " "
Xecho $nflag "Is the preferred address notation 'user@host' [yes] ?" $cflag
Xread answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" -a  "$answer" != "" ]
Xthen
X    echo \
X "s/#define INTERNET_ADDRESS_FORMAT/\/** #define INTERNET_ADDRESS_FORMAT **\//" \
X    >> $SED1
Xfi
X
Xecho " "
Xanswer="yes"
Xecho $nflag "Am I going to be running as a setgid program [yes] ? "$cflag
Xread answer
X
Xif [ "$answer" != "y" -a "$answer" != "yes" -a "$answer" != "" ]
Xthen
X  echo answer is currently equal to \"$answer\"
X  echo \
X "s/#define SAVE_GROUP_MAILBOX_ID/\/** #define SAVE_GROUP_MAILBOX_ID **\//" \
X    >> $SED1
Xfi
X
X# Pick a default shell.
Xif [ -f /bin/ksh ]; then
X     defshell=/bin/ksh
Xelif [ -f /bin/csh ]; then
X     defshell=/bin/csh
Xelse
X     defshell=/bin/sh
Xfi
Xecho $nflag "What is the default shell to spawn [$defshell]? " $cflag
Xread answer
Xif [ "$answer" != "" ]; then
X     defshell=$answer
Xfi
Xecho "s.defshell.$defshell." >> $SED1
X    
Xcat << THE_END
X
X
XNow we need to set the group permission name.  On most systems it may be
X'mail', while on 4.3BSD it is 'wheel'.
X
XTHE_END
X
Xcase "$OS_FLAG" in
X    BSD)	default="wheel" ;;
X    XENIX*)	default="bin" ;;
X    *)		default="mail" ;;
Xesac
Xecho $nflag "What group name should we use [$default] ? " $cflag
Xread answer
Xcase "$answer" in
X    "")	echo "s^>mailgrp<^$default^" >> $SED2 ;;
X    *)	echo "s^>mailgrp<^$answer^" >> $SED2 ;;
Xesac
X
X   
Xcat << THE_END
X
X
XFor any of the questions after this point, you can press RETURN if the 
Xquestions doesn't apply, or there's no reasonable answer...
X
XTHE_END
X
Xif [ "$dont_touch_addresses" = 0 ]
Xthen 
X if [ ! -f /usr/lib/nmail.paths ] 
X then
X   echo $nflag "Where does the output of pathalias live ? " $cflag
X   read answer
X
X   if [ "$answer" != "" ]
X   then
X     echo "s^/usr/lib/nmail.paths^$answer^" >> $SED1
X   fi
X fi
Xfi
X
Xuse_dbm=0
X
Xif [ "$dont_touch_addresses" = 0 ]
Xthen
X  if [ -f "$answer.pag" -a -f "$answer.dir" ]
X  then
X    echo "You have pathalias as a DBM file...I'll use that instead."
X    echo "s^/\*\* #define USE_DBM \*\*/^#define USE_DBM^" >> $SED1
X    use_dbm=1
X  fi
Xfi
X
Xlist="
X    /usr/lib/libtermcap.a /lib/libtermcap.a
X    /lib/386/Slibtermcap.a /lib/Llibtermcap.a
X    /usr/lib/libtermlib.a /lib/libtermlib.a
X    /lib/386/Slibtermlib.a /lib/Llibtermlib.a
X    /usr/lib/libcurses.a /lib/libcurses.a
X    /lib/386/Slibcurses.a /lib/Llibcurses.a
X    BARFO
X"
Xfor try in $list ; do test -f "$try" && break ; done
Xcase "$try" in
X*termcap.a)	termlib="termcap" ;;
X*termlib.a)	termlib="termlib" ;;
X*curses.a)	termlib="curses" ;;
XBARFO)
X  echo "You don't have curses, termcap or termlib!  Using terminfo but it might fail"
X  termlib=termlib
X  ;;
Xesac
X
Xosdefine=""
Xlarge=""
Xcflags=""
Xlflags=""
Xgetopt="../src/getopt.o"
Xlibs="-l$termlib"
Xlib2=""
X
Xcase "$OS_FLAG" in 
XXENIX286)
X    echo "Assuming that your crypt library is loaded with '-lcrypt'."
X    osdefine="-DXENIX"
X    libs="$libs -lcrypt"
X    large="-LARGE"
X    cflags="-Ml2et32"
X    lflags="-Ml2t32 -F 4000 -SEG 512"
X    ;;
XXENIX386)
X    echo "Assuming that your crypt library is loaded with '-lcrypt'."
X    osdefine="-DXENIX"
X    libs="-l$termlib -lcrypt"
X    ;;
XBSD)
X    osdefine="-DBSD"
X    lib2="-lcurses"
X    if [ "$sequent" != 1 ] ; then
X	getopt=""
X    fi
X    ;;
XPYRAMID)
X    osdefine="-DBSD -DNO_VAR_ARGS"
X    lib2="-lcurses"
X    ;;
XUTS)
X    osdefine="-DUTS"
X    lib2="-la -lq"
X    libs="-lcurses"
X    ;;
Xesac
X
Xif [ "$use_dbm" = 1 ] ; then
X    libs="$libs -ldbm"
Xfi
Xecho "s^>os-define<^$osdefine^"	>> $SED2
Xecho "s^>large<^$large^"	>> $SED2
Xecho "s^>cflags<^$cflags^"	>> $SED2
Xecho "s^>lflags<^$lflags^"	>> $SED2
Xecho "s^>getopt<^$getopt^"	>> $SED2
Xecho "s^>libs<^$libs^"		>> $SED2
Xecho "s^>lib2<^$lib2^"		>> $SED2
X
X 
Xif [ "$dont_touch_addresses" = 0 ]
Xthen
X if [ ! -f /usr/lib/domains ] 
X then
X   echo $nflag "Where does the uumail-style 'domains' file live? " $cflag
X   read answer
X
X   if [ "$answer" != "" ]
X   then
X     echo "s^/usr/lib/domains^$answer^" >> $SED1
X   fi
X fi
Xfi
X
Xif [ "$not_using_lsys_file" = 1 ]
Xthen
X  if [ ! -f /usr/lib/uucp/L.sys ]
X  then
X    echo $nflag "Where does the 'L.sys' file live ? " $cflag
X    read answer
X
X    if [ "$answer" != "" ]
X    then
X      echo "s^/usr/lib/uucp/L.sys^$answer^" >> $SED1
X    fi
X  fi
Xfi
X 
Xif [ ! -d /tmp ]
Xthen 
X  echo $nflag "/tmp isn't a directory!  What should I use?? " $cflag
X  read answer
X
X  if [ "$answer" != "" ]
X  then
X    echo "s^/tmp^$answer^" >> $SED1
X  fi
Xfi
X
Xfor try in /usr/ucb/vi /usr/bin/vi /bin/vi ; do test -f $try && break ; done
Xif [ ! -f "$try" ] ; then
X  echo $nflag "I can't find the 'vi' editor!  Where is it? " $cflag
X  read try
Xfi
Xif [ "$try" != "" -a "$try" != "/usr/ucb/vi" ] ; then
X  echo "s^/usr/ucb/vi^$try^" >> $SED1
Xfi
X
Xfor try in /usr/spool/mail /usr/mail ; do test -d "$try" && break ; done
Xif [ ! -d "$try" ] ; then
X  echo $nflag "I can't find your inbound mail directory!  Where is it? " $cflag
X  read try
Xfi
Xif [ "$try" != "" -a "$try" != "/usr/spool/mail" ] ; then
X  echo "s^/usr/spool/mail^$try^" >> $SED1
Xfi
X
Xlist="/usr/ucb/Mail /usr/bin/mailx /usr/bin/mail"
Xfor try in $list ; do test -f "$try" && break ; done
Xif [ -f "$try" -a "$try" != "/usr/ucb/Mail" ] ; then
X  echo "s^/usr/ucb/Mail^$try^" >> $SED1
Xfi
X
Xif [ ! -f /bin/rm ]
Xthen
X  echo $nflag "Where's the 'rm' program? " $cflag
X  read answer
X
X  if [ "$answer" != "" ]
X  then
X    echo "s^/bin/rm^$answer^" >> $SED1
X  fi
Xfi
X
Xif [ ! -f /bin/cat ]
Xthen
X  echo $nflag "Where's the 'cat' program? " $cflag
X  read answer
X
X  if [ "$answer" != "" ]
X  then
X    echo "s^/bin/cat^$answer^" >> $SED1
X  fi
Xfi
X 
X# Note the change on the following - if we can't automatically figure
X# out where the tape device is, then we'll just bag it -- it doesn't 
X# much matter anyway.
X
Xif [ ! -f /dev/rct ]
Xthen
X  if [ ! -f /dev/rmt ]
X  then
X      echo "s^>tapeunit<^unknown-remote-tape-unit^" >> $SED2
X  else
X    echo "s^>tapeunit<^/dev/rmt^" >> $SED2
X  fi
Xelse
X  echo "s^>tapeunit<^/dev/rct^" >> $SED2
Xfi
X
Xif [ ! -d /usr/local/bin ]
Xthen
X  echo $nflag "Where do you want the system software installed? " $cflag
X  read answer
X
X  if [ "$answer" = "" ]
X  then
X    echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
X  else
X    if [ -d "$answer" ]
X    then
X      echo "s^>dest-dir<^$answer^" >> $SED2
X    else
X      echo "I don't know what you're talking about.  I'll set it to junk" 
X      echo "s^>dest-dir<^unknown-destination-directory^" >> $SED2
X    fi
X  fi
Xelse
X  echo "s^>dest-dir<^/usr/local/bin^" >> $SED2
Xfi
X
Xif [ ! -f /usr/bin/troff ]
Xthen
X  if [ ! -f /usr/local/bin/troff ]
X  then
X    if [ ! -f /usr/contrib/bin/troff ]
X    then
X      if [ ! -f /usr/ucb/troff ]
X      then
X        if [ ! -f /bin/troff ]
X        then
X          echo $nflag "Where does the 'troff' program live? " $cflag
X 	  read answer
X
X	  if [ "$answer" = "" ]
X	  then
X            echo "s/>troff</nroff/" >> $SED2
X	  else
X            if [ -f "$answer" ]
X	    then
X              echo "s^>troff<^$answer^" >> $SED2
X              troff=$answer
X	    else
X	      echo "Still can't find it.  I'll set it to \"nroff\" instead."
X              echo "s/>troff</nroff/" >> $SED2
X	    fi
X	  fi
X	else
X          echo "s^>troff<^/bin/troff^" >> $SED2
X          troff=/bin/troff
X        fi
X      else
X        echo "s^>troff<^/usr/ucb/troff^" >> $SED2
X        troff=/usr/ucb/troff
X      fi
X    else
X      echo "s^>troff<^/usr/contrib/bin/troff^" >> $SED2
X      troff=/usr/contribbin/troff
X    fi
X  else
X    echo "s^>troff<^/usr/local/bin/troff^" >> $SED2
X    troff=/usr/local/bin/troff
X  fi
Xelse
X  echo "s^>troff<^/usr/bin/troff^" >> $SED2
X  troff=/usr/bin/troff
Xfi
X
X# phew!
X
Xtroffdir=`dirname $troff`
X
Xif [ -f "$troffdir/tbl" ]
Xthen
X  echo "s^>tbl<^$troffdir/tbl^" >> $SED2
Xelse
X  echo $nflag "Where does the 'tbl' program live? " $cflag
X  read answer
X
X  if [ "$answer" = "" ]
X  then
X    echo "s^>tbl<^cat^" >> $SED2
X  elif [ -f "$answer" ]
X  then
X    echo "s^>tbl<^$answer^" >> $SED2
X  else
X    echo "I can't find that either.  I'll just set it to junk..."
X    echo "s^>tbl<^cat^" >> $SED2
X  fi
Xfi
X
Xif [ -f /bin/cc ]
Xthen
X  echo "s^>cc<^/bin/cc^" >> $SED2
Xelse
X  echo $nflag "Where does the 'C' compiler live? " $cflag
X  read answer
X
X  if [ "$answer" = "" ]
X  then
X    cat << THE_END
X
XI hope you realize that without a "C" compiler there's no point in doing any
Xof this.  If we can't compile anything then this is just so much disk filler.
X
XIn fact, thinking about it, let's just quit right now.
X
XTHE_END
X
X    exit 1
X  fi
X
X  if [ -f "$answer" ]
X  then
X    echo "s^>cc<^$answer^" >> $SED2
X  else
X    cat << THE_END
X
XI couldn't find what you specified, pal.  I hope you realize that without a 
X"C" compiler there's no point in doing any of this.  If we can't compile 
Xanything then this system is just so much disk filler.
X
XIn fact, thinking about it, let's just quit right now.
X
XTHE_END
X    exit 1
X  fi
Xfi
X
Xecho "s^>rm<^$rm -f^" >> $SED2
X
Xif [ -f /bin/mv ]
Xthen
X  echo "s^>mv<^/bin/mv -f^" >> $SED2
Xelse
X  echo "s^>mv<^mv -f^" >> $SED2  
Xfi
X
Xif [ -f /bin/cp ]
Xthen
X  echo "s^>cp<^/bin/cp^" >> $SED2
Xelse
X  echo "s^>cp<^cp^" >> $SED2  
Xfi
X
Xcat << END
X
XThat's it.  Just  have to do some patching up and such...hang loose for a 
Xminute or two, please...
X
XEND
X
X# process the four Makefiles accordingly...
X
Xecho "1 - processing the file \"Makefile\"..."
Xcat Makefile.mt | sed -f $SED2 > Makefile
X
Xecho "2 - processing the file \"src/Makefile\"..."
Xcat src/Makefile.mt | sed -f $SED2 > src/Makefile
X
Xecho "3 - processing the file \"utils/Makefile\"..."
Xcat utils/Makefile.mt | sed -f $SED2 > utils/Makefile
X
Xecho "4 - processing the file \"filter/Makefile\"..."
Xcat filter/Makefile.mt | sed -f $SED2 > filter/Makefile
X
X# then filter the sysdefs file through the sed script we've created!
X
Xecho "Finally, processing the file \"hdrs/sysdefs.h\"..."
X
Xif [ -f hdrs/sysdefs.h ]
Xthen
X  mv hdrs/sysdefs.h hdrs/sysdefs.old
Xfi
X
Xcat hdrs/sysdefs.mt | sed -f $SED1 > hdrs/sysdefs.h
X
Xecho Done\!
X
X$rm -f $SED1 $SED2
Xexit 0
SHAR_EOF
chmod 0444 Configure || echo "restore of Configure fails"
echo "x - extracting Makefile.mt (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile.mt &&
X#
X# $Id: Makefile.mt,v 2.1 88/09/15 19:55:01 syd Exp $
X#
X#  Makefile for the entire ELM mail system
X#
X#         (C) Copyright 1986, 1987, by Dave Taylor
X#
X#  $Log:	Makefile.mt,v $
X# Revision 2.1  88/09/15  19:55:01  syd
X# Initial 2.1 Release
X# 
X#
X#  88/09/08 gatech!uwvax.cs.wisc.edu!nicmad!brown (Mr. Video)
X#	fix for mail group and frm conversion
X#
X#  88/08/27 gatech!cos.COM!To.eric (Paul A. Ebersman)
X#	fix filter to require buffer
X#
X#  88/08/27 nicmad!brown (Mike Brown)
X#	fix alias to use tbl
X#
X# Original 2.1 version: July 15th, 1988 - Eric Christensen
X
XSHELL=/bin/sh
X
X#########################
X#
X# The following entries need to be customized for the local site:  
X#    The first is the address of the data-cassette drive to allow
X# easy tape copies to be made, and the second is the final location 
X# that all the software should be installed in when 'make install'
X# is run.
X#
X#########################
X
XMAILGRP=>mailgrp<
XTAPE=   >tapeunit< 
XDEST=   >dest-dir<
X
XLIB=    /usr/local/lib
XMAN=	/usr/local/man/man1
XCATMAN= /usr/local/man/cat1
XSHAR=   /usr/local/bin/shar -s 60000
X
XDEFINE = >os-define<
XLIB2   = >lib2<
X
X#########################
X
XLIBS=   >libs<
XCFLAGS= -O
XCC=	>cc<
XRM=	>rm<
XLN=	/bin/ln
XMV=     >mv<
XCP=	>cp<
X
X# if you want to use "nroff", change this...
SHAR_EOF
echo "End of part 1"
echo "File Makefile.mt is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0
-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.				Voice: (215) 947-9900
{allegra,bellcore,bpa,vu-vlsi}!dsinc!syd	FAX:   (215) 938-0235