[comp.unix.xenix] Elm for SCO Xenix

steven@chinet.UUCP (Steven Goodman) (05/04/87)

I am looking for the Source Code for "elm".  I run SCO Xenix on a 386 machine
and am using a 386 box.  I would like to find this code (ready to compile if
possible) on my system.  If you can help or know where I could find this please
write me at   ....!{ihnp4,uwvax}!uwmcsd1!lakesys!steven

jon@gaia.UUCP (Jonathan Corbet) (05/08/87)

In article <950@chinet.UUCP> steven@chinet.UUCP (Steven Goodman) writes:
>I am looking for the Source Code for "elm".  I run SCO Xenix on a 386 machine
>and am using a 386 box.  I would like to find this code (ready to compile if
>possible) on my system.

Good luck...

The Elm code is highly non-portable, especially to machines that require
special care with pointers, such as an AT.  I dug around in it for a while
(I'm actually running Microport, but the situation will be the same with
Xenix), and finally gave up -- too many core dumps for my taste.

-- 
Jonathan Corbet
{seismo | hplabs | gatech}!hao!gaia!jon
{ucbvax | allegra | cbosgd}!nbires!gaia!jon

greg@gryphon.CTS.COM (Greg Laskin) (05/10/87)

In article <318@gaia.UUCP>, jon@gaia.UUCP (Jonathan Corbet) writes:
> In article <950@chinet.UUCP> steven@chinet.UUCP (Steven Goodman) writes:
> >I am looking for the Source Code for "elm".  
> The Elm code is highly non-portable, especially to machines that require
> special care with pointers, such as an AT.  

Well, there is some cavalier handling of NULL as a pointer to a null
string that causes some problems but otherwise there are only a 
couple problems with pointers and longs.  Dave seems to have
incorporated most of the fixes I sent him in the latest patches.

There are still a couple problems left.  You need to #undef toupper
and tolower in each module that includes ctype.h.  Also, building
this beast on a small machine is a bit tricky.

The original 1.5 distribution is working fine here under SCO Sys V  V2.1
and under Intel Xenix/286 which is sort of system 3 Xenix.


Following is the Makefile I used.  Contained therin are most of the
secrets of building this beast.

There were a couple library problems with SCO that may be fixed
in later versions.  For SCO add -LARGE to CFLAGS.  Also, add
-SEG#256 (undocumented flag) to the cc line hat links elm.
If a fixup error occurs during the linking, extract the module, signal.o,
from /lib/Llibc.a and include the module so extracted in line 53
prior to ${OBJS}.  This will cause signal.o to end up in the
correct segment and make the fixup error go away.

Also, you need a working version of xstr.  The SCO version I have seems a 
bit flakey.  I used the Intel Xenix version of xstr to build elm.

-------------------------- line ------------------------------------------
#
#  Makefile for the ELM mail program.
#
#         (C) Copyright 1986, Dave Taylor
#
#  Last modification: August 15th, 1986

SHELL=/bin/sh

DEFINE= 
LIB2  = 

# IF you're on an ACSnet system (Australia) then
# you'll want to uncomment the following;

#   DEFINE= ${DEFINE} -DACSNET

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

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

HEADERS=../hdrs/curses.h ../hdrs/defs.h ../hdrs/headers.h ../hdrs/sysdefs.h

OBJS  =	addr_utils.o alias.o aliasdb.o aliaslib.o args.o bounceback.o 	\
	builtin.o calendar.o connect_to.o curses.o date.o delete.o	\
	domains.o edit.o editmsg.o elm.o encode.o errno.o file.o	\
	file_utils.o fileio.o forms.o getopt.o hdrconfg.o help.o	\
	initialize.o input_utils.o leavembox.o limit.o mailmsg1.o	\
	mailmsg2.o mailtime.o mkhdrs.o newmbox.o opt_utils.o options.o	\
	output_utils.o pattern.o pmalloc.o quit.o read_rc.o remail.o	\
	reply.o return_addr.o savecopy.o screen.o showmsg.o signals.o	\
	softkeys.o sort.o string2.o strings.o syscall.o utils.o		\
	save_opts.o validname.o

BIN=    ../bin
LIBS=   -ltermcap
CFLAGS= -O -Ml -K -I../hdrs
CC=	/bin/cc
RM=	/bin/rm -f

../bin/elm: ${OBJS} ${EXTRA} ${HEADERS} ../hdrs/elm.h
	xstr
	${CC} -c -Ml -ND STRING xs.c
	${CC} -F 8000 -o ${BIN}/elm -Ml -m elm.map  ${OBJS} xs.o ${LIBS} ${LIB2}
	chgrp mail ../bin/elm


.c.o:   ${HEADERS}
	xstr -c $*.c
	${CC} -c ${CFLAGS} -NM $* -NT $* ${DEFINE} x.c 
	mv x.o $*.o

curses.o: curses.c ../hdrs/curses.h
	${CC} -c ${CFLAGS} -DRAWMODE ${DEFINE} curses.c

#
#initialize.o: initialize.c
#	${CC} -c ${CFLAGS} -DHOSTNAME=\"gryphon\" ${DEFINE} initialize.c
#
# curses.c : curses.q
# 	@../bin/quickscreen curses.q
#
# curses.q :
# 	@cp curses.c curses.q

clean:
	${RM} ${OBJS} LINT.OUT ../bin/elm 

lint: LINT.OUT

LINT.OUT: ${CFILES}
	lint -DRAWMODE -I../hdrs ${CFILES} -ltermcap > LINT.OUT

listing: LISTING

LISTING: Makefile INDEX ${HEADERS} ${CFILES}
	@echo adding file 'Makefile'...
	@/bin/echo \\f > LISTING
	@cat Makefile >> LISTING
	@echo adding file 'INDEX'...
	@/bin/echo \\f >> LISTING
	@cat INDEX >> LISTING
	@../bin/makelisting ${HEADERS} ${CFILES}
	@echo LISTING generated.

index: INDEX

INDEX: ${CFILES} ${HEADERS}
	@echo Creating function definition index
	@index *.c | sort > INDEX
	@echo File INDEX generated

-- 
Greg Laskin           
Trailing Edge Technologies, Ltd. (but not very)
INTERNET:     laskin@gryphon.CTS.COM
UUCP:         {akgua, hplabs!hp-sdd, sdcsvax, ihnp4, nosc}!crash!gryphon!laskin