[comp.sources.unix] v18i080: Elm mail system, release 2.2, Part01/24

rsalz@uunet.uu.net (Rich Salz) (04/11/89)

Submitted-by: dsinc!syd@uunet.UU.NET (Syd Weinstein)
Posting-number: Volume 18, Issue 80
Archive-name: elm2.2/part01

[  This is from the file "Overview..."  --r$  ]

	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 "frm" 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.



---- 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
#	  config.h.SH
#	  Makefile.SH
#	  doc/Alias.guide
#	  doc/Config.guid
#	  doc/Elm.cover
#	  doc/Filter.guid
#	  doc/Form.guide
#	  doc/Makefile.SH
#	  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-help.3
#	  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/tmac.n
#	  doc/wnewmail.1
#	  filter/Makefile.SH
#	  filter/actions.c
#	  filter/buffer.c
#	  filter/filter.c
#	  filter/lock.c
#	  filter/parse.c
#	  filter/rules.c
#	  filter/summarize.c
#	  filter/utils.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.SH
#	  src/Makefile.SH
#	  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/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.SH
#	  utils/answer.c
#	  utils/arepdaem.c
#	  utils/autoreply.c
#	  utils/checkalias
#	  utils/expand.c
#	  utils/fastmail.c
#	  utils/from.c
#	  utils/listalias.c
#	  utils/mailrc.awk
#	  utils/messages
#	  utils/newalias.c
#	  utils/newmail.c
#	  utils/printmail
#	  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
echo "Making directories"
mkdir doc filter hdrs src test utils
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XThis is the 2.2 release version of Dave Taylor's Elm mail system.
X
XElm 2.2 release is the 2.2 Version being prepared for release.
X
XSee the NOTICE and Instruct files for further details.
X
XLimitations/Problems you might encounter in installing Elm:
X
XThe Configuration script has been known to exceed the default stack
Xsize in Unix 286 sh's.  If Configure does not run correctly on this
Xtype of machine increase the stack size and rerun it.
XOn Microport SysV/AT machines, Configure will run correctly under
Xksh.  Obtain ksh from Microport (available to current version owners
Xwithout additional charge) and rerun Configure using it.
X
XAlso on Microport SysV/AT Machines, the C compiler produces improper code
Xfor one of the arithmetic calls.  To fix this problem it is necessary to
Xreduce the complexity of the statement, as reported by one of our testers
Xhere is the symptom and his patch.  Being this is a compiler bug on only
Xone system, we make the information available, but not incorporate it in
Xthe main release.  Note, this may effect other areas of Elm, and in the
Xfuture, Microport may even fix this problem.
X> I finally tracked down the bug that was causing the lengthy delays when
X> the first message was displayed.  The Microport 80286 C compiler was
X> generating bad code for the computation of padding in showmsg.c.  The
X> compiler generated scratch variables in the expression were being
X> located at weird offsets in the stack segment.  This caused the program
X> to stall while the kernel attempted to grow the stack segment to a size
X> that was large enough to contain the scratch variables.  This explains
X> why it only happened the first time a message was displayed.  Here is a
X> patch that fixes the problem:
X> 
X> *** showmsg.c.dist	Fri Mar 17 21:08:37 1989
X> --- showmsg.c	Sat Mar 18 06:14:04 1989
X> ***************
X> *** 280,289
X>   	           atoi(current_header->year), current_header->time);
X>   
X>   	  /* truncate or pad title2 portion on the right
X> ! 	   * so that line fits exactly */
X> ! 	  padding =
X> ! 	    COLUMNS -
X> ! 	    (strlen(title1) + (buf_len=strlen(title2)) + strlen(title3));
X>   
X>   	  sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
X>   	      buf_len+padding, title2, title3);
X> 
X> --- 280,292 -----
X>   	           atoi(current_header->year), current_header->time);
X>   
X>   	  /* truncate or pad title2 portion on the right
X> ! 	   * so that line fits exactly, expression has been
X> ! 	   * simplified to avoid bug in Microport 80286
X> ! 	   * C compiler */
X> ! 	  padding = COLUMNS;
X> ! 	  padding -= strlen(title1);
X> ! 	  padding -= (buf_len = strlen(title2));
X> ! 	  padding -= strlen(title3);
X>   
X>   	  sprintf(titlebuf, "%s%-*.*s%s\n", title1, buf_len+padding,
X>   	      buf_len+padding, title2, title3);
X> 
X> -- 
X> John A. Limpert
X> UUCP:	johnl@n3dmc.UUCP, johnl@n3dmc.UU.NET, uunet!n3dmc!johnl
X
X
XIf you run a nonstandard configuration of Mail, such as Xenix running smail,
XConfigure can get confused as to where to place items.  Be sure and check the
Xconfig.sh file for the correct placement before continuning.  If changes
Xare necessary, rerun Configure and fix the file before exiting.
X
XOn some systems, especially those based on the AT&T Port to 286's
Xthe -O flag of the compiler produces improper code causing segmentation
Xviolations.  If this happens, recompile the code without the -O flag.
XThis has been seen with Microport SysV/AT type systems.
X
X					Syd Weinstein
X					Elm Coordinator
X					elm@dsinc.UUCP
X					(dsinc!elm)
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 "frm" 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, Pyramid and Xenix 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
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. 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
X8. 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, by Dave Taylor
X                    (C) Copyright 1988, 1989, USENET Community Trust
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 authors, 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 Elm Development Group.
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 Elm Development Group.
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 authors 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 authors
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
Xauthors requests copies of any changes made to ensure that the various versions
Xstay reasonably in sync with each other.  Please send all revisions to
Xelm@dsinc.UUCP.
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; elm@dsinc.UUCP (dsinc!elm)
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
Xconfig.h.SH
XMakefile.SH
Xdoc/Alias.guide
Xdoc/Config.guid
Xdoc/Elm.cover
Xdoc/Filter.guid
Xdoc/Form.guide
Xdoc/Makefile.SH
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-help.3
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/tmac.n
Xdoc/wnewmail.1
Xfilter/Makefile.SH
Xfilter/actions.c
Xfilter/buffer.c
Xfilter/filter.c
Xfilter/lock.c
Xfilter/parse.c
Xfilter/rules.c
Xfilter/summarize.c
Xfilter/utils.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.SH
Xsrc/Makefile.SH
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/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.SH
Xutils/answer.c
Xutils/arepdaem.c
Xutils/autoreply.c
Xutils/checkalias
Xutils/expand.c
Xutils/fastmail.c
Xutils/from.c
Xutils/listalias.c
Xutils/mailrc.awk
Xutils/messages
Xutils/newalias.c
Xutils/newmail.c
Xutils/printmail
Xutils/readmsg.c
SHAR_EOF
chmod 0444 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: 89/03/23 16:15:01 $
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 and then rerunning Configure.
XThere are lots of neat features that are unique to this mailer - it's
Xworth a quick perusal at least!
X
X	Once you're happy with the localized files, you then need to
Xcreate the documentation (so there's a bit of a catch-22 that you need
Xto format the Configuration guide before you are happy with the
Xlocalization 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	$ make all > MAKELOG 2>&1 &
X	$ tail -f MAKELOG
X
X    (if you're in "csh", substitute: "make 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 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
XThat's it!
X----------
X
X	Author's address:	taylor@hplabs.HP.COM
X				hplabs!taylor
X
X  This document and the entire mail system is
X
X	(C) Copyright 1986, 1987 by Dave Taylor
X	(C) Copyright 1988, 1989 by the Usenet Community Trust
X
XElm is now in the public trust.  Bug reports, comments, suggestions,
Xetc. should be sent to:
X
X	Elm group's address:	elm@dsinc.UUCP
X				dsinc!elm
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.  Please remember that Elm
Xis a volunteer project, we did what we had time for, and perhaps, what
Xinterested us.  If you have a suggestion, or a fix, submit it, and better
Xyet, volunteer to impliment it.
X
X        Syd Weinstein		Thu Mar 30 16:10:23 EST 1989
X
X
X************************************************************************
X*       The 2.2 release is the result of many man-years of work by the
X	Elm Development and Testing Groups.  The changes are too many
X	to mention in their entirity, as I doubt I could even track
X	them all.  However this file will attempt to highlight some of
X	them.
X
X*       Many of the changes are internal and not visible.  These help
X	to make Elm more robust and more maintainable.  We still have a
X	long way to go in this direction, but Elm 2.2 is a step in the
X	right direction.
X
X*       This is not a patch to 2.1, but a complete new release.  Some
X	file names have changed, so do NOT put this release in the same
X	directory as the old one.
X
X*       The first change is a complete rewrite of the Configuration
X	system.  We are now using Larry Walls metaconfigure package
X	from his Dist V2.0 utilities.  This should make configuration
X	much easier, but also currently makes the configuration
X	questions appear is a non optimum order.
X
X*       The documentation has been rewritten from the mm macro set,
X	which is distributed only with USG type systems, to a
X	modification of the news macro set which is being distributed
X	with Elm.
X
X*       The interface to the internal and external pagers have been
X	rewritten to reduce problems.  The internal pager is still very
X	dumb.
X
X*       All system messages have been worked on to make them more
X	consistent.
X
X*	Numerious new elmrc options have been added.
X
X*       The system wide alias file has been moved from the spool
X	directory to the library directory.
X
X*       Elm has been made more compatible with Mailx and Mush for sites
X	that mix their usage.  To this end a Quick quit command has
X	been added as have Status headers.
X
X*	The batch send mode and the send only mode within Elm has
X	been changed to make it more consistent with the normal mode.
X
X*       Much work has been done to make Elm's curses more compatible
X	with more terminal types.  However this is an interim
X	solution.  Long term plans are to scrap the internal curses and
X	use the system curses.
X
X*	The meaning of the space bar has been changed to allow one to
X	page through their entire mailbox using the space bar.
X
X*	A copy command has been added, like the save command, but does
X	not mark the message for deletion.
X
X*	All headers are now saved to the mail archive file.
X
X*	The alias menu now has the ability to list and delete aliases.
SHAR_EOF
chmod 0444 Changes || echo "restore of Changes fails"
echo "x - extracting Configure (Text)"
sed 's/^X//' << 'SHAR_EOF' > Configure &&
X#! /bin/sh
X#
X# If these # comments don't work, trim them.  Don't worry about any other
X# shell scripts, Configure will trim # comments from them for you.
X#
X# (If you are trying to port this package to a machine without sh, I would
X# suggest you cut out the prototypical config.h from the end of Configure
X# and edit it to reflect your system.  Some packages may include samples
X# of config.h for certain machines, so you might look for one of those.)
X#
X# $Header: /files/home/users/syd/elm/RCS/Configure,v 2.37 89/03/29 09:19:46 syd Exp $
X#
X# Yes, you may rip this off to use in other distribution packages.
X# (Note: this Configure script was generated automatically.  Rather than
X# working with this copy of Configure, you may wish to get metaconfig.)
X
X: sanity checks
XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
X
Xif test ! -t 0; then
X    echo "Say 'sh Configure', not 'sh <Configure'"
X    exit 1
Xfi
X
X(alias) >/dev/null 2>&1 && \
X    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
X    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
X
Xif test ! -d ../UU; then
X    if test ! -d UU; then
X	mkdir UU
X    fi
X    cd UU
Xfi
X
Xcase "$1" in
X-d) shift; fastread='yes';;
Xesac
X
Xd_eunice=''
Xeunicefix=''
XLog=''
XHeader=''
Xcontains=''
Xcppstdin=''
Xcppminus=''
Xd_index=''
Xd_mkdir=''
Xd_portable=''
Xd_symlink=''
Xd_vfork=''
Xd_voidsig=''
Xd_whoami=''
Xn=''
Xc=''
Xpackage=''
Xspitshell=''
Xshsharp=''
Xsharpbang=''
Xstartsh=''
Xdefine=''
Xloclist=''
Xexpr=''
Xsed=''
Xecho=''
Xcat=''
Xrm=''
Xmv=''
Xcp=''
Xtail=''
Xtr=''
Xmkdir=''
Xsort=''
Xuniq=''
Xgrep=''
Xtrylist=''
Xtest=''
Xinews=''
Xegrep=''
Xmore=''
Xpg=''
XMcc=''
Xvi=''
Xmailx=''
Xmail=''
Xcpp=''
Xperl=''
Xemacs=''
Xls=''
Xrmail=''
Xsendmail=''
Xshar=''
Xsmail=''
Xtbl=''
Xtroff=''
Xnroff=''
Xuname=''
Xuuname=''
Xline=''
Xchgrp=''
Xchmod=''
Xlint=''
Xsleep=''
Xpr=''
Xtar=''
Xln=''
Xlpr=''
Xlp=''
Xtouch=''
Xmake=''
Xbin=''
Xd_calendar=''
Xcalendar=''
Xd_crypt=''
Xcryptlib=''
Xd_cuserid=''
Xd_flock=''
Xd_gethname=''
Xd_douname=''
Xd_phostname=''
Xd_host_comp=''
Xd_getopt=''
Xd_havedbm=''
Xdbm=''
Xd_havetlib=''
Xtermlib=''
Xd_internet=''
Xd_mboxedit=''
Xd_newauto=''
Xd_optreturn=''
Xd_pafirst=''
Xd_useuuname=''
Xd_notouchadd=''
Xd_noaddfrom=''
Xd_usedomain=''
Xd_nocheckvalid=''
Xd_remlock=''
Xmaxattempts=''
Xd_rename=''
Xd_setgid=''
Xmailermode=''
Xd_strings=''
Xd_pwdinsys=''
Xincludepath=''
Xd_tempnam=''
Xtempnamo=''
Xtempnamc=''
Xd_termio=''
Xd_tminsys=''
Xd_tz_min=''
Xd_useembed=''
Xd_utimbuf=''
Xdefbatsub=''
Xdefeditor=''
Xelmalias=''
Xmaxsysalias=''
Xmaxuseralias=''
Xhostname=''
Xphostname=''
Xmydomain=''
Xlib=''
Xlibc=''
Xlinepr=''
Xmaildir=''
Xmailer=''
Xmailgrp=''
Xmansrc=''
Xmanext=''
Xmodels=''
Xsplit=''
Xsmall=''
Xmedium=''
Xlarge=''
Xhuge=''
Xoptimize=''
Xccflags=''
Xldflags=''
Xcc=''
Xlibs=''
Xnametype=''
Xd_passnames=''
Xd_berknames=''
Xd_usgnames=''
Xpasscat=''
Xpager=''
Xpathalias=''
Xdomains=''
Xlsysfile=''
Xlsysvssys=''
Xprefshell=''
Xrmttape=''
Xroff=''
Xtmpdir=''
Xxencf=''
Xxenlf=''
Xd_xenix=''
Xd_bsd=''
XCONFIG=''
X: set package name
Xpackage=elm2
X
Xecho " "
Xecho "Beginning of configuration questions for $package kit."
X: Eunice requires " " instead of "", can you believe it
Xecho " "
X
Xdefine='define'
Xundef='undef'
Xlibpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large'
Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
Xrmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
Xtrap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
X
X: We must find out about Eunice early
Xeunicefix=':'
Xif test -f /etc/unixtovms; then
X    eunicefix=/etc/unixtovms
Xfi
Xif test -f /etc/unixtovms.exe; then
X    eunicefix=/etc/unixtovms.exe
Xfi
X
X: Now test for existence of everything in MANIFEST
X
Xecho "First let's make sure your kit is complete.  Checking..."
X(cd ..; cat `awk 'NR>4{print $1}' MANIFEST` >/dev/null || kill $$)
Xecho " "
X
Xattrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
Xattrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
Xattrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
Xattrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
Xattrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
Xattrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
Xd_newshome="/usr/NeWS"
Xdefvoidused=7
Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
X
X: check for out bin directory
Xif test ! -d ../bin; then
X    echo "Making bin directory"
X    mkdir ../bin
Xelse
X    echo "Found bin directory"
Xfi
X
X: some greps do not return status, grrr.
Xecho "grimblepritz" >grimble
Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
X    contains=contains
Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
X    contains=grep
Xelse
X    contains=contains
Xfi
Xrm -f grimble
X: the following should work in any shell
Xcase "$contains" in
Xcontains*)
X    echo " "
X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
X    cat >contains <<'EOSS'
Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
XEOSS
Xchmod +x contains
Xesac
X
X: first determine how to suppress newline on echo command
Xecho "Checking echo to see how to suppress newlines..."
X(echo "hi there\c" ; echo " ") >.echotmp
Xif $contains c .echotmp >/dev/null 2>&1 ; then
X    echo "...using -n."
X    n='-n'
X    c=''
Xelse
X    cat <<'EOM'
X...using \c
XEOM
X    n=''
X    c='\c'
Xfi
Xecho $n "Type carriage return to continue.  Your cursor should be here-->$c"
Xread ans
Xrm -f .echotmp
X
X: now set up to do reads with possible shell escape and default assignment
Xcat <<EOSC >myread
Xcase "\$fastread" in
Xyes) ans=''; echo " " ;;
X*) ans='!';;
Xesac
Xwhile expr "X\$ans" : "X!" >/dev/null; do
X    read ans
X    case "\$ans" in
X    !)
X	sh
X	echo " "
X	echo $n "\$rp $c"
X	;;
X    !*)
X	set \`expr "X\$ans" : "X!\(.*\)\$"\`
X	sh -c "\$*"
X	echo " "
X	echo $n "\$rp $c"
X	;;
X    esac
Xdone
Xrp='Your answer:'
Xcase "\$ans" in
X'') ans="\$dflt";;
Xesac
XEOSC
X
X: general instructions
Xcat <<EOH
X 
XThis installation shell script will examine your system and ask you questions
Xto determine how the $package package should be installed.  If you get stuck
Xon a question, you may use a ! shell escape to start a subshell or execute
Xa command.  Many of the questions will have default answers in square
Xbrackets--typing carriage return will give you the default.
X
XOn some of the questions which ask for file or directory names you are
Xallowed to use the ~name construct to specify the login directory belonging
Xto "name", even if you don't have a shell which knows about that.  Questions
Xwhere this is allowed will be marked "(~name ok)".
X
XEOH
Xrp="[Type carriage return to continue]"
Xecho $n "$rp $c"
X. myread
Xcat <<EOH
X
XMuch effort has been expended to ensure that this shell script will run
Xon any Unix system.  If despite that it blows up on you, your best bet is
Xto edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
Xknow how I blew it.  If you can't run Configure for some reason, you'll have
Xto generate a config.sh file by hand.
X
XThis installation script affects things in two ways: 1) it may do direct
Xvariable substitutions on some of the files included in this kit, and
X2) it builds a config.h file for inclusion in C programs.  You may edit
Xany of these files as the need arises after running this script.
X
XIf you make a mistake on a question, there is no easy way to back up to it
Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the
XSH files.  Configure will offer to let you do this before it runs the SH files.
X
XEOH
Xrp="[Type carriage return to continue]"
Xecho $n "$rp $c"
X. myread
X
X: get old answers, if there is a config file out there
Xif test -f ../config.sh; then
X    echo " "
X    dflt=y
X    rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
X    echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    n*) echo "OK, I'll ignore it.";;
X    *)  echo "Fetching default answers from your old config.sh file..."
X	tmp="$n"
X	ans="$c"
X        . ../config.sh
X	n="$tmp"
X	c="$ans"
X	;;
X    esac
Xfi
X
X: find out where common programs are
Xecho " "
Xecho "Locating common programs..."
Xcat <<EOSC >loc
X$startsh
Xcase \$# in
X0) exit 1;;
Xesac
Xthing=\$1
Xshift
Xdflt=\$1
Xshift
Xfor dir in \$*; do
X    case "\$thing" in
X    .)
X	if test -d \$dir/\$thing; then
X	    echo \$dir
X	    exit 0
X	fi
X	;;
X    *)
X	if test -f \$dir/\$thing; then
X	    echo \$dir/\$thing
X	    exit 0
X	elif test -f \$dir/\$thing.exe; then
X	    : on Eunice apparently
X	    echo \$dir/\$thing
X	    exit 0
X	fi
X	;;
X    esac
Xdone
Xecho \$dflt
Xexit 1
XEOSC
Xchmod +x loc
X$eunicefix loc
Xloclist="
Xcat
Xchgrp
Xchmod
Xcp
Xecho
Xexpr
Xgrep
Xln
Xls
Xmake
Xmv
Xrm
Xsed
Xsleep
Xtouch
Xtr
X"
Xtrylist="
XMcc
Xcpp
Xemacs
Xline
Xlint
Xlp
Xlpr
Xmailx
Xmore
Xnroff
Xpg
Xpr
Xrmail
Xsendmail
Xshar
Xsmail
Xtar
Xtbl
Xtest
Xtroff
Xuname
Xuuname
Xvi
X"
Xfor file in $loclist; do
X    xxx=`loc $file $file $pth`
X    eval $file=$xxx
X    eval _$file=$xxx
X    case "$xxx" in
X    /*)
X	echo $file is in $xxx.
X	;;
X    *)
X	echo "I don't know where $file is.  I hope it's in everyone's PATH."
X	;;
X    esac
Xdone
Xecho " "
Xecho "Don't worry if any of the following aren't found..."
Xans=offhand
Xfor file in $trylist; do
X    xxx=`loc $file $file $pth`
X    eval $file=$xxx
X    eval _$file=$xxx
X    case "$xxx" in
X    /*)
X	echo $file is in $xxx.
X	;;
X    *)
X	echo "I don't see $file out there, $ans."
X	ans=either
X	;;
X    esac
Xdone
Xcase "$egrep" in
Xegrep)
X    echo "Substituting grep for egrep."
X    egrep=$grep
X    ;;
Xesac
Xcase "$test" in
Xtest)
X    echo "Hopefully test is built into your sh."
X    ;;
X/bin/test)
X    if sh -c "PATH= test true" >/dev/null 2>&1; then
X	echo "Using the test built into your sh."
X	test=test
X    fi
X    ;;
X*)
X    test=test
X    ;;
Xesac
Xcase "$echo" in
Xecho)
X    echo "Hopefully echo is built into your sh."
X    ;;
X/bin/echo)
X    echo " "
X    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
X    $echo $n "hi there$c" >foo1
X    echo $n "hi there$c" >foo2
X    if cmp foo1 foo2 >/dev/null 2>&1; then
X	echo "They are compatible.  In fact, they may be identical."
X    else
X	case "$n" in
X	'-n') n='' c='\c' ans='\c' ;;
X	*) n='-n' c='' ans='-n' ;;
X	esac
X	cat <<FOO
XThey are not compatible!  You are probably running ksh on a non-USG system.
XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
Xhave echo built in and we may have to run some Bourne shell scripts.  That
Xmeans I'll have to use $ans to suppress newlines now.  Life is ridiculous.
X
XFOO
X	rp="Your cursor should be here-->"
X	$echo $n "$rp$c"
X	. myread
X    fi
X    $rm -f foo1 foo2
X    ;;
X*)
X    : cross your fingers
X    echo=echo
X    ;;
Xesac
Xrmlist="$rmlist loc"
X
X: get list of predefined functions in a handy place
Xif $test -n "$uname"; then
X	os=`$uname -s`
Xelse
X	os=unknown
Xfi
Xecho " "
Xif test -f /lib/libc.a; then
X    echo "Your C library is in /lib/libc.a.  You're normal."
X    libc=/lib/libc.a
Xelse
X    if test "$os" = DomainOS ; then
X	ans=`loc libc blurfl/dyick $libpth`
X    else
X	ans=`loc libc.a blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc clib blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc libc blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Mlibc.a blurfl/dyick $libpth`
X    fi
X    if test ! -f "$ans"; then
X	ans=`loc Llibc.a blurfl/dyick $libpth`
X    fi
X    if test -f "$ans"; then
X	echo "Your C library is in $ans, of all places."
X	libc=$ans
X    else
X	if test -f "$libc"; then
X	    echo "Your C library is in $libc, like you said before."
X	else
X	    cat <<EOM
X 
XI can't seem to find your C library.  I've looked in the following places:
X
X	$libpth
X
XNone of these seems to contain your C library.  What is the full name
XEOM
X	    dflt=None
X	    $echo $n "of your C library? $c"
X	    rp='C library full name?'
X	    . myread
X	    libc="$ans"
X	fi
X    fi
Xfi
Xecho " "
X$echo $n "Extracting names from $libc for later perusal...$c"
Xnm $libc 2>/dev/null >libc.tmp
X$sed -n -e 's/^.* [AT] _//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
Xif $contains '^printf$' libc.list >/dev/null 2>&1; then
X    echo "done"
Xelse
X    if test "$os" = DomainOS ; then
X        $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
X    else
X	$sed -n -e 's/^.* D _//p' -e 's/^.* D //p' <libc.tmp >libc.list
X    fi
X    $contains '^printf$' libc.list >/dev/null 2>&1 || \
X       $sed -n -e 's/^_//' \
X	      -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
X    if $contains '^printf$' libc.list >/dev/null 2>&1; then
X	echo "done"
X    else
X	echo " "
X	echo "nm didn't seem to work right."
X	echo "Trying ar instead..."
X	if ar t $libc > libc.tmp; then
X	    $sed -e 's/\.o$//' < libc.tmp > libc.list
X	    echo "Ok."
X	else
X	    echo "ar didn't seem to work right."
X	    echo "Maybe this is a Cray...trying bld instead..."
X	    if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
X		echo "Ok."
X	    else
X	    	echo "That didn't work either.  Giving up."
X	    	exit 1
X	    fi
X	fi
X    fi
Xfi
Xrmlist="$rmlist libc.tmp libc.list"
X
X: make some quick guesses about what we are up against
Xecho " "
X$echo $n "Hmm...  $c"
Xif $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
X    echo "Looks kind of like a BSD system, but we'll see..."
X    echo exit 0 >bsd
X    echo exit 1 >usg
X    echo exit 1 >v7
Xelif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
X    echo "Looks kind of like a USG system, but we'll see..."
X    echo exit 1 >bsd
X    echo exit 0 >usg
X    echo exit 1 >v7
Xelse
X    echo "Looks kind of like a version 7 system, but we'll see..."
X    echo exit 1 >bsd
X    echo exit 1 >usg
X    echo exit 0 >v7
Xfi
Xif $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
X    cat <<'EOI'
XThere is, however, a strange, musty smell in the air that reminds me of
Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
XEOI
X    echo "exit 0" >eunice
X    eunicefix=unixtovms
X    d_eunice="$define"
X: it so happens the Eunice I know will not run shell scripts in Unix format
Xelse
X    echo " "
X    echo "Congratulations.  You aren't running Eunice."
X    eunicefix=':'
X    d_eunice="$undef"
X    echo "exit 1" >eunice
Xfi
Xif test -f /xenix; then
X    echo "Actually, this looks more like a XENIX system..."
X    echo "exit 0" >xenix
Xelse
X    echo " "
X    echo "It's not Xenix..."
X    echo "exit 1" >xenix
Xfi
Xchmod +x xenix
X$eunicefix xenix
Xif test -f /venix; then
X    echo "Actually, this looks more like a VENIX system..."
X    echo "exit 0" >venix
Xelse
X    echo " "
X    if xenix; then
X	: null
X    else
X	echo "Nor is it Venix..."
X    fi
X    echo "exit 1" >venix
Xfi
Xchmod +x bsd usg v7 eunice venix
X$eunicefix bsd usg v7 eunice venix
Xrmlist="$rmlist bsd usg v7 eunice venix xenix"
X
X: see if sh knows # comments
Xecho " "
Xecho "Checking your sh to see if it knows about # comments..."
Xif sh -c '#' >/dev/null 2>&1 ; then
X    echo "Your sh handles # comments correctly."
X    shsharp=true
X    spitshell=cat
X    echo " "
X    echo "Okay, let's see if #! works on this system..."
X    echo "#!/bin/echo hi" > try
X    $eunicefix try
X    chmod +x try
X    try > today
X    if $contains hi today >/dev/null 2>&1; then
X	echo "It does."
X	sharpbang='#!'
X    else
X	echo "#! /bin/echo hi" > try
X	$eunicefix try
X	chmod +x try
X	try > today
X	if test -s today; then
X	    echo "It does."
X	    sharpbang='#! '
X	else
X	    echo "It doesn't."
X	    sharpbang=': use '
X	fi
X    fi
Xelse
X    echo "Your sh doesn't grok # comments--I will strip them later on."
X    shsharp=false
X    echo "exec grep -v '^#'" >spitshell
X    chmod +x spitshell
X    $eunicefix spitshell
X    spitshell=`pwd`/spitshell
X    echo "I presume that if # doesn't work, #! won't work either!"
X    sharpbang=': use '
Xfi
X
X: figure out how to guarantee sh startup
Xecho " "
Xecho "Checking out how to guarantee sh startup..."
Xstartsh=$sharpbang'/bin/sh'
Xecho "Let's see if '$startsh' works..."
Xcat >try <<EOSS
X$startsh
Xset abc
Xtest "$?abc" != 1
XEOSS
X
Xchmod +x try
X$eunicefix try
Xif try; then
X    echo "Yup, it does."
Xelse
X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
Xfi
Xrm -f try today
X
X: get calendar mode and default calendar file name
X$cat <<EOM
X
XThere is a neat feature that enables scanning of the message body for
Xentries to add to the users ".calendar" (or whatever) file.  These
Xentries are then processed by the system program calendar.  To use
Xthis feature it needs to be enabled.  The name of the per user calendar
Xfile used by your systems calendar program is also required.
XEOM
X
Xcase "$d_calendar" in
X"$define") dflt=y;;
X"$undef")  dflt=n;;
X*)	   dflt=y;;
Xesac
X
Xrp="Enable calendar feature [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
Xy*) d_calendar="$define";;
X*)  d_calendar="$undef";;
Xesac
X
Xcase "$calendar" in
X    '') dflt='calendar';;
X    *)  dflt=$calendar;;
Xesac
X
Xif $test "$d_calendar" = "$define"; then
X	echo " "
X	rp="Default calendar file: [$dflt]"
X	$echo $n "$rp $c"
X	. myread
X	calendar="$ans"
Xfi
X
X: find out how to find out full name
Xecho " "
Xcase "$d_berknames" in
X"$define")
X    dflt=y;;
X"$undef")
X    dflt=n;;
X*)
X    if bsd; then
X	dflt=y
X    elif xenix; then
X	dflt=y
X    else
X	dflt=n
X    fi
X    ;;
Xesac
Xecho "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
X$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
Xrp="Berkeley/V7 format full name? [$dflt]"
X. myread
Xcase "$ans" in
X  y*)
X    d_passnames="$define"
X    d_berknames="$define"
X    d_usgnames="$undef"
X    nametype=bsd
X    ;;
X  *)
X    echo " "
X    case "$d_usgnames" in
X    "$define")
X	dflt=y;;
X    "$undef")
X	dflt=n;;
X    *)
X	if usg; then
X	    dflt=y
X	else
X	    dflt=n
X	fi
X	;;
X    esac
X    echo "Does your passwd file keep full names in USG format (name sandwiched"
X    $echo $n "between a '-' and a '(')? [$dflt] $c"
X    rp="USG format full name? [$dflt]"
X    . myread
X    case "$ans" in
X      n*)
X	echo "Full name will be taken from ~/.fullname"
X	d_passnames="$undef"
X	d_berknames="$undef"
X	d_usgnames="$undef"
X	nametype=other
X	;;
X      *)
X	d_passnames="$define"
X	d_berknames="$undef"
X	d_usgnames="$define"
X	nametype=usg
X	;;
X    esac
X    ;;
Xesac
X
X: see if we have to deal with yellow pages
Xif $test -d /usr/etc/yp; then
X    if $contains '^\+:' /etc/passwd; then
X	dflt=y
X    else
X	dflt=n
X    fi
X    rp="Are you getting the passwd file via yellow pages? [$dflt]"
X    $echo $n "$rp $c"
X    . myread
X    case "$ans" in
X    y*) passcat='ypcat passwd';;
X    *) passcat='cat /etc/passwd';;
X    esac
Xelse
X    passcat='cat /etc/passwd'
Xfi
X
X: default clear to no extra flags
Xxencf=
Xxenlf=
Xd_xenix="$undef"
Xd_bsd="$undef"
X: see if we are xenix 
Xif xenix; then
X    d_xenix="$define"
X:	now are we a 286
X    case "`uname -p`" in
X	i80286) 
X		xencf="-LARGE -Ml2et32"
X		xenlf="-Ml2t32 -F 5000 -SEG 512"
X      esac
Xfi
Xif bsd; then
X    d_bsd="$define"
Xfi
X
X: see if crypt exists
Xecho " "
Xif $contains '^crypt$' libc.list >/dev/null 2>&1; then
X    echo 'crypt() found.'
X    d_crypt="$define"
X    cryptlib=
Xelse
X    cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	cryptlib=`loc libcrypt.a "" $libpth`
X    else
X	cryptlib=-lcrypt
X    fi
X    if $test -z "$cryptlib"; then
X	echo 'crypt() not found.'
X	d_crypt="$undef"
X    else
X	d_crypt="$define"
X    fi
Xfi
X
X: check for cuserid function
Xecho " "
Xif $contains '^cuserid$' libc.list >/dev/null 2>&1 ; then
X    echo "cuserid() found."
X    d_cuserid="$undef"
Xelse
X    echo "No cuserid() found--will use mine."
X    d_cuserid="$define"
Xfi
X
X: now get the host name
Xecho " "
Xecho "Figuring out host name..."
Xecho 'Maybe "hostname" will work...'
Xif ans=`sh -c hostname 2>&1` ; then
X    hostname=$ans
X    phostname=hostname
Xelse
X    if xenix; then
X	echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
X	if ans=`cat /etc/systemid 2>&1` ; then
X	    hostname=$ans
X	    phostname='cat /etc/systemid'
X	    echo "Whadyaknow.  Xenix always was a bit strange..."
X	else
X	    echo 'No, maybe "uuname -l" will work...'
X	    if ans=`sh -c 'uuname -l' 2>&1` ; then
X		hostname=$ans
X		phostname='uuname -l'
X	    else
X		echo 'Strange.  Maybe "uname -n" will work...'
X		if ans=`sh -c 'uname -n' 2>&1` ; then
X		    hostname=$ans
X		    phostname='uname -n'
X		else
X		    echo 'Oh well, maybe I can mine it out of whoami.h...'
X		    if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
X			hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X			phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
X		    else
X			case "$hostname" in
X			'') echo "Does this machine have an identity crisis or something?"
X			    phostname=''
X			    ;;
X			*)  echo "Well, you said $hostname before...";;
X			esac
X		    fi
X		fi
X	    fi
X	fi
X    else
X	if $test -r /etc/systemid ; then
X	    echo "What is a non-Xenix system doing with /etc/systemid?"
X	fi
X	echo 'No, maybe "uuname -l" will work...'
X	if ans=`sh -c 'uuname -l' 2>&1` ; then
X	    hostname=$ans
X	    phostname='uuname -l'
X	else
X	    echo 'Strange.  Maybe "uname -n" will work...'
X	    if ans=`sh -c 'uname -n' 2>&1` ; then
X		hostname=$ans
X		phostname='uname -n'
X	    else
X		if ans=`cat /etc/systemid 2>&1` ; then
X		    hostname=$ans
X		    phostname='cat /etc/systemid'
X		    echo "Well, I'll use the systemid file anyway..."
X		else
X		    echo 'Oh well, maybe I can mine it out of whoami.h...'
X		    if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
X			hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
X			phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
X		    else
X			case "$hostname" in
X			'') echo "Does this machine have an identity crisis or something?"
X			    phostname=''
X			    ;;
X			*)  echo "Well, you said $hostname before...";;
X			esac
X		    fi
X		fi
X	    fi
X	fi
X    fi
Xfi
X: you do not want to know about this
Xset $hostname
Xhostname=$1
X
X: translate upper to lower if necessary
Xcase "$hostname" in
X    *[A-Z]*)
X	hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
X	echo "(Normalizing case in your host name)"
X	;;
Xesac
X
X: verify guess
Xif $test "$hostname" ; then
X    dflt=y
X    echo 'Your host name appears to be "'$hostname'".'
X    $echo $n "Is this correct? [$dflt] $c"
X    rp="Sitename is $hostname? [$dflt]"
X    . myread
X    case "$ans" in
X      y*)  ;;
X      *)      hostname='' ;;
X    esac
Xfi
X
X: bad guess or no guess
Xwhile $test "X$hostname" = X ; do
X    dflt=''
X    rp="Please type the (one word) name of your host:"
X    $echo $n "$rp $c"
X    . myread
X    hostname="$ans"
Xdone
X
Xecho " "
Xcase "$hostname" in
X*.*)
X    dflt=`$expr "X$hostname" : "X[^.]*\(\..*\)"`
X    hostname=`$expr "X$hostname" : "X\([^.]*\)\."`
X    echo "(Trimming domain name from host name--host name is now $hostname)"
X    ;;
X*)  case "$mydomain" in
X	'') dflt='.UUCP';;
X	*) dflt="$mydomain";;
X    esac
X    ;;
Xesac
Xrp="What is your domain name? [$dflt]"
X$echo $n "$rp $c"
X. myread
Xcase "$ans" in
X'') ;;
X.*) ;;
X*) ans=".$ans";;
Xesac
Xmydomain="$ans"
X
X: a little sanity check here
Xcase "$phostname" in
X'') ;;
X*)  case `$phostname` in
X    $hostname$mydomain|$hostname) ;;
X    *)
X	case "$phostname" in
X	sed*)
SHAR_EOF
echo "End of part 1"
echo "File Configure is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0

-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.