[comp.unix.xenix] Elm 1.7 beta: patches for Xenix

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

I have received so many requests for these patches, that I've finally gotten
around to posting them.  BTW, both Dave Taylor and Joel Shprentz have requested
and gotten these patches.

As to reliability, well, I trust this Elm with my mail.  However, your mileage
may vary.  Also, contents may have settled during shipment.  Etc.

This is part one of seven -- the makefiles.  Note that names have been changed
to protect the guilty; for example, src/Makefile is sharchived as Makefile.src.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	Makefile
#	Makefile.bin
#	Makefile.filt
#	Makefile.src
#	Makefile.utils
# This archive created: Tue Jan 26 19:14:18 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "Makefile" (11051 characters) '
if test -f 'Makefile'
then
	echo 'shar: will not overwrite existing file "Makefile" '
else
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X#
X#  Makefile for the entire ELM mail system
X#
X#         (C) Copyright 1986, Dave Taylor
X#
X#  Last modification: October 8th, 1986
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
XTAPE=   unknown-remote-tape-unit 
XDEST=   /usr/local/bin
X
XLIB=    /usr/local/lib
XMAN=	/usr/local/man/man1
XCATMAN= /usr/local/man/cat1
XSHAR=   /usr/local/bin/shar -s 60000
X
XDEFINE = -DDEBUG
XLIB2   = 
X
X#########################
X
XLIBS=   -ltermlib
XCFLAGS= -O
XCC=	cc -LARGE -Ml2t128
XRM=	rm -f
XMV=     mv -f
XCP=	cp
X
X# if you want to use "nroff", change this...
X
XFORMATTER = nroff
XTBL       = tbl
X
XDOCS=   Alias.guide Config.guide Elm.coversheet Filter.guide Ref.guide     \
X	Forms.guide Users.guide answer.1 autoreply.1 checkalias.1          \
X	elm.1 fastmail.1 filter.1 from.1 listalias.1 messages.1 newalias.1 \
X	newmail.1 printmail.1 readmsg.1 trim-headers.1 wnewmail.1
X
XUTILSRC= utils/answer.c utils/arepdaemon.c utils/autoreply.c           \
X	utils/fastmail.c utils/from.c utils/newalias.c \
X	utils/newmail.c utils/printmail.c utils/readmsg.c utils/wnewmail.c \
X	utils/trim-headers
X
XFILTSRC= filter/actions.c filter/filter.c filter/parse.c filter/rules.c     \
X	filter/summarize.c filter/utils.c
X
XELMSRC=	src/addr_utils.c src/alias.c src/aliasdb.c src/aliaslib.c src/args.c  \
X	src/bounceback.c src/builtin.c src/calendar.c src/connect_to.c	      \
X	src/curses.c src/date.c src/delete.c src/domains.c src/edit.c	      \
X	src/editmsg.c src/elm.c src/encode.c src/errno.c src/file.c	      \
X	src/file_utils.c src/fileio.c src/forms.c src/getopt.c src/hdrconfg.c \
X	src/help.c src/initialize.c src/input_utils.c src/leavembox.c	      \
X	src/limit.c src/mailmsg1.c src/mailmsg2.c src/mailtime.c src/mkhdrs.c \
X	src/newmbox.c src/opt_utils.c src/options.c src/output_utils.c        \
X	src/pattern.c src/pmalloc.c src/quit.c src/read_rc.c src/remail.c     \
X	src/reply.c src/return_addr.c src/save_opts.c src/savecopy.c          \
X	src/screen.c src/showmsg.c src/signals.c src/softkeys.c src/sort.c    \
X	src/string2.c src/strings.c src/syscall.c src/utils.c src/validname.c
X
XMISCHDRS  = hdrs/defs.h hdrs/sysdefs.h
XELMHDRS   = hdrs/headers.h 
XFILTHDRS  = hdrs/filter.h
XMAINHDRS  = hdrs/elm.h
X
X################
X
Xall:	bin/elm filter utils 
X	@echo Everything is up to date!
X
Xdocumentation:  doc/Users.fmtd doc/Ref.fmtd doc/Config.fmtd doc/Alias.fmtd \
X		doc/Form.fmtd doc/Filter.fmtd
X	
Xdoc/Users.fmtd: doc/Users.guide
X	${TBL} doc/Users.guide | ${FORMATTER} -mm > doc/Users.fmtd
X
Xdoc/Form.fmtd: doc/Form.guide
X	${FORMATTER} -mm doc/Form.guide > doc/Form.fmtd
X
Xdoc/Filter.fmtd: doc/Filter.guide
X	${TBL} doc/Filter.guide | ${FORMATTER} -mm > doc/Filter.fmtd
X
Xdoc/Ref.fmtd: doc/Ref.guide
X	${FORMATTER} -mm doc/Ref.guide > doc/Ref.fmtd
X
Xdoc/Config.fmtd:  doc/Config.guide
X	${TBL} doc/Config.guide | ${FORMATTER} -mm > doc/Config.fmtd
X
Xdoc/Alias.fmtd:  doc/Alias.guide
X	${TBL} doc/Alias.guide | ${FORMATTER} -mm > doc/Alias.fmtd
X
Xbin/elm: ${ELMSRC} ${MISCHDRS} ${ELMHDRS} ${MAINHDRS}
X	cd src; $(MAKE) -$(MAKEFLAGS) 'DEFINE=${DEFINE}' 'LIB2=${LIB2}' ../bin/elm
X	
Xbin/utils: ${UTILSRC} ${MISCHDRS}
X	cd utils; $(MAKE) -$(MAKEFLAGS) 'DEFINE=${DEFINE}' 'LIBS=${LIB2}' all
X
Xbin/filter: ${FILTSRC} ${FILTHDR}
X	cd filter; $(MAKE) -$(MAKEFLAGS) 'DEFINE=${DEFINE}' 'LIBS=${LIB2}' all
X
Xinstall: all
X	${CP} bin/elm          ${DEST}/elm
X	${CP} bin/from         ${DEST}/from
X	${CP} bin/newalias     ${DEST}/newalias
X	${CP} bin/printmail    ${DEST}/printmail
X	${CP} bin/fastmail     ${DEST}/fastmail
X	${CP} bin/readmsg      ${DEST}/readmsg
X	${CP} bin/newmail      ${DEST}/newmail
X	${CP} bin/wnewmail     ${DEST}/wnewmail
X	${CP} bin/checkalias   ${DEST}/checkalias
X	${CP} bin/messages     ${DEST}/messages
X	${CP} bin/trim-headers ${DEST}/trim-headers
X	${CP} bin/arepdaemon   ${DEST}/arepdaemon
X	${CP} bin/autoreply    ${DEST}/autoreply
X	${CP} bin/listalias    ${DEST}/listalias
X	${CP} bin/filter       ${DEST}/filter
X	${CP} bin/answer       ${DEST}/answer
X	${RM} ${CATMAN}/elm.1 ${CATMAN}/from.1 \
X	      ${CATMAN}/newalias.1 ${CATMAN}/printmail.1 \
X	      ${CATMAN}/fastmail.1 ${CATMAN}/elm.1 \
X	      ${CATMAN}/readmsg.1 ${CATMAN}/answer.1 \
X	      ${CATMAN}/newmail.1 ${CATMAN}/checkalias.1 \
X	      ${CATMAN}/autoreply.1 ${CATMAN}/wnewmail.1 \
X	      ${CATMAN}/messages.1 ${CATMAN}/trim-headers.1 \
X	      ${CATMAN}/listalias.1 ${CATMAN}/filter.1
X	${CP} doc/elm.1        ${MAN}/elm.1
X	${CP} doc/from.1       ${MAN}/from.1
X	${CP} doc/newalias.1   ${MAN}/newalias.1
X	${CP} doc/printmail.1  ${MAN}/printmail.1
X	${CP} doc/fastmail.1   ${MAN}/fastmail.1
X	${CP} doc/checkalias.1 ${MAN}/checkalias.1
X	${CP} doc/messages.1   ${MAN}/messages.1
X	${CP} doc/trim-headers.1 ${MAN}/trim-headers.1
X	${CP} doc/autoreply.1  ${MAN}/autoreply.1
X	${CP} doc/answer.1     ${MAN}/answer.1
X	${CP} doc/readmsg.1    ${MAN}/readmsg.1
X	${CP} doc/newmail.1    ${MAN}/newmail.1
X	${CP} doc/wnewmail.1   ${MAN}/wnewmail.1
X	${CP} doc/listalias.1  ${MAN}/listalias.1
X	${CP} doc/filter.1     ${MAN}/filter.1
X	${CP} doc/elm-help.?   ${LIB}
X	${CP} doc/elmrc-info   ${LIB}
X	chmod a+rx ${DEST}/from ${DEST}/newalias \
X		   ${DEST}/printmail ${DEST}/fastmail \
X		   ${DEST}/readmsg ${DEST}/trim-headers \
X		   ${DEST}/checkalias ${DEST}/autoreply \
X		   ${DEST}/newmail ${DEST}/wnewmail ${DEST}/messages \
X		   ${DEST}/listalias
X	chgrp mail ${DEST}/elm ${DEST}/filter
X	chmod 2755 ${DEST}/elm ${DEST}/filter
X	@echo Done with installation.
X
Xuninstall:
X	${RM} ${DEST}/elm \
X	      ${DEST}/from \
X	      ${DEST}/newalias \
X	      ${DEST}/printmail \
X	      ${DEST}/fastmail \
X	      ${DEST}/readmsg \
X	      ${DEST}/newmail \
X	      ${DEST}/wnewmail \
X	      ${DEST}/checkalias \
X	      ${DEST}/messages \
X	      ${DEST}/trim-headers \
X	      ${DEST}/arepdaemon \
X	      ${DEST}/autoreply \
X	      ${DEST}/listalias \
X	      ${DEST}/filter \
X	      ${CATMAN}/elm.1 ${CATMAN}/from.1 \
X	      ${CATMAN}/newalias.1 ${CATMAN}/printmail.1 \
X	      ${CATMAN}/fastmail.1 ${CATMAN}/elm.1 \
X	      ${CATMAN}/readmsg.1 ${CATMAN}/answer.1 \
X	      ${CATMAN}/newmail.1 ${CATMAN}/checkalias.1 \
X	      ${CATMAN}/autoreply.1 ${CATMAN}/wnewmail.1 \
X	      ${CATMAN}/messages.1 ${CATMAN}/trim-headers.1 \
X	      ${CATMAN}/listalias.1 ${CATMAN}/filter.1 \
X	      ${MAN}/elm.1 \
X	      ${MAN}/from.1 \
X	      ${MAN}/newalias.1 \
X	      ${MAN}/printmail.1 \
X	      ${MAN}/fastmail.1 \
X	      ${MAN}/checkalias.1 \
X	      ${MAN}/messages.1 \
X	      ${MAN}/trim-headers.1 \
X	      ${MAN}/autoreply.1 \
X	      ${MAN}/answer.1 \
X	      ${MAN}/readmsg.1 \
X	      ${MAN}/newmail.1 \
X	      ${MAN}/wnewmail.1 \
X	      ${MAN}/listalias.1 \
X	      ${MAN}/filter.1 \
X	      ${LIB}/elm-help.? \
X	      ${LIB}/elmrc-info
X	@echo Done removing.
X
Xrmt-install: remote-defined
X	@echo " "
X	@echo Warning: This assumes "install" has been done on the
X	@echo "         remote machine.  If this is not the case you"
X	@echo "         better hit BREAK quickly!"
X	@echo " "
X	${CP} ${REMOTE}${DEST}/elm          ${DEST}/elm
X	${CP} ${REMOTE}${DEST}/from         ${DEST}/from
X	${CP} ${REMOTE}${DEST}/newalias     ${DEST}/newalias
X	${CP} ${REMOTE}${DEST}/printmail    ${DEST}/printmail
X	${CP} ${REMOTE}${DEST}/fastmail     ${DEST}/fastmail
X	${CP} ${REMOTE}${DEST}/readmsg      ${DEST}/readmsg
X	${CP} ${REMOTE}${DEST}/wnewmail     ${DEST}/wnewmail
X	${CP} ${REMOTE}${DEST}/newmail      ${DEST}/newmail
X	${CP} ${REMOTE}${DEST}/checkalias   ${DEST}/checkalias
X	${CP} ${REMOTE}${DEST}/messages     ${DEST}/messages
X	${CP} ${REMOTE}${DEST}/arepdaemon   ${DEST}/arepdaemon
X	${CP} ${REMOTE}${DEST}/autoreply    ${DEST}/autoreply
X	${CP} ${REMOTE}${DEST}/listalias    ${DEST}/listalias
X	${RM} ${CATMAN}/elm.1 \
X	      ${CATMAN}/from.1 \
X              ${CATMAN}/newalias.1 \
X	      ${CATMAN}/printmail.1 \
X	      ${CATMAN}/fastmail.1 \
X              ${CATMAN}/checkalias.1 \
X              ${CATMAN}/autoreply.1 \
X	      ${CATMAN}/readmsg.1 \
X	      ${CATMAN}/answer.1 \
X	      ${CATMAN}/newmail.1 \
X	      ${CATMAN}/wnewmail.1 \
X	      ${CATMAN}/listalias.1 \
X              ${CATMAN}/elm.1
X	${CP} ${REMOTE}${MAN}/elm.1        ${MAN}/elm.1
X	${CP} ${REMOTE}${MAN}/from.1       ${MAN}/from.1
X	${CP} ${REMOTE}${MAN}/newalias.1   ${MAN}/newalias.1
X	${CP} ${REMOTE}${MAN}/printmail.1  ${MAN}/printmail.1
X	${CP} ${REMOTE}${MAN}/fastmail.1   ${MAN}/fastmail.1
X	${CP} ${REMOTE}${MAN}/checkalias.1 ${MAN}/checkalias.1
X	${CP} ${REMOTE}${MAN}/autoreply.1  ${MAN}/autoreply.1
X	${CP} ${REMOTE}${MAN}/readmsg.1    ${MAN}/readmsg.1
X	${CP} ${REMOTE}${MAN}/answer.1     ${MAN}/answer.1
X	${CP} ${REMOTE}${MAN}/wnewmail.1   ${MAN}/wnewmail.1
X	${CP} ${REMOTE}${MAN}/newmail.1    ${MAN}/newmail.1
X	${CP} ${REMOTE}${MAN}/listalias.1  ${MAN}/listalias.1
X	${CP} ${REMOTE}${LIB}/elm-help.?   ${LIB}
X	${CP} ${REMOTE}${LIB}/elmrc-info   ${LIB}
X	chmod a+rx ${DEST}/from ${DEST}/newalias ${DEST}/printmail \
X	           ${DEST}/fastmail ${DEST}/readmsg \
X		   ${DEST}/checkalias ${DEST}/autoreply ${DEST}/wnewmail \
X		   ${DEST}/newmail ${DEST}/messages ${DEST}/listalias
X	chgrp mail ${DEST}/elm
X	chmod 2755 ${DEST}/elm
X	@echo everything is installed based on files from ${REMOTE}
X
Xsource: 
X	tar cvf ${TAPE} bin/makelisting utils/*.c src/*.c doc/* hdrs/* \
X	Instructions Makefile* utils/Makefile* src/Makefile* test/*    \
X	utils/*.awk Overview filter/*.c filter/Makefile*
X
X# Note that the production for SHAR assumes a pretty snazzy shar program
X# that can break down the output into a number of files as needed...
X#   The current threshold is 60,000 bytes per file, for email/netnews
X
Xshar:   
X	${SHAR} *
X
Xlint:
X	lint ${UTILSRC} > lint.out
X
Xlisting:
X	@echo listing all source files 
X	@/bin/echo \\f > LISTING
X	@echo adding file 'README'...
X	@cat README >> LISTING
X	@/bin/echo \\f >> LISTING
X	@echo adding file 'Instructions...
X	@cat Instructions >> LISTING
X	@/bin/echo \\f >> LISTING
X	@echo adding file 'Makefile'...
X	@cat Makefile >> LISTING
X	@bin/makelisting Makefile ${UTILSRC} src/Makefile src/*.c hdrs/*.h \
X	${FILTSRC}
X	@echo LISTING generated.
X
Xelm-listing: 
X	@echo listing just the ELM system source files
X	@echo ' ' > src/LISTING
X	@cd src ; $(MAKE) -$(MAKEFLAGS) listing ; cd ..
X	@echo LISTING generated \(in directory /src\).
X
Xclean:
X	@cd src ; $(MAKE) -$(MAKEFLAGS) clean 
X	@cd utils; $(MAKE) -$(MAKEFLAGS) clean
X	@cd filter; $(MAKE) -$(MAKEFLAGS) clean
X	@echo All spurious files removed
X
Xelm: bin/elm
Xfilter: bin/filter
Xutils: bin/utils
Xutils/checkalias:
Xutils/messages:
Xdoc/Users.guide:
Xdoc/Ref.guide:
Xdoc/Alias.guide:
Xdoc/Config.guide:
X
Xremote-defined:
X	@if ( "${REMOTE}" == "" ) then; \
X	   echo " " ; \
X	   echo "You need to define 'REMOTE' as the remote file system" ; \
X	   echo "for this particular command.   The easiest way to do " ; \
X	   echo "this is to type:" ;\
X	   echo "    make -f <makefile> REMOTE=<remote file system> rmt-install" ; \
X	   echo " " ; \
X	 endif
X	@if ( "${REMOTE}" == "" ) exit 1
SHAR_EOF
if test 11051 -ne `wc -c < 'Makefile'`
then
	echo 'shar: error transmitting "Makefile" (should have been 11051 characters) '
fi
chmod 644 'Makefile'
fi  # end of overwriting check
:
echo 'shar: extracting "Makefile.bin" (270 characters) '
if test -f 'Makefile.bin'
then
	echo 'shar: will not overwrite existing file "Makefile.bin" '
else
sed 's/^X//' << \SHAR_EOF > 'Makefile.bin'
X# Makefile for Elm binaries
X#
X
XALL =   [a-z]*
XSETGID = elm filter
XBIN = /usr/local/bin
XTARFILE = /usr/tmp/elm+utils.tar
X
Xperms:
X	chmod 775 ${ALL}
X	chgrp bin ${ALL}
X	chown bin ${ALL}
X	chmod g+s ${SETGID}
X
Xtar:
X	tar cvf ${TARFILE} ${ALL}
X
Xinstall:
X	copy -om ${ALL} ${BIN}
SHAR_EOF
if test 270 -ne `wc -c < 'Makefile.bin'`
then
	echo 'shar: error transmitting "Makefile.bin" (should have been 270 characters) '
fi
chmod 755 'Makefile.bin'
fi  # end of overwriting check
:
echo 'shar: extracting "Makefile.filt" (688 characters) '
if test -f 'Makefile.filt'
then
	echo 'shar: will not overwrite existing file "Makefile.filt" '
else
sed 's/^X//' << \SHAR_EOF > 'Makefile.filt'
X#
X#  Makefile for the Elm system filter program
X#
X#         (C) Copyright 1986, Dave Taylor
X#
X#  Last modification: Oct 7th, 1986
X
XSHELL=/bin/sh
X
XDEFINE= -DDEBUG
XLIB2  = 
X
XCC=	cc -LARGE
XCFLAGS= -O -I../hdrs ${DEFINE}
XLDFLAGS= -i -F 2000
XRM= 	rm -f
XECHO=   echo
X
XPROG    =   ../bin/filter
XHDRS    =   ../hdrs/defs.h ../hdrs/sysdefs.h ../hdrs/filter.h
XSRCS    =   actions.c filter.c parse.c rules.c summarize.c utils.c utils2.c
XOBJS    =   actions.o filter.o parse.o rules.o summarize.o utils.o utils2.o
X
Xall: ${PROG}
X
X${PROG}: ${OBJS}
X	${CC} ${LDFLAGS} -o ${PROG} ${OBJS}
X
X${OBJS}: ${HDRS}
X
Xlint:
X	lint -I../hdrs ${SRC} > LINT.OUT
X
Xclean:
X	${RM} *.o ${PROG}
X
Xindex:
X	index ${SRC} > INDEX
X
SHAR_EOF
if test 688 -ne `wc -c < 'Makefile.filt'`
then
	echo 'shar: error transmitting "Makefile.filt" (should have been 688 characters) '
fi
chmod 644 'Makefile.filt'
fi  # end of overwriting check
:
echo 'shar: extracting "Makefile.src" (2660 characters) '
if test -f 'Makefile.src'
then
	echo 'shar: will not overwrite existing file "Makefile.src" '
else
sed 's/^X//' << \SHAR_EOF > 'Makefile.src'
X#
X#  Makefile for the ELM mail program.
X#
X#         (C) Copyright 1986, Dave Taylor
X#
X#  Last modification: August 15th, 1986
X
XSHELL=/bin/sh
X
XDEFINE= -DDEBUG 
XLIB2  = 
X
X# IF you're on an ACSnet system (Australia) then
X# you'll want to uncomment the following;
X
X#   DEFINE= ${DEFINE} -DACSNET
X
X##############################
X
XCFILES=	addr_utils.c alias.c aliasdb.c aliaslib.c args.c bounceback.c 	\
X	builtin.c calendar.c connect_to.c curses.c date.c delete.c	\
X	domains.c edit.c editmsg.c elm.c encode.c errno.c file.c	\
X	file_utils.c fileio.c forms.c getopt.c hdrconfg.c help.c	\
X	initialize.c input_utils.c leavembox.c limit.c mailmsg1.c	\
X	mailmsg2.c mailtime.c mkhdrs.c newmbox.c opt_utils.c options.c	\
X	output_utils.c pattern.c pmalloc.c quit.c read_rc.c remail.c	\
X	reply.c return_addr.c savecopy.c screen.c showmsg.c signals.c	\
X	softkeys.c sort.c string2.c strings.c syscall.c utils.c		\
X	save_opts.c validname.c showmsg_cmd.c
X
XHEADERS=../hdrs/curses.h ../hdrs/defs.h ../hdrs/headers.h ../hdrs/sysdefs.h
X
XOBJS  =	addr_utils.o alias.o aliasdb.o aliaslib.o args.o bounceback.o 	\
X	builtin.o calendar.o connect_to.o curses.o date.o delete.o	\
X	domains.o edit.o editmsg.o elm.o encode.o errno.o file.o	\
X	file_utils.o fileio.o forms.o getopt.o hdrconfg.o help.o	\
X	initialize.o input_utils.o leavembox.o limit.o mailmsg1.o	\
X	mailmsg2.o mailtime.o mkhdrs.o newmbox.o opt_utils.o options.o	\
X	output_utils.o pattern.o pmalloc.o quit.o read_rc.o remail.o	\
X	reply.o return_addr.o savecopy.o screen.o showmsg.o signals.o	\
X	softkeys.o sort.o string2.o strings.o syscall.o utils.o		\
X	save_opts.o validname.o showmsg_cmd.o
X
XBIN=    ../bin
XLIBS=   -ltermlib
XCFLAGS= -O -I../hdrs
XCC=	cc -LARGE -Ml2t128
XLDFLAGS= -SEG 250 -F 4000
XRM=	rm -f
X
X../bin/elm: ${OBJS} ${EXTRA} ${HEADERS} ../hdrs/elm.h
X	${CC} ${LDFLAGS} -o ${BIN}/elm ${OBJS} ${LIBS} ${LIB2}
X
X.c.o:   ${HEADERS}
X	${CC} -c ${CFLAGS} ${DEFINE} $*.c 
X
Xcurses.o: curses.c ../hdrs/curses.h
X	${CC} -c ${CFLAGS} -DRAWMODE ${DEFINE} curses.c
X
X# curses.c : curses.q
X# 	@../bin/quickscreen curses.q
X#
X# curses.q :
X# 	@cp curses.c curses.q
X
Xclean:
X	${RM} ${OBJS} LINT.OUT ../bin/elm 
X
Xlint: LINT.OUT
X
XLINT.OUT: ${CFILES}
X	lint -DRAWMODE -I../hdrs ${CFILES} -ltermcap > LINT.OUT
X
Xlisting: LISTING
X
XLISTING: Makefile INDEX ${HEADERS} ${CFILES}
X	@echo adding file 'Makefile'...
X	@/bin/echo \\f > LISTING
X	@cat Makefile >> LISTING
X	@echo adding file 'INDEX'...
X	@/bin/echo \\f >> LISTING
X	@cat INDEX >> LISTING
X	@../bin/makelisting ${HEADERS} ${CFILES}
X	@echo LISTING generated.
X
Xindex: INDEX
X
XINDEX: ${CFILES} ${HEADERS}
X	@echo Creating function definition index
X	@index *.c | sort > INDEX
X	@echo File INDEX generated
SHAR_EOF
if test 2660 -ne `wc -c < 'Makefile.src'`
then
	echo 'shar: error transmitting "Makefile.src" (should have been 2660 characters) '
fi
chmod 644 'Makefile.src'
fi  # end of overwriting check
:
echo 'shar: extracting "Makefile.utils" (3774 characters) '
if test -f 'Makefile.utils'
then
	echo 'shar: will not overwrite existing file "Makefile.utils" '
else
sed 's/^X//' << \SHAR_EOF > 'Makefile.utils'
X#
X#  Makefile for the Elm system utilities
X#
X#         (C) Copyright 1986, Dave Taylor
X#
X#  Last modification: Sept 15th, 1986
X
XSHELL=/bin/sh
X
XDEFINE= -DDEBUG
XLIB   = borrowed.a
X
XCC=	cc -LARGE
XCFLAGS= -O -I../hdrs ${DEFINE}
XLDFLAGS= -i
XRM= 	rm -f
XECHO=   echo
X
XPROGS=  ../bin/newalias ../bin/from ../bin/newmail ../bin/answer       \
X	../bin/printmail ../bin/fastmail ../bin/readmsg                \
X	../bin/checkalias ../bin/arepdaemon ../bin/autoreply ../bin/wnewmail \
X	../bin/messages ../bin/trim-headers ../bin/listalias 
X
XOBJS=   newalias.o from.o newmail.o answer.o printmail.o fastmail.o     \
X	readmsg.o checkalias.o arepdaemon.o autoreply.o wnewmail.o
X
Xall:    ${PROGS}
X
X../bin/newalias:  newalias.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ newalias.o ${LIB}
X
X../bin/from: from.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ from.o ${LIB}
X
X../bin/newmail: newmail.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ newmail.o ${LIB}
X
X../bin/wnewmail: wnewmail.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ wnewmail.o ${LIB}
X
X../bin/listalias: listalias.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ listalias.o ${LIB}
X
X../bin/answer: answer.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ answer.o ${LIB}
X
X../bin/printmail: printmail.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ printmail.o ${LIB}
X
X../bin/fastmail: fastmail.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ fastmail.o ${LIB}
X
X../bin/readmsg: readmsg.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ readmsg.o ${LIB}
X
X../bin/arepdaemon: arepdaemon.o ${LIB}
X	${CC} ${LDFLAGS} -o $@ arepdaemon.o ${LIB}
X
X../bin/autoreply: autoreply.o ${LIB}
X	${CC} ${LFLAGS} -o $@ autoreply.o ${LIB}
X
X../bin/checkalias: Makefile
X	@echo ': Use /bin/sh' > ../bin/checkalias
X	@echo 'if [ "$$*" = "" ]; then' >> ../bin/checkalias
X	@echo '  echo Usage: checkalias alias \[or aliases\]' >>  \
X	      ../bin/checkalias
X	@echo '  exit 1' >> ../bin/checkalias
X	@echo 'fi' >> ../bin/checkalias
X	@echo ' '  >> ../bin/checkalias
X	@echo 'exec elm -c $$*' >> ../bin/checkalias
X	@chmod +x ../bin/checkalias
X
X../bin/messages: Makefile
X	@echo ': Use /bin/sh' 				 > ../bin/messages
X	@echo 'if [ "$$2" != "" ]; then' 		>> ../bin/messages
X	@echo '  echo Usage: messages \{folder-name\}'  >> ../bin/messages
X	@echo '  exit 1' 				>> ../bin/messages
X	@echo 'fi' 					>> ../bin/messages
X	@echo ' '  					>> ../bin/messages
X	@echo 'if [ "$$1" = "" ]; then' 		>> ../bin/messages
X	@echo '  fname=$$MAIL' 				>> ../bin/messages
X	@echo '  optional="in your mailbox"'  		>> ../bin/messages
X	@echo 'else'		 			>> ../bin/messages
X	@echo '  fname=$$1'				>> ../bin/messages
X	@echo '  optional="in folder $$1"' 		>> ../bin/messages
X	@echo 'fi'	       				>> ../bin/messages
X	@echo ' '					>> ../bin/messages
X	@echo 'if [ -f $$fname ]; then'			>> ../bin/messages
X	@echo '  mcount=`egrep "^From " $$fname | wc -l`' >> ../bin/messages
X	@echo 'else'					>> ../bin/messages
X	@echo '  exit 0'				>> ../bin/messages
X	@echo 'fi'					>> ../bin/messages
X	@echo ' '					>> ../bin/messages
X	@echo 'if [ $$mcount = 1 ];then'		>> ../bin/messages
X	@echo '  echo There is $$mcount message $$optional' >> ../bin/messages
X	@echo 'else'					>> ../bin/messages
X	@echo '  echo There are $$mcount messages $$optional' >> ../bin/messages
X	@echo 'fi'					>> ../bin/messages
X	@echo ' '					>> ../bin/messages
X	@echo 'exit $$mcount'				>> ../bin/messages
X	@chmod +x ../bin/messages
X
X../bin/trim-headers:
X	@cp trim-headers ../bin/trim-headers
X	@chmod +x ../bin/trim-headers
X
X${LIB}: getopt.o opt_utils.o string2.o validname.o
X	ar cr ${LIB} $?
X	ranlib ${LIB}
X
Xgetopt.o: ../src/getopt.c
X	${CC} ${CFLAGS} -c ../src/getopt.c
Xopt_utils.o: ../src/opt_utils.c
X	${CC} ${CFLAGS} -c ../src/opt_utils.c
Xstring2.o: ../src/string2.c
X	${CC} ${CFLAGS} -c ../src/string2.c
Xvalidname.o: ../src/validname.c
X	${CC} ${CFLAGS} -c ../src/validname.c
X
Xclean:
X	${RM} *.o ${PROGS} ${LIB}
X
Xlint:
X	lint -p -I../hdrs *.c > LINT.OUT
SHAR_EOF
if test 3774 -ne `wc -c < 'Makefile.utils'`
then
	echo 'shar: error transmitting "Makefile.utils" (should have been 3774 characters) '
fi
chmod 644 'Makefile.utils'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

I am enclosing newmbox.c whole -- I modified it so heavily that its diffs were
larger than the source code.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	newmbox.c
# This archive created: Tue Jan 26 19:14:19 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "newmbox.c" (16430 characters) '
if test -f 'newmbox.c'
then
	echo 'shar: will not overwrite existing file "newmbox.c" '
else
sed 's/^X//' << \SHAR_EOF > 'newmbox.c'
X/**			newmbox.c			**/
X
X/**  read new mailbox file, (C) Copyright 1986 by Dave Taylor  **/
X
X#include "headers.h"
X
X#include <sys/types.h>		
X#include <sys/stat.h>
X#include <errno.h>
X
X#ifdef BSD			/* Berkeley has library elsewhere... */
X#  ifndef BSD4_1
X#    include <sys/time.h>
X#  else
X#    include <time.h>
X#  endif
X#else
X#  include <time.h>
X#endif
X
Xextern int errno;
X
Xchar *error_name(), *error_description(), *strcpy(), *strncpy();
Xunsigned long sleep();
Xvoid rewind();
Xvoid  exit();
Xlong bytes();  /* size of file NSM */
X
Xstruct header_rec *realloc();
X
Xint
Xnewmbox(stat, resync, main_screen)
Xint stat, resync, main_screen;
X{
X	/** Read a new mailbox file or resync on current file.
X
X	    Values of stat and what they mean;
X
X		stat = 0	- changing mailboxes from within program
X		stat = 1	- read default mailbox or infile for the 
X			          first time
X	        stat = 2	- read existing mailbox, new mail arrived
X	        stat = 3	- resync on existing mailbox...
X
X	    resync is TRUE iff we know the current mailbox has changed.  If
X	    it's set to true this means that we MUST READ SOMETHING, even 
X	    if it's the current mailbox again!!
X
X	    main_screen simply tells where the counting line should be.
X
X	**/
X
X	int  switching_to_default = 0, switching_from_default = 0;
X	int  did_list = 0, redraw = 0; /* for dealing with the '?' answer */
X	char buff[SLEN];
X
X	if (mbox_specified == 0 && stat == 0)
X	  switching_from_default++;
X
X	if (stat > 0) {
X	  if (stat == 1 && strlen(infile) == 0) {
X
X	    /* Subtlety - check to see if there's another instantiation
X	       of Elm (e.g. if the /tmp file is in use).  If so, DIE! */
X
X	    sprintf(infile, "%s%s", temp_mbox, username);
X	    if (access(infile, ACCESS_EXISTS) != -1) {
X	      error(
X	    "Hey!  An instantiation of Elm is already reading this mail!\n\r");
X	      fprintf(stderr,
X"\n\r     [if this is in error then you'll need to remove '/tmp/mbox.%s']\n\r", 
X		  username);
X              exit(1);
X            }
X            sprintf(infile, "%s%s", mailhome, username);
X	  }
X	  if (strlen(infile) == 0)	/* no filename yet?? */
X	    sprintf(infile,"%s%s", mailhome, username);
X	  if (user_access(infile, READ_ACCESS) != 0) {
X	    int err = errno;
X	    if (first_word(infile, mailhome)) { /* a mail file! */
X	      /* oh wow.  incoming mailbox with no messages... */
X	      return(1);
X	    }
X	    error2("Can't open mailbox %s! (%s)",
X		   infile, error_description(err));
X	    exit(1);
X	  }
X	}
X	else { 		 	/* get name of new mailbox! */
X	  MoveCursor(LINES-3, 30);
X	  CleartoEOS();
X	  PutLine0(LINES-3, 40, "(Use '?' to list your folders)");
X	  show_last_error();
X
Xask_again:
X	  buff[0] = '\0';
X	  if (did_list == 0) {
X	    PutLine0(LINES-2,0,"Name of new mailbox: ");
X	    (void) optionally_enter(buff, LINES-2, 21, FALSE);
X	    ClearLine(LINES-2);
X	  }
X	  else {
X	    printf("\n\rName of new mailbox: ");
X	    (void) optionally_enter(buff, -1, -1, FALSE);
X	  }
X
X	  if (strlen(buff) == 0) {
X	    strcpy(buff, infile);
X#if 0
X	    /* Old code for hitting ENTER at mailbox prompt */
X	    if (resync && file_changed)
X	      strcpy(buff, infile);
X	    else
X	      return(redraw);
X#endif
X	  }
X
X	  if (strcmp(buff, "?") == 0) {
X	    Raw(OFF);
X	    list_folders();
X	    Raw(ON);
X	    did_list = 1;       /* ask for name differently */
X	    redraw = 1;		/* we'll need to clean the screen */
X	    goto ask_again;
X	  }
X
X	  if (strcmp(buff, "!") == 0 || strcmp(buff, "%") == 0) /* mailbox */
X	    sprintf(buff,"%s%s", mailhome, username);
X	  else if (! expand_filename(buff)) {
X	    error1("can't expand file %s", buff);
X	    goto ask_again;
X	  }
X
X	  if (strcmp(buff, infile) == 0 && !resync) {
X	    dprint(3, (debugfile,
X		   "User requested change to current mailbox! (newmbox)\n"));
X	    error("already reading that mailbox!");
X	    return(FALSE);
X	  }
X
X	  if (user_access(buff, READ_ACCESS) != 0) {
X	    int err = errno;
X	    dprint(2, (debugfile, 
X		    "Error: Can't open mailbox %s (newmbox)\n", buff));
X	    dprint(2, (debugfile, "** %s - %s **\n",
X		    error_name(err), error_description(err)));
X	    error2("Can't open file %s! (%s)",
X		    buff, error_description(err));
X	    goto ask_again;
X	  }
X
X	  if (first_word(buff, mailhome)) {	/* a mail file! */
X	    mbox_specified = 0; 	  /* fake program to think that */
X	    stat = 1;		    	  /*     we're the default file */
X	    switching_to_default++;	  /*        remember this act!  */
X	  }
X	  else if (!is_mailbox(buff)) {
X	    dprint(2, (debugfile, 
X		    "Error: File %s is not a mailbox (newmbox)\n", buff));
X	    error1("Sorry, %s is not a mailbox!", buff);
X	    goto ask_again;
X	  }
X
X	  if (resync && file_changed && strcmp(buff, infile) == 0)
X	    PutLine0(LINES-3,COLUMNS-40,"Resynchronizing file");
X	  else
X	    PutLine1(LINES-3,COLUMNS-40,"Mailbox: %s", buff);
X	  CleartoEOLN();
X	  strcpy(infile,buff);
X	  if (! switching_to_default)
X	    mbox_specified = 1;
X	}
X
X	if (stat == 3) 
X	  switching_from_default = TRUE;
X
X	if (switching_from_default) {	/* we need to remove the tmp file */
X	    sprintf(buff, "%s%s", temp_mbox, username);
X	    if (access(buff, ACCESS_EXISTS) != -1)  /* is it there at all? */
X	      if (unlink(buff) != 0) {
X	        error1(
X	    "Sorry, but I can't seem to unlink your temp mail file [%s]\n\r",
X		error_name(errno));
X                silently_exit();
X	      }
X	}
X
X	clear_error();
X	clear_central_message();
X
X	header_page = 0;
X
X	if (mailfile != NULL)
X	  (void) fclose(mailfile);  /* close it first, to avoid too many open */
X
X	if ((mailfile = fopen(infile,"r")) == NULL) 
X	  message_count = 0;
X	else if (stat != 2) {          /* new mail file! */
X	  current = 1;
X	  save_file_stats(infile);
X	  message_count = read_headers(FALSE, main_screen);
X	  if (! message_count)
X	    current = 0;
X	}
X	else {	/* resync with current mail file */
X	  save_file_stats(infile);
X	  message_count = read_headers(TRUE, main_screen);
X	}
X
X	if (stat != 2)
X	  selected = 0;	/* we don't preselect new mailboxes, boss! */
X
X	return(TRUE);
X}
X
Xint
Xis_mailbox(filename)
Xchar *filename;
X{
X	int fd, rd;
X	char buf[8];
X
X	if ((fd = open(filename, O_RDONLY)) == -1)
X	   return (FALSE);
X
X	rd = read(fd, buf, 5);
X	close(fd);
X	switch (rd) {
X	case 0:         return (TRUE);
X	case 5:         if (strncmp(buf, "From ", 5) == 0)
X			  return (TRUE);
X			else
X			  return (FALSE);
X	default:        return (FALSE);
X	}
X}
X
Xint
Xread_headers(rereading, main_screen)
Xint rereading, main_screen;
X{
X	/** Reads the headers into the header_table structure and leaves
X	    the file rewound for further I/O requests.   If the file being
X	    read is the default mailbox (ie incoming) then it is copied to
X	    a temp file and closed, to allow more mail to arrive during 
X	    the elm session.  If 'rereading' is set, the program will copy
X	    the status flags from the previous data structure to the new 
X	    one if possible.  This is (obviously) for re-reading a mailfile!
X	**/
X
X	FILE *temp;
X	char buffer[LONG_STRING], temp_filename[SLEN];
X	long f_bytes = 0L, line_bytes = 0L;
X	int count = 0, copyit = 0, in_header = 1;
X	int count_x, count_y = 17, new_messages = 0, err;
X	int in_to_list = FALSE, forwarding_mail = FALSE, first_line = TRUE;
X
X	static int first_read = 0;
X
X	if (! first_read++) {
X	  ClearLine(LINES-1);
X	  ClearLine(LINES);
X	  if (rereading)
X	    PutLine2(LINES, 0, "Reading in %s, message: %d", infile, 
X		     message_count);
X	  else
X	    PutLine1(LINES, 0, "Reading in %s, message: 0", infile);
X	  count_x = LINES;
X          count_y = 22 + strlen(infile);
X	}
X	else {
X	  count_x = LINES-2;
X	  if (main_screen)
X	    PutLine0(LINES-2, 0, "Reading message: 0");
X	  else {
X	    PutLine0(LINES, 0, "\n");
X	    PutLine0(LINES, 0, "Reading message: 0");
X	    count_x = LINES;
X	  }
X	}
X
X	if (mbox_specified == 0) {
X	  lock(INCOMING);	/* ensure no mail arrives while we do this! */
X	  sprintf(temp_filename,"%s%s",temp_mbox, username);
X	  if (! rereading) {
X	    if (access(temp_filename, ACCESS_EXISTS) != -1) {
X	      /* Hey!  What the hell is this?  The temp file already exists? */
X	      /* Looks like a potential clash of processes on the same file! */
X	      unlock();				     /* so remove lock file! */
X	      error("What's this?  The temp mailbox already exists??");
X	      sleep(2);
X	      error("Ahhhh.....I give up");
X	      silently_exit();	/* leave without tampering with it! */
X	    }
X	    if ((temp = fopen(temp_filename,"w")) == NULL) {
X	     err = errno;
X	     unlock();	/* remove lock file! */
X	     Raw(OFF);
X	     Write_to_screen(
X		     "\nCouldn't open file %s for use as temp mailbox;\n", 1,
X	             temp_filename);
X	     Write_to_screen("** %s - %s **\n", 2,
X		     error_name(err), error_description(err));
X	     dprint(1, (debugfile,
X                "Error: Couldn't open file %s as temp mbox.  errno %s (%s)\n",
X	         temp_filename, error_name(err), "read_headers"));
X	     leave();
X	    }
X	   get_mailtime();
X	   copyit++;
X	   chown(temp_filename, userid, groupid);
X	   chmod(temp_filename, 0700);	/* shut off file for other people! */
X	 }
X	 else {
X	   if ((temp = fopen(temp_filename,"a")) == NULL) {
X	     err = errno;
X	     unlock();	/* remove lock file! */
X	     Raw(OFF);
X	     Write_to_screen(
X		     "\nCouldn't reopen file %s for use as temp mailbox;\n", 1,
X	             temp_filename);
X	     Write_to_screen("** %s - %s **\n", 2,
X		     error_name(err), error_description(err));
X	     dprint(1, (debugfile, 
X                "Error: Couldn't reopen file %s as temp mbox.  errno %s (%s)\n",
X	         temp_filename, error_name(err), "read_headers"));
X	     emergency_exit();
X	    }
X	   copyit++;
X	  }
X	}
X
X	if (rereading) {
X	   if (fseek(mailfile, mailfile_size, 0) == -1) {
X	     err = errno;
X	     Write_to_screen(
X		"\nCouldn't seek to %ld (end of mailbox) in %s!\n", 2,
X	     	mailfile_size, infile);	
X	     Write_to_screen("** %s - %s **\n", 2,
X		     error_name(err), error_description(err));
X	     dprint(1, (debugfile,
X     "Error: Couldn't seek to end of mailbox %s: (offset %ld) Errno %s (%s)\n",
X	        infile, mailfile_size, error_name(err), "read_headers"));
X	     emergency_exit();
X	   }
X
X	   count = message_count;		/* next available  */
X	   f_bytes = mailfile_size;		/* start correctly */
X	}
X
X  /* find size of mailfile and then unlock file  */
X	mailfile_size = bytes(infile);
X	unlock(); /* close that mailfile */
X	
X	for (; f_bytes < mailfile_size; f_bytes += line_bytes) {
X
X	  if (fgets(buffer, LONG_STRING, mailfile) == NULL) {
X	    /* SOMETHING IS VERY WRONG */
X	    PutLine0(LINES, 0, "\n\rI can't read the mail file!?\n\r\n\r");
X	    fflush(stdout);
X	    dprint(1, (debugfile, "\n\n**** Mail file truncated!! ****\n\n"));
X	    mail_only++;      /* to avoid leave() cursor motion */
X	    leave();
X	  }
X
X	  line_bytes = (long) strlen(buffer); 
X	  if (copyit)
X	    fputs(buffer, temp);
X
X	  if (first_line) {    /** looking for first new line... **/
X
X	    dprint(9, (debugfile,
X			"newmbox: count=%d f_bytes=%ld\n\tbuffer=%s\n",
X			count, f_bytes, buffer));
X
X	    /** Skip blank lines until a header is found **/
X	    if (buffer[0] == '\n' && buffer[1] == '\0') {
X	      if (count)
X		header_table[count-1].lines++;
X	      continue;	
X	    }
X	      	
X	    if (!mbox_specified && first_word(buffer, "Forward to ")) {
X	      set_central_message("Mail being forwarded to %s",
X		 (char *) (buffer + 11));
X	      forwarding_mail = TRUE;
X	    }
X	    else if (first_word(buffer, "From ")) {
X	      forwarding_mail = FALSE;
X	    }
X	    else {
X	      /** Blech!  This is a scrambled mailbox file! */
X	      PutLine0(LINES, 0, 
X		  "\n\rMail file is corrupt!!  I can't read it!!\n\r\n\r");
X	      fflush(stdout);
X	      dprint(1, (debugfile, 
X			   "\n\n**** First mail header is corrupt!! ****\n\n"));
X	      dprint(1, (debugfile, "Line is;\n\t%s\n\n", buffer));
X              mail_only++;	/* to avoid leave() cursor motion */
X              leave();
X	    }
X
X	    first_line = FALSE;
X	  }
X
X	  if (first_word(buffer,"From ")) {
X	
X	    /** try to allocate new headers, if needed... **/
X
X	    if (count >= max_headers)
X	      more_headers();
X
X	    /** iff this is a valid From line, start a new message... **/
X
X	    if (real_from(buffer, &header_table[count])) {
X	      ++count;
X	      PutLine1(count_x, count_y, "%d", count);
X	      in_header = TRUE;
X
X	      header_table[count-1].index_number = count;
X	      header_table[count-1].subject[0] = '\0';
X	      header_table[count-1].offset = f_bytes;
X	      header_table[count-1].lines = 0;
X
X	      /** If we've never seen this msg before, make it visible. **/
X
X	      if (!rereading || count > message_count)
X		header_table[count - 1].status = VISIBLE;
X
X	      if (new_msg(header_table[count - 1])) {
X
X		/** Mark a new message as such. **/
X
X		header_table[count - 1].status |= NEW;
X
X		/**
X		   We want to move the current pointer to the first new
X		   message IF this is the first of the new messages, the
X		   user requested this feature, we're not rereading the 
X		   mailbox (imagine how THAT could screw the user up!),
X		   and we're not in some funky sorting mode (received-date is
X		   the default).  As always, I'm open to suggestions on
X		   other ways to have this work intelligently.
X		 **/
X	
X		if (! new_messages++
X		 && point_to_new
X		 && ! rereading
X		 && sortby == RECEIVED_DATE) {
X		  current = count;
X	          get_page(current);	/* make sure we're ON that page! */
X	        }
X	      }
X	    }
X	  }
X	  else if (in_header) {
X
X	    /** empty line means end of header... **/
X
X	    if (buffer[0] == '\n' && buffer[1] == '\0') {
X	      if (in_header) {
X	        in_header = 0;	/* in body of message! */
X	        fix_date(&header_table[count-1]);
X	      }
X	    }
X
X	    /** >From contains return address... **/
X
X	    else if (first_word(buffer,">From"))
X	      forwarded(buffer, &header_table[count-1]);
X
X	    /** subject of message... **/
X
X	    else if (first_word(buffer,"Subject:") ||
X		     first_word(buffer,"Subj:") ||
X		     first_word(buffer,"Re:")) {
X	      char *s = header_table[count-1].subject;
X	      if (*s == '\0') {
X	        remove_first_word(buffer);
X		strncpy(s, buffer, STRING);
X	      }
X	    }
X
X	    /** who it's from... **/
X
X	    else if (first_word(buffer,"From:"))
X	      parse_arpa_from(buffer, header_table[count-1].from);
X	    
X	    /** when it was sent... **/
X
X	    else if (first_word(buffer, "Date:")) 
X	      parse_arpa_date(buffer, &header_table[count-1]);
X
X	    /** some status things about the message... **/
X
X	    else if (first_word(buffer, "Priority:"))
X	      header_table[count-1].status |= PRIORITY;
X	    else if (first_word(buffer, "Content-Type: mailform"))
X	      header_table[count-1].status |= FORM_LETTER;
X	    else if (first_word(buffer, "Action:"))
X	      header_table[count-1].status |= ACTION;
X
X	    /** next let's see if it's to us or not... **/
X
X	    else if (first_word(buffer, "To:")) {
X	      in_to_list = TRUE;
X	      header_table[count-1].to[0] = '\0';	/* nothing yet */
X	      figure_out_addressee((char *) buffer +3, 
X				   header_table[count-1].to);
X	    }
X
X	    /** continuation of a To: list... **/
X
X	    else if (in_to_list == TRUE) {
X	      if (whitespace(buffer[0]))
X	        figure_out_addressee(buffer, header_table[count-1].to);
X	      else
X		in_to_list = FALSE;
X	    }
X	  }
X
X	  header_table[count-1].lines++;
X	}
X
X	if (mbox_specified == 0) {
X	  unlock();	/* remove lock file! */
X	  fclose(mailfile);
X	  fclose(temp);
X	  if ((mailfile = fopen(temp_filename,"r")) == NULL) {
X	    err = errno;
X	    MoveCursor(LINES,0);
X	    Raw(OFF);
X	    Write_to_screen("\nAugh! Couldn't reopen %s as temp mail file;\n",
X	           1, temp_filename);
X	    Write_to_screen("** %s - %s **\n", 2, error_name(err),
X		   error_description(err));
X	    dprint(1, (debugfile,
X          "Error: Reopening %s as temp mail file failed!  errno %s (%s)\n",
X	           temp_filename, error_name(errno), "read_headers"));
X	    leave();
X	  }
X	}
X	else 
X          rewind(mailfile);
X
X	sort_mailbox(count, 1);	 		/* let's sort this baby now! */
X
X	return(count);
X}
X
Xmore_headers()
X{
X	/** Allocate more message headers **/
X
X	struct header_rec *temp_struct;
X
X	max_headers += KLICK;
X	dprint(3, (debugfile,
X	    "\n\nAbout to allocate headers, max_headers=%d\n", max_headers));
X	if ((temp_struct = realloc(header_table, max_headers *
X	     sizeof(struct header_rec))) == NULL) {
X	  error1(
X    "\n\r\n\rCouldn't allocate enough memory!  Failed on message #%d\n\r\n\r",
X		 max_headers + 1);
X	  leave();
X	}
X	header_table = temp_struct;
X	dprint(7, (debugfile, "\tallocated %d more headers!\n\n",KLICK));
X}
SHAR_EOF
if test 16430 -ne `wc -c < 'newmbox.c'`
then
	echo 'shar: error transmitting "newmbox.c" (should have been 16430 characters) '
fi
chmod 664 'newmbox.c'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

Patches for filter/*.[hc].

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	p.filter
# This archive created: Tue Jan 26 19:14:41 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "p.filter" (2312 characters) '
if test -f 'p.filter'
then
	echo 'shar: will not overwrite existing file "p.filter" '
else
sed 's/^X//' << \SHAR_EOF > 'p.filter'
XIndex: actions.c
X*** elm1.7beta/filter/actions.c	Mon Nov  2 20:14:16 1987
X--- elm/filter/actions.c	Tue Dec 22 17:27:10 1987
X***************
X*** 28,31 ****
X  	FILE *pipefd, *tempfd, *mailfd;
X! 	int  attempts = 0, ret, in_header = TRUE, line_count = 0;
X! 	char tempfile[SLEN], mailbox[SLEN], lockfile[SLEN],
X  	     buffer[VERY_LONG_STRING];
X--- 28,31 ----
X  	FILE *pipefd, *tempfd, *mailfd;
X! 	int  in_header = TRUE, line_count = 0, fd, attempts, locked;
X! 	char tempfile[SLEN], mailbox[SLEN], lockfile[SLEN], locktemp[SLEN],
X  	     buffer[VERY_LONG_STRING];
X***************
X*** 92,93 ****
X--- 92,98 ----
X  	  sprintf(mailbox,  "%s%s", mailhome, username);
X+ 
X+ #ifdef M_XENIX
X+ 	  sprintf(lockfile,  "/tmp/%s.mlk", username);
X+ 	  sprintf(locktemp,  "/tmp/Filter.XXXXXX");
X+ #else
X  	  sprintf(lockfile,  "%s%s.lock", mailhome, username);
X***************
X*** 93,94 ****
X--- 98,102 ----
X  	  sprintf(lockfile,  "%s%s.lock", mailhome, username);
X+ 	  sprintf(locktemp,  "%sFilter.XXXXXX", mailhome);
X+ #endif
X+ 	  mktemp(locktemp);
X  
X***************
X*** 94,97 ****
X  
X! 	  while ((ret=creat(lockfile, 0777)) < 0  && attempts++ < 10) 
X! 	    sleep(2);	/* wait two seconds, okay?? */
X  
X--- 102,104 ----
X  
X! 	  locked = FALSE;
X  
X***************
X*** 97,99 ****
X  
X! 	  if (ret < 0) {
X  	    fprintf(stderr, "%sfilter (%s): Couldn't create lockfile %s\n",
X--- 104,120 ----
X  
X! 	  if ((fd = creat(locktemp, 0)) != -1) {
X! 	    close(fd);
X! 
X! 	    for (attempts = 0; attempts < 10; ++attempts) {
X! 	      if (link(locktemp, lockfile) == 0) {
X! 		locked = TRUE;
X! 		break;
X! 	      }
X! 	      sleep(5);   /* wait five seconds, okay?! */
X! 	    }
X! 
X! 	    unlink(locktemp);
X! 	  }
X! 
X! 	  if (!locked) {
X  	    fprintf(stderr, "%sfilter (%s): Couldn't create lockfile %s\n",
X***************
X*** 122,124 ****
X  	         fclose(tempfd);
X! 		 unlink(lockfile);
X  	         leave("Cannot open any mailbox");	/* DIE DIE DIE DIE!! */
X--- 143,146 ----
X  	         fclose(tempfd);
X! 		 if (locked)
X! 		   unlink(lockfile);
X  	         leave("Cannot open any mailbox");	/* DIE DIE DIE DIE!! */
X***************
X*** 146,148 ****
X  	  fclose(mailfd);
X! 	  unlink(lockfile);	/* blamo! */
X  	  fclose(tempfd);
X--- 168,171 ----
X  	  fclose(mailfd);
X! 	  if (locked)
X! 	    unlink(lockfile);     /* blamo! */
X  	  fclose(tempfd);
SHAR_EOF
if test 2312 -ne `wc -c < 'p.filter'`
then
	echo 'shar: error transmitting "p.filter" (should have been 2312 characters) '
fi
chmod 644 'p.filter'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

Patches for hdrs/*.h.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	p.hdrs
# This archive created: Tue Jan 26 19:14:41 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "p.hdrs" (3122 characters) '
if test -f 'p.hdrs'
then
	echo 'shar: will not overwrite existing file "p.hdrs" '
else
sed 's/^X//' << \SHAR_EOF > 'p.hdrs'
XIndex: headers.h
X*** elm1.7beta/hdrs/headers.h	Mon Nov  2 20:14:23 1987
X--- elm/hdrs/headers.h	Mon Dec  7 12:58:11 1987
X***************
X*** 8,9 ****
X--- 8,14 ----
X  #include <fcntl.h>
X+ #include <ctype.h>
X+ 
X+ /** Don't use these macros, use the functions in strings.c **/
X+ #undef toupper
X+ #undef tolower
X  
XIndex: sysdefs.h
X*** elm1.7beta/hdrs/sysdefs.h	Mon Nov  9 08:23:34 1987
X--- elm/hdrs/sysdefs.h	Mon Dec  7 12:59:19 1987
X***************
X*** 20,23 ****
X  
X! #define MAX_SALIASES	503	/* number of system aliases allowed      */
X! #define MAX_UALIASES	251	/* number of user aliases allowed 	 */
X  #define MAX_IN_WEEDLIST 150	/* max headers to weed out               */
X--- 20,23 ----
X  
X! #define MAX_SALIASES	223	/* number of system aliases allowed      */
X! #define MAX_UALIASES	127	/* number of user aliases allowed 	 */
X  #define MAX_IN_WEEDLIST 150	/* max headers to weed out               */
X***************
X*** 47,49 ****
X  
X! /** #define NO_VM **/
X  
X--- 47,49 ----
X  
X! #define NO_VM
X  
X***************
X*** 59,61 ****
X  
X! #define ALLOW_BCC
X  
X--- 59,61 ----
X  
X! /** #define ALLOW_BCC **/
X  
X***************
X*** 104,106 ****
X  
X! #define DONT_ADD_FROM
X  
X--- 104,106 ----
X  
X! /** #define DONT_ADD_FROM **/
X  
X***************
X*** 126,128 ****
X  #define PREFER_UUCP
X! #define BOGUS_INTERNET	"@bdmrrr.bdm.COM"
X  
X--- 126,128 ----
X  #define PREFER_UUCP
X! #define BOGUS_INTERNET	"@ateng.UUCP"
X  
X***************
X*** 133,136 ****
X  
X! /** #define USE_DOMAIN **/
X! #define DOMAIN		"<enter your domain here>"
X  
X--- 133,136 ----
X  
X! #define USE_DOMAIN
X! #define DOMAIN		".UUCP"
X  
X***************
X*** 170,172 ****
X  /** Do we have the 'gethostname()' call?  If not, define the following **/
X! /** #define NEED_GETHOSTNAME **/
X  
X--- 170,172 ----
X  /** Do we have the 'gethostname()' call?  If not, define the following **/
X! #define NEED_GETHOSTNAME
X  
X***************
X*** 178,180 ****
X  
X! /** #define SHORTNAMES **/
X  
X--- 178,180 ----
X  
X! #define SHORTNAMES
X  
X***************
X*** 209,211 ****
X  
X! #ifdef BSD
X  # define default_editor	"/usr/ucb/vi"
X--- 209,211 ----
X  
X! #if defined(BSD)
X  # define default_editor	"/usr/ucb/vi"
X***************
X*** 212,213 ****
X--- 212,216 ----
X  # define mailhome	"/usr/spool/mail/"
X+ #elif defined(M_XENIX)
X+ # define default_editor	"/usr/local/bin/edt"
X+ # define mailhome	"/usr/spool/mail/"
X  #else
X***************
X*** 222,224 ****
X  #define smflags		"-oi -oem"	/* ignore dots and mail back errors */
X! #ifdef SYSV_3
X  # define mailer		"/bin/rmail -s"
X--- 225,228 ----
X  #define smflags		"-oi -oem"	/* ignore dots and mail back errors */
X! 
X! #if defined(SYSV_3)
X  # define mailer		"/bin/rmail -s"
X***************
X*** 224,225 ****
X--- 228,231 ----
X  # define mailer		"/bin/rmail -s"
X+ #elif defined(M_XENIX)
X+ # define mailer		"/usr/bin/rmail"
X  #else
X***************
X*** 227,229 ****
X  #endif
X! #ifdef BSD
X  # define mailx		"/usr/ucb/Mail"
X--- 233,236 ----
X  #endif
X! 
X! #if defined(BSD)
X  # define mailx		"/usr/ucb/Mail"
X***************
X*** 229,230 ****
X--- 236,239 ----
X  # define mailx		"/usr/ucb/Mail"
X+ #elif defined(M_XENIX)
X+ # define mailx		"/bin/mail"
X  #else
SHAR_EOF
if test 3122 -ne `wc -c < 'p.hdrs'`
then
	echo 'shar: error transmitting "p.hdrs" (should have been 3122 characters) '
fi
chmod 644 'p.hdrs'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

The patches for src/*.[hc] were two large, so I split them.  This is
part one of two.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	p.src.1
# This archive created: Tue Jan 26 19:14:42 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "p.src.1" (27008 characters) '
if test -f 'p.src.1'
then
	echo 'shar: will not overwrite existing file "p.src.1" '
else
sed 's/^X//' << \SHAR_EOF > 'p.src.1'
XIndex: addr_utils.c
X*** elm1.7beta/src/addr_utils.c	Mon Nov  2 20:09:53 1987
X--- elm/src/addr_utils.c	Mon Dec  7 12:52:21 1987
X***************
X*** 11,17 ****
X  #include <sys/stat.h>
X- #include <ctype.h>
X- 
X- #ifdef BSD 
X- #undef tolower
X- #endif
X  
X--- 11,12 ----
XIndex: builtin.c
X*** elm1.7beta/src/builtin.c	Mon Nov  2 20:14:34 1987
X--- elm/src/builtin.c	Mon Dec  7 12:52:31 1987
X***************
X*** 20,22 ****
X  #include "headers.h"
X- #include <ctype.h>
X  
X--- 20,21 ----
X***************
X*** 23,28 ****
X  #define  BEEP		007		/* ASCII Bell character */
X- 
X- #ifdef BSD
X- #  undef tolower
X- #endif
X  
X--- 22,23 ----
XIndex: calendar.c
X*** elm1.7beta/src/calendar.c	Mon Nov  2 20:13:37 1987
X--- elm/src/calendar.c	Wed Dec  9 09:18:43 1987
X***************
X*** 43,44 ****
X--- 43,45 ----
X  char *error_name(), *error_description(), *strcpy();
X+ FILE *user_fopen();
X  
X***************
X*** 51,63 ****
X  
X! 	if (can_open(calendar_file, "a") != 0) {
X! 	  dprint(2, (debugfile,
X! 		  "Error: wrong permissions to append to calendar %s\n",
X! 		  calendar_file));
X! 	  dprint(2, (debugfile, "** %s - %s **\n",
X! 		  error_name(errno), error_description(errno)));
X! 	  error1("Not able to append to file %s!", calendar_file);
X! 	  return; 
X! 	}
X! 
X! 	if ((calendar = fopen(calendar_file,"a")) == NULL) {
X  	  dprint(2, (debugfile, 
X--- 52,55 ----
X  
X! 	if ((calendar = user_fopen(calendar_file,"a")) == NULL) {
X! 	  int err = errno;
X  	  dprint(2, (debugfile, 
X***************
X*** 66,69 ****
X  	  dprint(2, (debugfile, "** %s - %s **\n",
X! 		  error_name(errno), error_description(errno)));
X! 	  error1("Couldn't append to file %s!", calendar_file);
X  	  return; 
X--- 58,62 ----
X  	  dprint(2, (debugfile, "** %s - %s **\n",
X! 		  error_name(err), error_description(err)));
X! 	  error2("Couldn't append to file %s! (%s)",
X! 		  calendar_file, error_description(err));
X  	  return; 
XIndex: curses.c
X*** elm1.7beta/src/curses.c	Mon Nov  2 20:09:06 1987
X--- elm/src/curses.c	Wed Dec  9 14:53:19 1987
X***************
X*** 39,45 ****
X  
X- #include <ctype.h>
X- 
X- #ifdef BSD
X- #undef tolower
X- #endif
X  #include "curses.h"
X--- 39,40 ----
X***************
X*** 565,567 ****
X  char *line;
X! int   argcount, arg1, arg2, arg3;
X  {
X--- 560,563 ----
X  char *line;
X! int   argcount;
X! long  arg1, arg2, arg3;
X  {
X***************
X*** 619,621 ****
X  char *line;
X! char *arg1;
X  {
X--- 615,617 ----
X  char *line;
X! long arg1;
X  {
X***************
X*** 634,636 ****
X  char *line;
X! char *arg1, *arg2;
X  {
X--- 630,632 ----
X  char *line;
X! long arg1, arg2;
X  {
X***************
X*** 649,651 ****
X  char *line;
X! char *arg1, *arg2, *arg3;
X  {
X--- 645,647 ----
X  char *line;
X! long arg1, arg2, arg3;
X  {
X***************
X*** 733,735 ****
X  
X! 	return(result == 0? EOF : ch);
X  }
X--- 729,731 ----
X  
X! 	return(result == 0? EOF : (ch & 0377));
X  }
XIndex: date.c
X*** elm1.7beta/src/date.c	Mon Nov  2 20:06:53 1987
X--- elm/src/date.c	Mon Dec  7 12:52:55 1987
X***************
X*** 21,29 ****
X  
X- #include <ctype.h>
X- 
X- #ifdef BSD
X- #undef toupper
X- #undef tolower
X- #endif
X- 
X  #define MONTHS_IN_YEAR	11	/* 0-11 equals 12 months! */
X--- 21,22 ----
XIndex: delete.c
X*** elm1.7beta/src/delete.c	Mon Nov  2 20:12:11 1987
X--- elm/src/delete.c	Fri Dec 18 10:41:45 1987
X***************
X*** 46,48 ****
X  	  MoveCursor((msg % headers_per_page) + 4, 3);
X! 	  if (msg == current && !arrow_cursor) {
X  	    StartBold();
X--- 46,48 ----
X  	  MoveCursor((msg % headers_per_page) + 4, 3);
X! 	  if (msg == (current - 1) && !arrow_cursor) {
X  	    StartBold();
X***************
X*** 75,77 ****
X  	  MoveCursor((msg % headers_per_page) + 4, 4);
X! 	  if (msg == current && !arrow_cursor) {
X  	    StartBold();
X--- 75,77 ----
X  	  MoveCursor((msg % headers_per_page) + 4, 4);
X! 	  if (msg == (current - 1) && !arrow_cursor) {
X  	    StartBold();
XIndex: domains.c
X*** elm1.7beta/src/domains.c	Mon Nov  9 08:23:50 1987
X--- elm/src/domains.c	Mon Dec  7 12:53:06 1987
X***************
X*** 12,14 ****
X  #include <stdio.h>
X- #include <ctype.h>
X  
X--- 12,13 ----
X***************
X*** 15,21 ****
X  #include "headers.h"
X- 
X- #ifdef BSD
X- # undef toupper
X- # undef tolower
X- #endif
X  
X--- 14,15 ----
XIndex: editmsg.c
X*** elm1.7beta/src/editmsg.c	Mon Nov  2 20:08:29 1987
X--- elm/src/editmsg.c	Mon Dec  7 12:53:25 1987
X***************
X*** 12,14 ****
X  #include <signal.h>
X- #include <ctype.h>
X  
X--- 12,13 ----
XIndex: elm.c
X*** elm1.7beta/src/elm.c	Mon Nov  2 20:10:19 1987
X--- elm/src/elm.c	Wed Dec  9 09:48:03 1987
X***************
X*** 10,16 ****
X  
X- #ifdef BSD
X- # undef toupper
X- # undef tolower
X- #endif
X- 
X  long bytes();
X--- 10,11 ----
X***************
X*** 103,105 ****
X  
X! 	    case '$'    : resync(); 					break;
X  
X--- 98,100 ----
X  
X! 	    case '$'    :  redraw = resync();           break;
X  
X***************
X*** 194,196 ****
X  			     define_softkeys(CHANGE);
X! 	                     redraw = newmbox(0, TRUE, TRUE);
X  			     /* mailfile_size = bytes(infile);	newmbox.c NSM */
X--- 189,192 ----
X  			     define_softkeys(CHANGE);
X! 			     if (newmbox(0, TRUE, TRUE))
X! 			       redraw = TRUE;
X  			     /* mailfile_size = bytes(infile);	newmbox.c NSM */
X***************
X*** 299,300 ****
X--- 295,300 ----
X  
X+ #if 0
X+ 	    /*
X+ 	    **  This `feature' is so buggy, it's dangerous.  -- Chip
X+ 	    */
X  	    case 'l'    :  PutLine0(LINES-3, strlen("Command: "),
X***************
X*** 309,310 ****
X--- 309,311 ----
X  			   break;
X+ #endif
X  
XIndex: encode.c
X*** elm1.7beta/src/encode.c	Mon Nov  2 20:12:58 1987
X--- elm/src/encode.c	Sat Dec  5 15:44:26 1987
X***************
X*** 133,134 ****
X--- 133,142 ----
X  {
X+ #ifdef M_XENIX
X+ 
X+ 	/** Sorry, Xenix hasn't got a crypt() function **/
X+ 
X+ 	encrypted_key = rkey;
X+ 
X+ #else
X+ 
X  	/** encrypt the key using the system routine 'crypt' **/
X***************
X*** 141,142 ****
X--- 149,152 ----
X  	encrypted_key = crypt( key, salt);
X+ 
X+ #endif
X  }
XIndex: file.c
X*** elm1.7beta/src/file.c	Mon Nov  2 20:15:08 1987
X--- elm/src/file.c	Wed Dec  9 09:44:12 1987
X***************
X*** 8,10 ****
X  #include "headers.h"
X- #include <ctype.h>
X  #include <errno.h>
X--- 8,9 ----
X***************
X*** 11,16 ****
X  
X- #ifdef BSD
X- #undef tolower
X- #endif
X- 
X  extern int errno;
X--- 10,11 ----
X***************
X*** 19,20 ****
X--- 14,16 ----
X  unsigned long sleep();
X+ FILE *user_fopen();
X  
X***************
X*** 107,110 ****
X  
X! 	if (access(filename,ACCESS_EXISTS)) 	/* already there!! */
X! 	  appending = 1;
X  	  
X--- 103,106 ----
X  
X! 	if (access(filename,ACCESS_EXISTS) == 0)    /* already there!! */
X! 	  ++appending;
X  	  
X***************
X*** 110,127 ****
X  	  
X! #ifdef BSD4_1
X! 	if ((errno = ((can_open(filename, "a") & ~0x0200) >>8))) {
X! #else
X! 	if ((errno = can_open(filename, "a"))) {
X! #endif
X! 	  error1("Wrong permissions to save message to file %s!", filename);
X! 	  dprint(2, (debugfile, 
X! 		"Error: access permission on file %s denied (%s)! (save)\n",
X! 		filename, error_name(errno)));
X! 	  header_table[current-1].status = oldstat;	/* BACK! */
X! 	  return(0);
X! 	}
X! 
X! 	dprint(4,(debugfile, "Saving mail to file '%s'...\n", filename));
X! 
X! 	if ((save_file = fopen(filename,"a")) == NULL) {
X  	  dprint(2, (debugfile,
X--- 106,109 ----
X  	  
X! 	if ((save_file = user_fopen(filename,"a")) == NULL) {
X! 	  int err = errno;
X  	  dprint(2, (debugfile,
X***************
X*** 127,129 ****
X  	  dprint(2, (debugfile,
X! 		"Error: couldn't append to specified file %s (save)\n", 
X  		filename));
X--- 109,111 ----
X  	  dprint(2, (debugfile,
X! 		"Error: couldn't append message to file %s! (save)\n",
X  		filename));
X***************
X*** 129,131 ****
X  		filename));
X! 	  error1("Couldn't append to file %s!", filename);
X  	  header_table[current-1].status = oldstat;	/* BACK! */
X--- 111,116 ----
X  		filename));
X! 	  dprint(2, (debugfile, "** %s - %s **\n",
X! 		  error_name(err), error_description(err)));
X! 	  error2("Couldn't append to file %s! (%s)",
X! 		  filename, error_description(err));
X  	  header_table[current-1].status = oldstat;	/* BACK! */
X***************
X*** 134,135 ****
X--- 119,122 ----
X  
X+ 	dprint(4,(debugfile, "Saving mail to file '%s'...\n", filename));
X+ 
X  	for (i=0; i < message_count; i++) 	/* save each tagged msg */
X***************
X*** 175,177 ****
X  
X! 	if (! appending)	/* don't ask */
X  	  error2("Message %d appended to file %s", number+1, filename);
X--- 162,164 ----
X  
X! 	if (appending)
X  	  error2("Message %d appended to file %s", number+1, filename);
XIndex: file_utils.c
X*** elm1.7beta/src/file_utils.c	Mon Nov  2 20:13:47 1987
X--- elm/src/file_utils.c	Wed Dec  9 10:18:24 1987
X***************
X*** 10,12 ****
X  #include <sys/stat.h>
X- #include <ctype.h>
X  #include <errno.h>
X--- 10,11 ----
X***************
X*** 13,18 ****
X  
X- #ifdef BSD
X- # undef tolower
X- #endif
X- 
X  #include <signal.h>
X--- 12,13 ----
X***************
X*** 57,59 ****
X  int
X! can_access(file, mode)
X  char *file; 
X--- 52,54 ----
X  int
X! user_access(file, mode)
X  char *file; 
X***************
X*** 61,63 ****
X  {
X! 	/** returns ZERO iff user can access file or "errno" otherwise **/
X  
X--- 56,59 ----
X  {
X! 	/** returns 0 iff user can access file, -1 otherwise.
X! 	    errno is set appropriately. **/
X  
X***************
X*** 63,80 ****
X  
X! 	int the_stat = 0, pid, w; 
X! 	void _exit(), exit();
X! #ifdef BSD
X! 	union wait status;
X! #else
X! 	int status;
X! #endif
X! 	register int (*istat)(), (*qstat)();
X! 	
X! #ifdef NO_VM		/* machine without virtual memory!! */
X! 	if ((pid = fork()) == 0) {
X! #else
X! 	if ((pid = vfork()) == 0) {
X! #endif
X! 	  setgid(groupid);
X! 	  setuid(userid);		/** back to normal userid **/
X  
X--- 59,63 ----
X  
X! 	/** This routine used to fork() etc. just like user_fopen().
X! 	    With fopen() I can live with it, but here, I just can't.
X! 	    Thus we simulate the kernel's access() processing.  **/
X  
X***************
X*** 80,82 ****
X  
X! 	  errno = 0;
X  
X--- 63,66 ----
X  
X! 	struct stat st;
X! 	int filemode;
X  
X***************
X*** 82,89 ****
X  
X! 	  if (access(file, mode) == 0) 
X! 	    _exit(0);
X! 	  else 
X! 	    _exit(errno != 0? errno : 1);	/* never return zero! */
X! 	  _exit(127);
X! 	}
X  
X--- 66,71 ----
X  
X! 	if (stat(file, &st) != 0)
X! 	  return (-1);
X! 	if (mode == 0)
X! 	  return (0);
X  
X***************
X*** 89,92 ****
X  
X! 	istat = signal(SIGINT, SIG_IGN);
X! 	qstat = signal(SIGQUIT, SIG_IGN);
X  
X--- 71,78 ----
X  
X! 	filemode = st.st_mode & 0777;
X! 	if (userid == st.st_uid)
X! 	  filemode >>= 6;
X! 	else if (userid == st.st_gid)
X! 	  filemode >>= 3;
X! 	filemode &= 07;
X  
X***************
X*** 92,95 ****
X  
X! 	while ((w = wait(&status)) != pid && w != -1)
X! 		;
X  
X--- 78,81 ----
X  
X! 	if ((filemode & mode) == mode)
X! 	  return (0);
X  
X***************
X*** 95,106 ****
X  
X! #ifdef BSD
X! 	the_stat = status.w_retcode;
X! #else
X! 	the_stat = status;
X! #endif
X! 
X! 	signal(SIGINT, istat);
X! 	signal(SIGQUIT, qstat);
X! 
X! 	return(the_stat);
X  }
X--- 81,84 ----
X  
X! 	errno = EACCES;
X! 	return (-1);
X  }
X***************
X*** 107,110 ****
X  
X! int
X! can_open(file, mode)
X  char *file, *mode;
X--- 85,88 ----
X  
X! FILE *
X! user_fopen(file, mode)
X  char *file, *mode;
X***************
X*** 111,115 ****
X  {
X! 	/** Returns 0 iff user can open the file.  This is not
X! 	    the same as can_access - it's used for when the file might
X! 	    not exist... **/
X  
X--- 89,94 ----
X  {
X! 	/** Returns result of `real' user trying to open the given file.
X! 	    (Original UID and GID are used.)  This is used for cases when
X! 	    the file might already exist -- if, for example, it's owned by
X! 	    bin, elm may open it but the user shouldn't be allowed to.  **/
X  
X***************
X*** 115,118 ****
X  
X! 	FILE *fd;
X! 	int the_stat = 0, pid, w; 
X  	void _exit(), exit();
X--- 94,96 ----
X  
X! 	int pid, err, w;
X  	void _exit(), exit();
X***************
X*** 130,131 ****
X--- 108,111 ----
X  #endif
X+ 	  FILE *fp;
X+ 
X  	  setgid(groupid);
X***************
X*** 133,135 ****
X  	  errno = 0;
X! 	  if ((fd = fopen(file, mode)) == NULL)
X  	    _exit(errno);
X--- 113,115 ----
X  	  errno = 0;
X! 	  if ((fp = fopen(file, mode)) == NULL)
X  	    _exit(errno);
X***************
X*** 136,138 ****
X  	  else {
X! 	    fclose(fd);		/* don't just LEAVE it! */
X  	    _exit(0);
X--- 116,118 ----
X  	  else {
X! 	    fclose(fp);         /* don't just LEAVE it! */
X  	    _exit(0);
X***************
X*** 148,149 ****
X--- 128,132 ----
X  
X+ 	signal(SIGINT, istat);
X+ 	signal(SIGQUIT, qstat);
X+ 
X  #ifdef BSD
X***************
X*** 149,151 ****
X  #ifdef BSD
X! 	the_stat = status.w_retcode;
X  #else
X--- 132,134 ----
X  #ifdef BSD
X! 	err = status.w_retcode;
X  #else
X***************
X*** 151,153 ****
X  #else
X! 	the_stat = status;
X  #endif
X--- 134,136 ----
X  #else
X! 	err = status >> 8;
X  #endif
X***************
X*** 154,159 ****
X  	
X! 	signal(SIGINT, istat);
X! 	signal(SIGQUIT, qstat);
X! 
X! 	return(the_stat);
X  }
X--- 137,152 ----
X  	
X! 	/*
X! 	 * Go ahead and open the file (if child said it was okay).
X! 	 * Leave error code in errno for use by caller.
X! 	 * Return result of fopen().
X! 	 * (New code by Chip, 9 Dec 1987)
X! 	 */
X! 	if (err) {
X! 	  errno = err;
X! 	  return (NULL);
X! 	}
X! 	else {
X! 	  errno = 0;
X! 	  return(fopen(file, mode));
X! 	}
X  }
XIndex: fileio.c
X*** elm1.7beta/src/fileio.c	Mon Nov  2 20:12:16 1987
X--- elm/src/fileio.c	Mon Dec  7 12:53:50 1987
X***************
X*** 10,12 ****
X  #include <sys/stat.h>
X- #include <ctype.h>
X  #include <errno.h>
X--- 10,11 ----
X***************
X*** 12,17 ****
X  #include <errno.h>
X- 
X- #ifdef BSD
X- #undef tolower
X- #endif
X  
X--- 11,12 ----
XIndex: hdrconfg.c
X*** elm1.7beta/src/hdrconfg.c	Mon Nov  2 20:13:52 1987
X--- elm/src/hdrconfg.c	Mon Dec  7 12:54:02 1987
X***************
X*** 25,32 ****
X  
X- #include <ctype.h>
X- 
X- #ifdef BSD
X- #undef toupper
X- #endif
X- 
X  /* these are all defined in the mailmsg file! */
X--- 25,26 ----
XIndex: help.c
X*** elm1.7beta/src/help.c	Mon Nov  2 20:14:38 1987
X--- elm/src/help.c	Mon Dec  7 12:54:08 1987
X***************
X*** 8,15 ****
X  
X- #include <ctype.h>
X- 
X- #ifdef BSD
X- # undef tolower
X- #endif
X- 
X  #include "headers.h"
X--- 8,9 ----
XIndex: initialize.c
X*** elm1.7beta/src/initialize.c	Mon Nov  2 20:17:17 1987
X--- elm/src/initialize.c	Wed Dec  9 10:04:36 1987
X***************
X*** 23,25 ****
X  #include <signal.h>
X- #include <ctype.h>
X  #include <errno.h>
X--- 23,24 ----
X***************
X*** 26,32 ****
X  
X- #ifdef BSD
X- #undef toupper
X- #undef tolower
X- #endif
X- 
X  extern int errno;		/* system error number on failure */
X--- 25,26 ----
X***************
X*** 189,191 ****
X  	  (void) expand_filename(infile);
X! 	  if ((errno = can_access(infile, READ_ACCESS))) {
X  	    dprint(1, (debugfile,
X--- 183,186 ----
X  	  (void) expand_filename(infile);
X! 	  if (user_access(infile, READ_ACCESS) != 0) {
X! 	    int err = errno;
X  	    dprint(1, (debugfile,
X***************
X*** 192,195 ****
X  		  "Error: given file %s as mailbox - unreadable (%s)!\n", 
X! 		  infile, error_name(errno)));
X! 	    fprintf(stderr,"Can't open mailbox '%s' for reading!\n", infile);
X  	    exit(1);
X--- 187,191 ----
X  		  "Error: given file %s as mailbox - unreadable (%s)!\n", 
X! 		  infile, error_name(err)));
X! 	    fprintf(stderr,"Can't open mailbox %s! (%s)\n",
X! 		  infile, error_description(err));
X  	    exit(1);
XIndex: input_utils.
X*** elm1.7beta/src/input_utils.c	Mon Nov  2 20:17:22 1987
X--- elm/src/input_utils.c	Wed Dec  9 15:31:02 1987
X***************
X*** 9,11 ****
X  #include <errno.h>
X- #include <ctype.h>
X  
X--- 9,10 ----
X***************
X*** 11,16 ****
X  
X- #ifdef BSD
X- #  undef tolower
X- #endif
X- 
X  extern int errno;		/* system error number */
X--- 10,11 ----
X***************
X*** 26,28 ****
X  want_to(question, dflt, echo_answer)
X! char *question, dflt;
X  int  echo_answer;
X--- 21,24 ----
X  want_to(question, dflt, echo_answer)
X! char *question;
X! char dflt;
X  int  echo_answer;
X***************
X*** 34,36 ****
X  	**/
X! 	register char ch, cols;
X  
X--- 30,32 ----
X  	**/
X! 	char ch;
X  
X***************
X*** 36,38 ****
X  
X! 	cols = (strlen(question) < 30)? COLUMNS-40 : COLUMNS-50;
X  
X--- 32,38 ----
X  
X! 	if (question != NULL) {
X! 	  int cols = (strlen(question) < 30)? COLUMNS-40 : COLUMNS-50;
X! 	  PutLine3(LINES-3, cols, "%s%c%c", question, dflt, BACKSPACE);
X! 	  fflush(stdout);
X! 	}
X  
X***************
X*** 38,47 ****
X  
X! 	PutLine3(LINES-3, cols,"%s%c%c", question, dflt, BACKSPACE);
X! 	fflush(stdout);
X! 	fflush(stdin);
X! 
X! 	ch = tolower(ReadCh());
X! 
X! 	if (echo_answer && ch > (char) ' ') {
X! 	  Writechar(ch);
X  	  fflush(stdout);
X--- 38,42 ----
X  
X! 	ch = yesno(dflt);
X! 	if (echo_answer) {
X! 	  Write_to_screen((ch == 'y') ? "Yes" : "No", 0);
X  	  fflush(stdout);
X***************
X*** 49,51 ****
X  
X! 	return(ch == '\n' || ch == '\r' ? dflt : ch);
X  }
X--- 44,67 ----
X  
X! 	return(ch);
X! }
X! 
X! int
X! yesno(dflt)
X! char dflt;
X! {
X! 	char    ch;
X! 
X! 	fflush(stdin);
X! 
X! 	do {
X! 	  ch = tolower(ReadCh());
X! 	  switch (ch) {
X! 	  case '\r':
X! 	  case '\n':
X! 		ch = dflt;
X! 		break;
X! 	  }
X! 	} while ((ch != 'y') && (ch != 'n'));
X! 
X! 	return (ch);
X  }
XIndex: leavembox.c
X*** elm1.7beta/src/leavembox.c	Mon Nov  2 20:08:37 1987
X--- elm/src/leavembox.c	Tue Dec 22 16:49:52 1987
X***************
X*** 1,2 ****
X! /**			leavembox.c			**/
X  
X--- 1,2 ----
X! /**                     leavembox.c                     **/
X  
X***************
X*** 15,17 ****
X  
X! #define  ECHOIT 	1	/* echo on for prompting! */
X  
X--- 15,17 ----
X  
X! #define  ECHOIT 	TRUE	/* echo on for prompting! */
X  
X***************
X*** 28,31 ****
X  
X- extern int errno;
X- 
X  char *error_name(), *error_description(), *strcpy();
X--- 28,29 ----
X***************
X*** 33,34 ****
X--- 31,33 ----
X  unsigned long sleep();
X+ FILE *user_fopen();
X  
X***************
X*** 34,35 ****
X--- 33,39 ----
X  
X+ extern int errno;
X+ 
X+ /* Name of mailbox lock file -- if empty, mailbox is not locked */
X+ static  char    cur_lockfile[SLEN];
X+ 
X  int
X***************
X*** 200,205 ****
X  	if (to_save) {
X! 	  if ((errno = can_open(outfile, "a"))) {
X! 	    error1(
X! 	         "Permission to append to %s denied!  Leaving mailbox intact\n",
X! 		 outfile);
X  	    dprint(1, (debugfile, 
X--- 204,207 ----
X  	if (to_save) {
X! 	  if ((temp = user_fopen(outfile,"a")) == NULL) {
X! 	    int err = errno;
X  	    dprint(1, (debugfile, 
X***************
X*** 205,214 ****
X  	    dprint(1, (debugfile, 
X! 		 "Error: Permission to append to outfile %s denied!! (%s)\n",
X! 		 outfile, "leavembox"));
X! 	    dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
X! 		 error_description(errno)));
X! 	    unlock();
X! 	    return(0);
X! 	  }
X! 	  if ((temp = fopen(outfile,"a")) == NULL) {
X  	    if (mbox_specified == 0)
X--- 207,214 ----
X  	    dprint(1, (debugfile, 
X! 		   "Error: Couldn't append to outfile %s!! (leavembox)\n",
X! 		   outfile));
X! 	    dprint(1, (debugfile, "** %s - %s **\n",
X! 		   error_name(err), error_description(err)));
X! 	    error2("Couldn't append to file %s! (%s)",
X! 		    outfile, error_description(err));
X  	    if (mbox_specified == 0)
X***************
X*** 215,224 ****
X  	      unlock();		/* remove mailfile lock! */
X! 	    dprint(1, (debugfile, "Error: could not append to file %s\n", 
X! 		    outfile));
X! 	    dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
X! 		 error_description(errno)));
X! 	    sprintf(buffer, "           Could not append to file %s!          ",
X! 		    outfile);
X! 	    Centerline(LINES-1, buffer);
X! 	    emergency_exit();
X  	  }
X--- 215,217 ----
X  	      unlock();		/* remove mailfile lock! */
X! 	    return(0);
X  	  }
X***************
X*** 245,246 ****
X--- 238,240 ----
X          if (stat(infile, &buf) != 0) {	/* grab original times... */
X+ 	  int err = errno;
X  	  dprint(1, (debugfile, "Error: errno %s attempting to stat file %s\n", 
X***************
X*** 246,250 ****
X  	  dprint(1, (debugfile, "Error: errno %s attempting to stat file %s\n", 
X! 		     error_name(errno), infile));
X!           error3("Error %s (%s) on stat(%s)", error_name(errno), 
X! 		error_description(errno), infile);
X  	}
X--- 240,244 ----
X  	  dprint(1, (debugfile, "Error: errno %s attempting to stat file %s\n", 
X! 		     error_name(err), infile));
X! 	  error3("Error %s (%s) on stat(%s)", error_name(err),
X! 		error_description(err), infile);
X  	}
X***************
X*** 348,351 ****
X  
X- char lock_name[SLEN];
X- 
X  lock(direction)
X--- 342,343 ----
X***************
X*** 366,368 ****
X  
X! 	register int iteration = 0, access_val, lock_fd;
X  
X--- 358,361 ----
X  
X! 	int iteration, fd, locked = FALSE, err = 0;
X! 	char lockfile[SLEN], locktemp[SLEN];
X  
X***************
X*** 368,370 ****
X  
X! 	sprintf(lock_name,"%s%s.lock", mailhome, username);
X  
X--- 361,363 ----
X  
X! 	unlock();       /* Just in case! */
X  
X***************
X*** 370,372 ****
X  
X! 	access_val = access(lock_name, ACCESS_EXISTS);
X  
X--- 363,365 ----
X  
X! 	get_locknames(lockfile, locktemp);
X  
X***************
X*** 372,377 ****
X  
X! 	while (access_val != -1 && iteration++ < MAX_ATTEMPTS) {
X! 	  dprint(2, (debugfile, 
X! 		  "File '%s' currently exists!  Waiting...(lock)\n", 
X! 		  lock_name));
X  	  if (direction == INCOMING)
X--- 365,372 ----
X  
X! 	if ((fd = creat(locktemp, 0)) == -1) {
X! 	  dprint(1, (debugfile, "Can't create temp file '%s'\n", locktemp));
X! 	  PutLine1(LINES-1, 0,
X! 		   "I couldn't create the temp file '%s'", locktemp);
X! 	  PutLine2(LINES, 0, "** %s - %s **", error_name(errno),
X! 		   error_description(errno));
X  	  if (direction == INCOMING)
X***************
X*** 377,379 ****
X  	  if (direction == INCOMING)
X! 	    PutLine0(LINES, 0, "Mail being received!\twaiting...");
X  	  else
X--- 372,374 ----
X  	  if (direction == INCOMING)
X! 	    leave();
X  	  else
X***************
X*** 379,384 ****
X  	  else
X! 	    error1("Attempt %d: Mail being received...waiting", 
X!                    iteration);
X! 	  sleep(5);
X! 	  access_val = access(lock_name, ACCESS_EXISTS);
X  	}
X--- 374,376 ----
X  	  else
X! 	    emergency_exit();
X  	}
X***************
X*** 384,387 ****
X  	}
X! 	
X! 	if (access_val != -1) {
X  
X--- 376,378 ----
X  	}
X! 	close(fd);
X  
X***************
X*** 387,388 ****
X--- 378,409 ----
X  
X+ 	for (;;) {
X+ 
X+ 	  /** Try MAX_ATTEMPTS times to link locktemp to lockfile. **/
X+ 
X+ 	  for (iteration = 0; iteration < MAX_ATTEMPTS; ++iteration) {
X+ 	    if (link(locktemp, lockfile) == 0) {
X+ 	      locked = TRUE;
X+ 	      break;
X+ 	    }
X+ 
X+ 	    /* We expect EEXIST; all others are real problems. */
X+ 
X+ 	    if (errno != EEXIST) {
X+ 	      dprint(1, (debugfile,
X+ 		     "Can't create lock file '%s' -- %s (lock)\n",
X+ 		      lockfile, error_name(errno)));
X+ 	      leave(error1("Can't create lock file '%s'!", lockfile));
X+ 	    }
X+ 
X+ 	    if (direction == INCOMING)
X+ 	      PutLine0(LINES, 0, "Mail being received!  Waiting...");
X+ 	    else
X+ 	      error1("Attempt %d: Mail being received!  Waiting...", iteration);
X+ 
X+ 	    sleep(5);
X+ 	  }
X+ 
X+ 	  if (locked)
X+ 	    break;
X+ 
X  #ifdef REMOVE_AT_LAST
X***************
X*** 398,400 ****
X  
X! 	  if (unlink(lock_name) != 0) {
X  	    dprint(1, (debugfile,
X--- 419,421 ----
X  
X! 	  if (unlink(lockfile) != 0) {
X  	    dprint(1, (debugfile,
X***************
X*** 400,407 ****
X  	    dprint(1, (debugfile,
X! 		  "Error %s (%s)\n\ttrying to unlink file %s (%s)\n", 
X! 		     error_name(errno), error_description(errno), lock_name));
X! 	    PutLine1(LINES, 0, 
X! 		   "\n\rI couldn't remove the current lock file %s\n\r", 
X! 		   lock_name);
X! 	    PutLine2(LINES, 0, "** %s - %s **\n\r", error_name(errno),
X  		   error_description(errno));
X--- 421,428 ----
X  	    dprint(1, (debugfile,
X! 		  "Error %s (%s)\n\ttrying to unlink file %s\n",
X! 		     error_name(errno), error_description(errno), lockfile));
X! 	    PutLine1(LINES-1, 0,
X! 		   "I couldn't remove the current lock file '%s'",
X! 		   lockfile);
X! 	    PutLine2(LINES, 0, "** %s - %s **", error_name(errno),
X  		   error_description(errno));
X***************
X*** 407,408 ****
X--- 428,431 ----
X  		   error_description(errno));
X+ 
X+ 	    unlink(locktemp);
X  	    if (direction == INCOMING)
X***************
X*** 413,415 ****
X  	  
X! 	  /* everything is okay, so lets act as if nothing had happened... */
X  
X--- 436,438 ----
X  	  
X! 	  /* and go through the loop again... */
X  
X***************
X*** 415,417 ****
X  
X! #else
X  
X--- 438,440 ----
X  
X! #else /* !REMOTE_AT_LAST */
X  
X***************
X*** 419,420 ****
X--- 442,446 ----
X  	     any of those! */
X+ 
X+ 	  lockfile[0] = '\0';   /* Don't let unlock() remove it! */
X+ 
X  	  if (direction == INCOMING) {
X***************
X*** 423,427 ****
X  		"Please try to read your mail again in a few minutes.\n");
X! 	    dprint(2, (debugfile, 
X! 		    "Warning: bailing out after %d iterations...(lock)\n", 
X! 		    iteration));
X  	    leave_locked(0);
X--- 449,452 ----
X  		"Please try to read your mail again in a few minutes.\n");
X! 	    dprint(2, (debugfile,"Giving up after %d iterations...(lock)\n",
X! 		iteration));
X  	    leave_locked(0);
X***************
X*** 438,440 ****
X  
X! 	/* if we get here we can create the lock file, so lets do it! */
X  
X--- 463,465 ----
X  
X! 	/** We're locked!  Remove the original link and return. **/
X  
X***************
X*** 440,464 ****
X  
X! 	if ((lock_fd = creat(lock_name, 0)) == -1) {
X! 	  dprint(1, (debugfile,
X! 		 "Can't create lock file: creat(%s) raises error %s (lock)\n", 
X! 		  lock_name, error_name(errno)));
X! 	  if (errno == EACCES)
X! 	    leave(error1(
X!                  "Can't create lock file!  I need write permission in %s!\n\r",
X! 		  mailhome));
X! 	  else {
X! 	    dprint(1, (debugfile, 
X! 		  "Error encountered attempting to create lock %s\n", 
X! 		  lock_name));
X! 	    dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
X! 		  error_description(errno)));
X! 	    PutLine1(LINES, 0,
X!          "\n\rError encountered while attempting to create lock file %s;\n\r", 
X! 		  lock_name);
X! 	    PutLine2(LINES, 0, "** %s - %s **\n\r", error_name(errno),
X! 		  error_description(errno));
X! 	    leave();
X! 	  }
X! 	}
X! 	close(lock_fd);	/* close it.  We don't want to KEEP the thing! */
X  }
X--- 465,468 ----
X  
X! 	unlink(locktemp);
X! 	strcpy(cur_lockfile, lockfile);
X  }
X***************
X*** 471,473 ****
X  
X! 	(void) unlink(lock_name);
X  }
X--- 475,506 ----
X  
X! 	/** By Chip -- only unlink it once.  This prevents inadvertent
X! 	    removing of a lock file that I didn't create. **/
X! 
X! 	if (cur_lockfile[0]) {
X! 	  (void) unlink(cur_lockfile);
X! 	  cur_lockfile[0] = '\0';
X! 	}
X! }
X! 
X! get_locknames(n, t)
X! char *n;
X! char *t;
X! {
X! 	static char locktemp[SLEN];
X! 
X! #ifdef M_XENIX
X! 	sprintf(n,  "/tmp/%s.mlk", username);
X! #else
X! 	sprintf(n,  "%s%s.lock", mailhome, username);
X! #endif
X! 
X! 	if (locktemp[0] == '\0') {
X! #ifdef M_XENIX
X! 	  sprintf(locktemp, "/tmp/Elm.XXXXXX");
X! #else
X! 	  sprintf(locktemp, "%sElm.XXXXXX", mailhome);
X! #endif
X! 	  mktemp(locktemp);
X! 	}
X! 	strcpy(t, locktemp);
X  }
XIndex: limit.c
X*** elm1.7beta/src/limit.c	Mon Nov  2 20:15:15 1987
X--- elm/src/limit.c	Wed Dec  9 15:38:25 1987
X***************
X*** 32,35 ****
X  		BACKSPACE);
X! 	  criteria[0] = ReadCh();
X! 	  if (tolower(criteria[0]) == 'y') 
X  	    PutLine0(LINES-3, COLUMNS-30, "Adding criteria...");
X--- 32,35 ----
X  		BACKSPACE);
X! 	  criteria[0] = want_to((char *)NULL, 'n', TRUE);
X! 	  if (criteria[0] == 'y') 
X  	    PutLine0(LINES-3, COLUMNS-30, "Adding criteria...");
X***************
X*** 39,41 ****
X  	  }
X- 	  
X  	}
X--- 39,40 ----
SHAR_EOF
if test 27008 -ne `wc -c < 'p.src.1'`
then
	echo 'shar: error transmitting "p.src.1" (should have been 27008 characters) '
fi
chmod 644 'p.src.1'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

This is the second of two patch files for src/*.[hc].

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	p.src.2
# This archive created: Tue Jan 26 19:14:43 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "p.src.2" (19785 characters) '
if test -f 'p.src.2'
then
	echo 'shar: will not overwrite existing file "p.src.2" '
else
sed 's/^X//' << \SHAR_EOF > 'p.src.2'
XIndex: mailmsg1.c
X*** elm1.7beta/src/mailmsg1.c	Mon Nov  2 20:20:49 1987
X--- elm/src/mailmsg1.c	Wed Dec  9 15:35:23 1987
X***************
X*** 144,145 ****
X--- 144,146 ----
X  	int len = 9;
X+ 	char ch;
X  
X***************
X*** 173,178 ****
X  
X! 	  if (tolower(ReadCh()) != 'y') {	/* user says no! */
X! 	    if (mail_only) {
X! 	      printf("\n\r\n\rMail Cancelled!\n\r");
X! 	      return(0);
X  	    }
X--- 174,181 ----
X  
X! 	  if (yesno('n') == 'n') {	/* user says no! */
X! 	    if (mail_only)
X! 	      printf("No\r\n\r\nMail Cancelled!\n\r");
X! 	    else {
X! 	      ClearLine(LINES-2);
X! 	      error("mail not sent");
X  	    }
X***************
X*** 178,181 ****
X  	    }
X- 	    ClearLine(LINES-2);
X- 	    error("mail not sent");
X  	    return(0);
X--- 181,182 ----
X***************
X*** 182,186 ****
X  	  }
X! 	  else if (! mail_only) {
X! 	    PutLine0(LINES-2,0,"Subject: <none>");
X! 	    CleartoEOLN();
X  	  }
X--- 183,191 ----
X  	  }
X! 	  else {
X! 	    if (mail_only)
X! 	      printf("Yes\r\n");
X! 	    else {
X! 	      PutLine0(LINES-2,0,"Subject: <none>");
X! 	      CleartoEOLN();
X! 	    }
X  	  }
XIndex: mailmsg2.c
X*** elm1.7beta/src/mailmsg2.c	Mon Nov  2 20:10:29 1987
X--- elm/src/mailmsg2.c	Wed Dec  9 15:45:40 1987
X***************
X*** 220,227 ****
X  
X! 	if ((real_reply=write_header_info(filename2, expanded_to, expanded_cc,
X! #ifdef ALLOW_BCC
X! 				 	  expanded_bcc,
X! #endif
X! 			                  form == YES)) == NULL) {
X! 
X  	  /** IT FAILED!!  MEIN GOTT!  Use a dumb mailer instead! **/
X--- 220,223 ----
X  
X! 	real_reply = write_header_info(filename2, (form==YES));
X! 	if (real_reply == NULL) {
X  	  /** IT FAILED!!  MEIN GOTT!  Use a dumb mailer instead! **/
X***************
X*** 231,234 ****
X  
X! 	  if (cc[0] != '\0')  		/* copies! */
X! 	    sprintf(expanded_to,"%s %s", expanded_to, expanded_cc);
X  
X--- 227,231 ----
X  
X! 	  mailer_start(very_long_buffer, mailx, filename);
X! 	  mailer_arg("-s");
X! 	  mailer_quote(subject);
X  
X***************
X*** 234,239 ****
X  
X- 	  sprintf(very_long_buffer, "( (%s -s \"%s\" %s ; %s %s) & ) < %s",
X-                   mailx, subject, strip_parens(strip_commas(expanded_to)), 
X- 		  remove, filename, filename);
X- 
X  	  error1("Message sent using dumb mailer - %s", mailx);
X--- 231,232 ----
X***************
X*** 244,246 ****
X  	  copy_message_across(reply, real_reply);
X- 
X  	  fclose(real_reply);
X--- 237,238 ----
X***************
X*** 247,258 ****
X  
X- 	  if (cc[0] != '\0')  				         /* copies! */
X- 	    sprintf(expanded_to,"%s %s", expanded_to, expanded_cc);
X- 
X- #ifdef ALLOW_BCC
X- 	  if (bcc[0] != '\0') {
X- 	    strcat(expanded_to, " ");
X- 	    strcat(expanded_to, expanded_bcc);
X- 	  }
X- #endif
X- 
X  	  if (access(sendmail, EXECUTE_ACCESS) == 0 
X--- 239,240 ----
X***************
X*** 259,263 ****
X  #ifdef SITE_HIDING
X! 	      && ! is_a_hidden_user(username))
X! #else
X! 	     )
X  #endif
X--- 241,243 ----
X  #ifdef SITE_HIDING
X! 	      && !is_a_hidden_user(username)
X  #endif
X***************
X*** 263,271 ****
X  #endif
X! 	    sprintf(very_long_buffer,"( (%s %s %s ; %s %s) & ) < %s",
X!                   sendmail, smflags, strip_parens(strip_commas(expanded_to)), 
X! 		  remove, filename2, filename2);
X! 	  else 				   /* oh well, use default mailer... */
X!             sprintf(very_long_buffer,"( (%s %s ; %s %s) & ) < %s", 
X!                   mailer, strip_parens(strip_commas(expanded_to)), 
X! 		  remove, filename2, filename2);
X  	}
X--- 243,248 ----
X  #endif
X! 	     )
X! 	    mailer_start(very_long_buffer, sendmail, filename2);
X! 	  else                          /* oh well, use default mailer... */
X! 	    mailer_start(very_long_buffer, mailer, filename2);
X  	}
X***************
X*** 274,275 ****
X--- 251,259 ----
X  
X+ 	mailer_to(strip_parens(strip_commas(expanded_to)));
X+ 	mailer_to(strip_parens(strip_commas(expanded_cc)));
X+ #ifdef ALLOW_BCC
X+ 	mailer_to(strip_parens(strip_commas(expanded_bcc)));
X+ #endif
X+ 	mailer_end();
X+ 
X  	if (mail_only) {
X***************
X*** 328,331 ****
X  	  fflush(stdout);
X! 	  if (tolower(ReadCh()) != 'n') {
X! 	    Write_to_screen("Yes",0);	
X              retransmit++;
X--- 312,314 ----
X  	  fflush(stdout);
X! 	  if (want_to((char *)NULL, 'y', TRUE) == 'y') {
X              retransmit++;
X***************
X*** 333,336 ****
X  	  }
X- 	  else 
X- 	    Write_to_screen("No",0);	
X  
X--- 316,317 ----
X***************
X*** 336,339 ****
X  
X- 	  fflush(stdout);
X- 
X  	  *cancelled_msg = 0;
X--- 317,318 ----
X***************
X*** 499,507 ****
X  FILE *
X! #ifdef ALLOW_BCC
X!  write_header_info(filename, long_to, long_cc, long_bcc, form)
X!  char *filename, *long_to, *long_cc, *long_bcc;
X! #else
X!  write_header_info(filename, long_to, long_cc, form)
X!  char *filename, *long_to, *long_cc;
X! #endif
X  int   form;
X--- 478,481 ----
X  FILE *
X! write_header_info(filename, form)
X! char *filename;
X  int   form;
X***************
X*** 563,565 ****
X  
X! 	fprintf(filedesc, "To: %s\n", format_long(long_to, strlen("To:")));
X  
X--- 537,540 ----
X  
X! 	fprintf(filedesc, "To: %s\n",
X! 		format_long(expanded_to, strlen("To:")));
X  
X***************
X*** 589,591 ****
X  	if (cc[0] != '\0')
X! 	  fprintf(filedesc, "Cc: %s\n", format_long(long_cc, strlen("Cc: ")));
X  
X--- 564,567 ----
X  	if (cc[0] != '\0')
X! 	  fprintf(filedesc, "Cc: %s\n",
X! 		  format_long(expanded_cc, strlen("Cc: ")));
X  
X***************
X*** 593,595 ****
X  	if (bcc[0] != '\0')
X! 	 fprintf(filedesc, "Bcc: %s\n", format_long(long_bcc, strlen("Bcc: ")));
X  #endif
X--- 569,572 ----
X  	if (bcc[0] != '\0')
X! 	  fprintf(filedesc, "Bcc: %s\n",
X! 		  format_long(expanded_bcc, strlen("Bcc: ")));
X  #endif
X***************
X*** 695,696 ****
X--- 672,746 ----
X  	return(TRUE);
X+ }
X+ 
X+ /*
X+  * Here is a set of subroutines.  These make easier the construction
X+  * of mailer command lines.
X+  */
X+ 
X+ static char *mbuf, *mfile;
X+ 
X+ mailer_start(buf, cmd, file)
X+ char *buf;
X+ char *cmd;
X+ char *file;
X+ {
X+ 	mbuf = buf;
X+ 	mfile = file;
X+ 
X+ 	sprintf(mbuf, "( (%s", cmd);
X+ }
X+ 
X+ mailer_arg(s)
X+ char *s;
X+ {
X+ 	mbuf += strlen(mbuf);
X+ 
X+ 	*mbuf++ = ' ';
X+ 	strcpy(mbuf, s);
X+ }
X+ 
X+ mailer_quote(s)
X+ char *s;
X+ {
X+ 	mbuf += strlen(mbuf);
X+ 
X+ 	*mbuf++ = ' ';
X+ 	*mbuf++ = '\'';
X+ 	while (*s) {
X+ 	  if ((*s == '\'') || (*s == '\\'))
X+ 	    *mbuf++ = '\\';
X+ 	  *mbuf++ = *s++;
X+ 	}
X+ 	*mbuf = '\0';
X+ }
X+ 
X+ mailer_to(s)
X+ char *s;
X+ {
X+ 	mbuf += strlen(mbuf);
X+ 
X+ 	for (;;) {
X+ 	  while (isspace(*s))
X+ 	    ++s;
X+ 	  if (*s == '\0')
X+ 	    break;
X+ 
X+ 	  *mbuf++ = ' ';
X+ 	  *mbuf++ = '\'';
X+ 	  while (*s && !isspace(*s)) {
X+ 	    if (*s == '\'' || *s == '\\')
X+ 	      *mbuf++ = '\\';
X+ 	    *mbuf++ = *s++;
X+ 	  }
X+ 	  *mbuf++ = '\'';
X+ 	}
X+ 
X+ 	*mbuf = '\0';
X+ }
X+ 
X+ mailer_end()
X+ {
X+ 	mbuf += strlen(mbuf);
X+ 
X+ 	sprintf(mbuf, "; %s %s) & ) < %s", remove, mfile, mfile);
X  }
XIndex: opt_utils.c
X*** elm1.7beta/src/opt_utils.c	Mon Nov  2 20:13:09 1987
X--- elm/src/opt_utils.c	Sat Dec  5 14:21:09 1987
X***************
X*** 12,14 ****
X  
X! #ifdef BSD
X  # include <pwd.h>
X--- 12,14 ----
X  
X! #ifdef NEED_CUSERID
X  # include <pwd.h>
XIndex: pattern.c
X*** elm1.7beta/src/pattern.c	Mon Nov  2 20:14:43 1987
X--- elm/src/pattern.c	Wed Dec  9 15:35:37 1987
X***************
X*** 45,47 ****
X  
X! 	    if (tolower(ReadCh()) != 'n') {	/* remove tags... */
X  	      for (i=0; i < message_count; i++) {
X--- 45,47 ----
X  
X! 	    if (want_to((char *)NULL, 'y', TRUE) == 'y') { /* remove tags */
X  	      for (i=0; i < message_count; i++) {
XIndex: quit.c
X*** elm1.7beta/src/quit.c	Mon Nov  2 20:06:22 1987
X--- elm/src/quit.c	Wed Dec  9 10:00:13 1987
X***************
X*** 27,29 ****
X  	**/
X- 
X  	  if (leave_mbox(0) ==-1)	/* new mail...can't resync yet! */
X--- 27,28 ----
X***************
X*** 29,31 ****
X  	  if (leave_mbox(0) ==-1)	/* new mail...can't resync yet! */
X! 	    return;
X  
X--- 28,30 ----
X  	  if (leave_mbox(0) ==-1)	/* new mail...can't resync yet! */
X! 	    return (FALSE);
X  
X***************
X*** 31,35 ****
X  
X! 	  newmbox(3, TRUE, TRUE);
X! 	  mailfile_size = bytes(infile);	
X! 	  showscreen();
X  }
X--- 30,32 ----
X  
X! 	  return (newmbox(3, TRUE, TRUE));
X  }
XIndex: read_rc.c
X*** elm1.7beta/src/read_rc.c	Mon Nov  2 20:10:03 1987
X--- elm/src/read_rc.c	Tue Dec  8 18:15:22 1987
X***************
X*** 71,73 ****
X  #include <stdio.h>
X- #include <ctype.h>
X  
X--- 71,72 ----
X***************
X*** 73,78 ****
X  
X- #ifdef BSD
X- #undef tolower
X- #endif
X- 
X  #include "headers.h"
X--- 72,73 ----
X***************
X*** 403,405 ****
X  	  if (strlen(header) > 0) {
X! 	    if (! strcmp(header, "*end-of-user-headers*")) break;
X  	    if (weedcount > MAX_IN_WEEDLIST) {
X--- 398,400 ----
X  	  if (strlen(header) > 0) {
X! 	    if (! strcmp(header, "*end*")) break;
X  	    if (weedcount > MAX_IN_WEEDLIST) {
X***************
X*** 475,477 ****
X  		       "Apparently-To:", "Message-Id:", "Content-Type:",
X! 		       "From", "X-Mailer:", "*end-of-defaults*", NULL
X  		     };
X--- 470,472 ----
X  		       "Apparently-To:", "Message-Id:", "Content-Type:",
X! 		       "From", "X-Mailer:", "*end*", NULL
X  		     };
XIndex: remail.c
X*** elm1.7beta/src/remail.c	Mon Nov  2 20:06:24 1987
X--- elm/src/remail.c	Wed Dec  9 15:35:42 1987
X***************
X*** 66,69 ****
X  	fflush(stdout);
X! 	if (tolower(ReadCh()) == 'n') { /* another day, another No... */
X! 	  Write_to_screen("No", 0);
X  	  set_error("Bounce of message cancelled");
X--- 66,69 ----
X  	fflush(stdout);
X! 	if (want_to((char *)NULL, 'y', TRUE) == 'n') {
X! 	  /* another day, another No... */
X  	  set_error("Bounce of message cancelled");
X***************
X*** 71,73 ****
X  	}
X- 	Write_to_screen("Yes!", 0);
X  
X--- 71,72 ----
X***************
X*** 73,75 ****
X  
X! 	sprintf(buffer, "%s %s < %s", mailer, strip_parens(expanded), filename);
X  
X--- 72,76 ----
X  
X! 	mailer_start(buffer, mailer, filename);
X! 	mailer_to(expanded);
X! 	mailer_end();
X  
X***************
X*** 77,84 ****
X  
X! 	if ((errno = system_call(buffer, SH)) != 0) {
X! 	  sprintf(buffer, "Remail failed with error %d!", errno);
X! 	  set_error(buffer);
X! 	}
X! 	else
X! 	  set_error("mail resent");
X  
X--- 78,80 ----
X  
X! 	system_call(buffer, SH);
X  
X***************
X*** 84,85 ****
X--- 80,82 ----
X  
X+ 	set_error("Mail resent!");
X  	return(1);
XIndex: reply.c
X*** elm1.7beta/src/reply.c	Mon Nov  2 20:08:44 1987
X--- elm/src/reply.c	Thu Dec 17 09:22:14 1987
X***************
X*** 130,133 ****
X  	else {
X! 	  edit_msg = (want_to("Edit outgoing message (y/n) ? ",'y',FALSE)!='n');
X! 	  Write_to_screen("%s", 1, edit_msg? "Yes" : "No");
X  	}
X--- 130,133 ----
X  	else {
X! 	  if (want_to("Edit outgoing message (y/n) ? ",'y',TRUE) != 'n')
X! 	    edit_msg = TRUE;
X  	}
XIndex: save_opts.c
X*** elm1.7beta/src/save_opts.c	Mon Nov  2 20:17:35 1987
X--- elm/src/save_opts.c	Tue Dec  8 18:15:23 1987
X***************
X*** 233,235 ****
X  	for (i = 0; i < weedcount; i++) 
X! 	  if (strcmp(weedlist[i],"*end-of-defaults*") == 0)
X  	    break;
X--- 233,235 ----
X  	for (i = 0; i < weedcount; i++) 
X! 	  if (strcmp(weedlist[i],"*end*") == 0)
X  	    break;
X***************
X*** 236,238 ****
X  
X! 	while (i< weedcount && strcmp(weedlist[i], "*end-of-defaults*") == 0)
X  	  i++;	/* and get PAST it too! */
X--- 236,238 ----
X  
X! 	while (i< weedcount && strcmp(weedlist[i], "*end*") == 0)
X  	  i++;	/* and get PAST it too! */
X***************
X*** 240,242 ****
X  	while (i < weedcount) {
X! 	  if (strlen(weedlist[i]) + length_so_far > 78) {
X  	    fprintf(fd, "\n\t");
X--- 240,242 ----
X  	while (i < weedcount) {
X! 	  if (strlen(weedlist[i]) + length_so_far > 72) {
X  	    fprintf(fd, "\n\t");
X***************
X*** 245,247 ****
X  	  fprintf(fd, "\"%s\" ", weedlist[i]);
X! 	  length_so_far += (strlen(weedlist[i]) + 4);
X  	  i++;
X--- 245,247 ----
X  	  fprintf(fd, "\"%s\" ", weedlist[i]);
X! 	  length_so_far += (strlen(weedlist[i]) + 3);
X  	  i++;
X***************
X*** 248,250 ****
X  	}
X! 	fprintf(fd, "\t\"*end-of-user-headers*\"\n\n");
X  }
X--- 248,250 ----
X  	}
X! 	fprintf(fd, "\"*end*\"\n\n");
X  }
XIndex: savecopy.c
X*** elm1.7beta/src/savecopy.c	Mon Nov  2 20:14:01 1987
X--- elm/src/savecopy.c	Wed Dec  9 10:09:39 1987
X***************
X*** 24,26 ****
X  char *error_name(), *error_description();
X! char *ctime();
X  
X--- 24,26 ----
X  char *error_name(), *error_description();
X! FILE *user_fopen();
X  
X***************
X*** 30,31 ****
X--- 30,32 ----
X  
X+ char *ctime();
X  char *strcat(), *strcpy();
X***************
X*** 63,65 ****
X  
X! 	    if (can_access(savename, READ_ACCESS) != 0)
X  	      savename[0] = '\0';
X--- 64,66 ----
X  
X! 	    if (user_access(savename, WRITE_ACCESS) != 0)
X  	      savename[0] = '\0';
X***************
X*** 81,83 ****
X  
X! 	if ((errno = can_open(savename, "a"))) {
X  	  dprint(2, (debugfile,
X--- 82,85 ----
X  
X! 	if ((save = user_fopen(savename, "a")) == NULL) {
X! 	  int err = errno;
X  	  dprint(2, (debugfile,
X***************
X*** 83,85 ****
X  	  dprint(2, (debugfile,
X! "Error: attempt to autosave to a file that can't be appended to!\n"));
X  	  dprint(2, (debugfile, "\tfilename = \"%s\"\n", savename));
X--- 85,87 ----
X  	  dprint(2, (debugfile,
X! 	"Error: attempt to autosave to a file that can't be appended to!\n"));
X  	  dprint(2, (debugfile, "\tfilename = \"%s\"\n", savename));
X***************
X*** 85,100 ****
X  	  dprint(2, (debugfile, "\tfilename = \"%s\"\n", savename));
X! 	  dprint(2, (debugfile, "** %s - %s **\n", error_name(errno),
X! 		  error_description(errno)));
X! 	  error1("permission to append to %s denied!", savename);
X! 	  sleep(2);
X! 	  return(FALSE);
X! 	}
X! 
X! 	if ((save = fopen(savename, "a")) == NULL) {
X! 	  dprint(1, (debugfile,
X! 		"Error: Couldn't append message to file %s (%s)\n",
X! 		savename, "save_copy"));
X! 	  dprint(1, (debugfile,"** %s - %s **\n", error_name(errno),
X! 		  error_description(errno)));
X! 	  error1("couldn't append to %s", savename);
X  	  sleep(2);
X--- 87,92 ----
X  	  dprint(2, (debugfile, "\tfilename = \"%s\"\n", savename));
X! 	  dprint(2, (debugfile, "** %s - %s **\n",
X! 		  error_name(err), error_description(err)));
X! 	  error2("Couldn't append to file %s! (%s)",
X! 		  filename, error_description(err));
X  	  sleep(2);
XIndex: screen.c
X*** elm1.7beta/src/screen.c	Mon Nov  2 20:07:34 1987
X--- elm/src/screen.c	Mon Dec  7 14:47:30 1987
X***************
X*** 196,199 ****
X  	  CleartoEOLN();
X! 	  Writechar('\r');
X! 	  Writechar('\n');
X  	  line++;
X--- 196,198 ----
X  	  CleartoEOLN();
X! 	  CursorDown(1);
X  	  line++;
X***************
X*** 313,314 ****
X--- 312,314 ----
X  	/* now THIS is a frightening format statement!!!  */
X+ 	/* Split in two by Chip 12/5/87 */
X  
X***************
X*** 314,316 ****
X  
X! 	sprintf(buffer, "%s%s%c%c%c%-3d %3.3s %-2d %-18.18s (%d) %s%s%s", 
X  		highlight? ((has_highlighting && !arrow_cursor) ?
X--- 314,316 ----
X  
X! 	sprintf(buffer, "%s%s%c%c%c%-3d",
X  		highlight? ((has_highlighting && !arrow_cursor) ?
X***************
X*** 321,323 ****
X  		(entry->status & TAGGED?  '+' : ' '),
X! 	        message_number,
X  	        entry->month, 
X--- 321,324 ----
X  		(entry->status & TAGGED?  '+' : ' '),
X! 	        message_number);
X! 	sprintf(buffer + strlen(buffer), " %3.3s %-2d %-18.18s (%4d) %s%s", 
X  	        entry->month, 
X***************
X*** 326,331 ****
X  		entry->lines, 
X- 		(entry->lines / 1000   > 0? ""   :	/* spacing the  */
X- 		  entry->lines / 100   > 0? " "  :	/* same for the */
X- 		    entry->lines / 10  > 0? "  " :	/* lines in ()  */
X- 		                            "   "),    /*   [wierd]    */
X  		subj,
X--- 327,328 ----
XIndex: showmsg.c
X*** elm1.7beta/src/showmsg.c	Mon Nov  2 20:07:56 1987
X--- elm/src/showmsg.c	Wed Dec  9 15:13:11 1987
X***************
X*** 12,14 ****
X  #include "headers.h"
X- #include <ctype.h>
X  #include <errno.h>
X--- 12,13 ----
X***************
X*** 18,20 ****
X  # include <sys/wait.h>
X- # undef tolower
X  #endif
X--- 17,18 ----
X***************
X*** 225,226 ****
X--- 223,228 ----
X  	    strcat(buffer, "\n");
X+ 	    if (builtin)
X+ 	      display_line(buffer);
X+ 	    else
X+ 	      fprintf(output_pipe, "%s", buffer);
X  	  }
X***************
X*** 226,234 ****
X  	  }
X- 	  else
X- 	    strcpy(buffer, "\n");
X- 
X- 	  if (builtin)
X- 	    display_line(buffer);
X- 	  else
X- 	    fprintf(output_pipe, "%s", buffer);
X  	  
X--- 228,229 ----
X***************
X*** 300,306 ****
X  	      if (lines == 0 && pipe_abort == FALSE) {	/* displayed it all */
X! 	        PutLine0(LINES-1,0,"Press <space> or <return> to return to Elm: ");
X! 		fflush(stdout);
X! 	        Raw(ON);
X! 	        val = tolower(ReadCh());
X! 	        Raw(OFF);
X  	      }
X--- 295,297 ----
X  	      if (lines == 0 && pipe_abort == FALSE) {	/* displayed it all */
X! 		return_to_elm();
X  	      }
X***************
X*** 371,377 ****
X  	if (lines == 0 && pipe_abort == FALSE) {  	/* displayed it all! */
X! 	  PutLine0(LINES-1,0,"Press <space> or <return> to return to Elm : ");
X! 	  fflush(stdout);
X! 	  Raw(ON);
X! 	  val = tolower(ReadCh());
X! 	  Raw(OFF);
X  	}
X--- 362,364 ----
X  	if (lines == 0 && pipe_abort == FALSE) {  	/* displayed it all! */
X! 	  return_to_elm();
X  	}
X***************
X*** 377,379 ****
X  	}
X! 	
X  	return(val);
X--- 364,366 ----
X  	}
X! 
X  	return(val);
X***************
X*** 379,380 ****
X--- 366,389 ----
X  	return(val);
X+ }
X+ 
X+ int
X+ return_to_elm()
X+ {
X+ 	int val;
X+ 
X+ 	MoveCursor(LINES, 0);
X+ 	if (StartBold() < 0) {
X+ 	  PutLine0(LINES, 0, "Press any key to return to Elm: ");
X+ 	}
X+ 	else {
X+ 	  PutLine0(LINES, 0, " Press any key to return to Elm ");
X+ 	  EndBold();
X+ 	}
X+ 	CleartoEOS();
X+ 
X+ 	Raw(ON);
X+ 	val = tolower(ReadCh());
X+ 	Raw(OFF);
X+ 
X+ 	return (val);
X  }
XIndex: strings.c
X*** elm1.7beta/src/strings.c	Mon Nov  2 20:07:40 1987
X--- elm/src/strings.c	Mon Dec  7 12:56:43 1987
X***************
X*** 13,15 ****
X  #include "headers.h"
X- #include <ctype.h>
X  
X--- 13,14 ----
X***************
X*** 15,21 ****
X  
X- #ifdef BSD
X- #undef tolower
X- #undef toupper
X- #endif
X- 
X  /** forward declarations **/
X--- 14,15 ----
X***************
X*** 25,27 ****
X  
X! #ifdef BSD
X  
X--- 19,21 ----
X  
X! #if defined(BSD) || defined(M_XENIX)
X  
XIndex: utils.c
X*** elm1.7beta/src/utils.c	Mon Nov  2 20:15:24 1987
X--- elm/src/utils.c	Tue Dec 22 17:21:13 1987
X***************
X*** 10,12 ****
X  #include <sys/stat.h>
X- #include <ctype.h>
X  #include <errno.h>
X--- 10,11 ----
X***************
X*** 13,18 ****
X  
X- #ifdef BSD
X- #undef tolower
X- #endif
X- 
X  #include <signal.h>
X--- 12,13 ----
X***************
X*** 21,23 ****
X  
X! char *error_name();
X  void   exit();
X--- 16,18 ----
X  
X! char *lockfile(), *error_name(), *error_description();
X  void   exit();
X***************
X*** 30,32 ****
X  	struct stat buffer;
X- 
X  	if (debug == 0) return;		/* Damn!  Can't do it! */
X--- 25,26 ----
X***************
X*** 55,56 ****
X--- 49,54 ----
X  
X+ 	char lockfile[SLEN], locktemp[SLEN];
X+ 
X+ 	get_locknames(lockfile, locktemp);
X+ 
X  	dprint(1, (debugfile, 
X***************
X*** 61,62 ****
X--- 59,69 ----
X  	     "     The mailbox tempfile : %s%s\n", temp_mbox, username));
X+ 
X+ 	if (access(lockfile, ACCESS_EXISTS))
X+ 	  dprint(1, (debugfile,
X+ 	       "     The mailbox lock file: %s\n", lockfile));
X+ 
X+ 	if (access(locktemp, ACCESS_EXISTS))
X+ 	  dprint(1, (debugfile,
X+ 	       "     The lock temp file   : %s\n", locktemp));
X+ 
X  	dprint(1, (debugfile,
X***************
X*** 62,65 ****
X  	dprint(1, (debugfile,
X- 	     "     The mailbox lock file: %s%s.lock\n", mailhome, username));
X- 	dprint(1, (debugfile,
X  	     "     The composition file : %s%d\n", temp_file, getpid()));
X--- 69,70 ----
X***************
X*** 107,109 ****
X  	if (mbox_specified == 0) {
X! 	    sprintf(buffer,"%s%s",temp_mbox, username);  /* temp mailbox */
X  	    (void) unlink(buffer);
X--- 112,114 ----
X  	if (mbox_specified == 0) {
X! 	    sprintf(buffer,"%s%s", temp_mbox, username);  /* temp mailbox */
X  	    (void) unlink(buffer);
X***************
X*** 109,110 ****
X--- 114,116 ----
X  	    (void) unlink(buffer);
X+ 	    unlock();
X  	}
X***************
X*** 112,116 ****
X  	sprintf(buffer,"%s/%s", home, readmsg_file);  /* readmsg temp */
X- 	(void) unlink(buffer);
X- 
X- 	sprintf(buffer,"%s%s.lock",mailhome, username); /* lock file */
X  	(void) unlink(buffer);
X--- 118,119 ----
SHAR_EOF
if test 19785 -ne `wc -c < 'p.src.2'`
then
	echo 'shar: error transmitting "p.src.2" (should have been 19785 characters) '
fi
chmod 644 'p.src.2'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

chip@ateng.UUCP (Chip Salzenberg) (01/27/88)

Patches for utils/*.[hc].  This is the last of my seven patch files for
Elm 1.7 under Xenix.

"Shar and enjoy."

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the "#! /bin/sh" line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	p.utils
# This archive created: Tue Jan 26 19:14:44 1988
export PATH; PATH=/bin:$PATH
:
echo 'shar: extracting "p.utils" (2436 characters) '
if test -f 'p.utils'
then
	echo 'shar: will not overwrite existing file "p.utils" '
else
sed 's/^X//' << \SHAR_EOF > 'p.utils'
XIndex: fastmail.c
X*** elm1.7beta/utils/fastmail.c	Mon Nov  9 08:23:57 1987
X--- elm/utils/fastmail.c	Wed Dec  9 18:18:20 1987
X***************
X*** 29,30 ****
X--- 29,31 ----
X  #include <stdio.h>
X+ #include <ctype.h>
X  
X***************
X*** 44,46 ****
X  
X! static char ident[] = { WHAT_STRING };
X  
X--- 45,47 ----
X  
X! extern  long    time();
X  
X***************
X*** 52,53 ****
X--- 53,56 ----
X  
X+ static char ident[] = { WHAT_STRING };
X+ 
X  char *optional_arg;			/* optional argument as we go */
X***************
X*** 174,176 ****
X  
X! 	sprintf(command_buffer, "cat %s %s | %s '%s %s %s'", 
X  		tempfilename, filename, 
X--- 177,179 ----
X  
X! 	sprintf(command_buffer, "cat %s %s | %s",
X  		tempfilename, filename, 
X***************
X*** 176,179 ****
X  		tempfilename, filename, 
X! 	        sendmail_available? sendmail : mailer,
X! 		to_list, cc_list, bcc_list);
X  
X--- 179,181 ----
X  		tempfilename, filename, 
X! 		sendmail_available? sendmail : mailer);
X  
X***************
X*** 179,180 ****
X--- 181,186 ----
X  
X+ 	quote_args(command_buffer + strlen(command_buffer), to_list);
X+ 	quote_args(command_buffer + strlen(command_buffer), cc_list);
X+ 	quote_args(command_buffer + strlen(command_buffer), bcc_list);
X+ 
X  	if (debug)
X***************
X*** 187,188 ****
X--- 193,206 ----
X  
X+ /*
X+  * Copy the space-delimited words in `src' to quoted words in `dest'.
X+  * (Used for generating shell command lines.)
X+  */
X+ quote_args(dest, src)
X+ char *dest, *src;
X+ {
X+ 	for (;;) {
X+ 	  while (isspace(*src))
X+ 	    ++src;
X+ 	  if (*src == '\0')
X+ 	    break;
X  
X***************
X*** 188,189 ****
X--- 206,220 ----
X  
X+ 	  *dest++ = ' ';
X+ 	  *dest++ = '\'';
X+ 	  while (*src && !isspace(*src)) {
X+ 	    if (*src == '\'' || *src == '\\')
X+ 	      *dest++ = '\\';
X+ 	    *dest++ = *src++;
X+ 	  }
X+ 	  *dest++ = '\'';
X+ 	}
X+ 
X+ 	*dest = '\0';
X+ }
X+ 
X  char *get_arpa_date()
X***************
X*** 212,214 ****
X  #  ifdef BSD4.1
X! 	junk = (long) time((long *) 0);
X  	ftime(&loc_time);
X--- 243,245 ----
X  #  ifdef BSD4.1
X! 	junk = time((long *) 0);
X  	ftime(&loc_time);
X***************
X*** 219,221 ****
X  #else
X! 	junk = time(0);	/* this must be here for it to work! */
X  #endif
X--- 250,252 ----
X  #else
X! 	junk = time((long *) 0);
X  #endif
X***************
X*** 272,274 ****
X  
X! 	if (_indx >= strlen(argv[_argnum])) {
X  	  _argnum++;
X--- 303,307 ----
X  
X! 	while (_argnum < argc
X! 	 && argv[_argnum][0] == '-'
X! 	 && _indx >= strlen(argv[_argnum])) {
X  	  _argnum++;
SHAR_EOF
if test 2436 -ne `wc -c < 'p.utils'`
then
	echo 'shar: error transmitting "p.utils" (should have been 2436 characters) '
fi
chmod 644 'p.utils'
fi  # end of overwriting check
#	End of shell archive
exit 0
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."