[alt.sources] ecu - SCO XENIX V/{2,3}86 Extended CU part 01/47

wht@tridom.uucp (Warren Tucker) (10/09/89)

ECU is a asynchronous communications program for SCO XENIX V 286 or
386.  The operating system and development system is expected to be
revision 2.3.1 or later.
 
---- Cut Here and unpack ----
#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#	Packed Sun Oct  8 17:21:53 EDT 1989 by wht
#	from directory /u1/src/ecu
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  README
#	  Makefile
#	  afterlint.c
#	  bamboozle.c
#	  cmdtbl.c
#	  ecu.c
#	  ecuLCK.c
#	  ecuchdir.c
#	  ecudump.c
#	  ecufinsert.c
#	  ecufkey.c
#	  ecufork.c
#	  ecuhayes.c
#	  ecuicmaux.c
#	  ecuicmd.c
#	  ecuicmhelp.c
#	  eculine.c
#	  ecunumrev.c
#	  ecuphone.c
#	  ecuphrase.c
#	  ecurcvr.c
#	  ecuscrdump.c
#	  ecusetup.c
#	  ecushm.c
#	  ecusighdl.c
#	  ecutcap.c
#	  ecutime.c
#	  ecutty.c
#	  ecuuclc.c
#	  ecuusage.c
#	  ecuutil.c
#	  ecuwinutil.c
#	  ecuxenix.c
#	  ecuxfer.c
#	  esdutil.c
#	  fcrc.c
#	  feval.c
#	  gint.c
#	  gstr.c
#	  hdbintf.c
#	  logevent.c
#	  pcmd.c
#	  pcmdfile.c
#	  pcmdif.c
#	  pcmdtty.c
#	  pcmdwhile.c
#	  pcmdxfer.c
#	  poutput.c
#	  pprintf.c
#	  proc.c
#	  proc_error.c
#	  procframe.c
#	  regexp.c
#	  smap.c
#	  sysdep.c
#	  var.c
#	  dialer.h
#	  dvent.h
#	  ecu.h
#	  ecucmd.h
#	  ecuerror.h
#	  ecufkey.h
#	  ecufork.h
#	  ecuhangup.h
#	  ecukey.h
#	  ecupde.h
#	  ecushm.h
#	  ecuungetty.h
#	  ecuvmin.h
#	  ecuxkey.h
#	  esd.h
#	  feval.h
#	  lint_args.h
#	  pc_scr.h
#	  proc.h
#	  relop.h
#	  smap.h
#	  stdio_lint.h
#	  tty.h
#	  utmpstatus.h
#	  var.h
#	  help/Makefile
#	  help/ecuhelp.src
#	  help/helpgen.c
#	  help/util.c
#	  ecuungetty/Makefile
#	  ecuungetty/ecuungetty.c
#	  z/Makefile
#	  z/ecurz.c
#	  z/ecusz.c
#	  z/zmodem.c
#	  z/zcurses.c
#	  z/zdebug.c
#	  z/zmodem.h
#	  z/zlint.h
#	  z/zcommon.c
#	  sea/Makefile
#	  sea/ecusea.c
#	  sea/scurses.c
#	  sea/sealink.doc
#	  sea/lint_args.h
#	  uucp/dialhclone.c
#	  xsel386/fixttiocom.c
#	  xsel386/select-update
#	  xsel386/select.asm
#	  xsel386/select.txt
#	  xsel386/ttiocom.c
#	  ckermit/ckutio-orig.c
#	  ckermit/ckutio.diff
#	  doc/_basic.txt
#	  doc/_end.txt
#	  doc/_features.txt
#	  doc/_hdb.txt
#	  doc/_icmd.txt
#	  doc/_intro.txt
#	  doc/_p_cmd.txt
#	  doc/_p_ifunc.txt
#	  doc/_p_param.txt
#	  doc/_p_sfunc.txt
#	  doc/_proc.txt
#	  doc/_startup.txt
#	  doc/_tech.txt
#	  doc/_top.txt
#	  doc/ecu.txt
#	  doc/samplproc.man
#	  doc/ecu.man
#	  doc/runoff
#	  models/bsd_uname.ep
#	  models/dir
#	  models/f.ep
#	  models/file_test.ep
#	  models/frame_test.ep
#	  models/goto_test.ep
#	  models/hub.ep
#	  models/keys
#	  models/lookfortest.ep
#	  models/mkdir.ep
#	  models/oneline.ep
#	  models/opuslogin.ep
#	  models/phone
#	  models/phrases
#	  models/ps.ep
#	  models/put_ecu.ep
#	  models/rz_update.ep
#	  models/scm.ep
#	  models/senddate.ep
#	  models/su.ep
#	  models/sz_update.ep
#	  models/szall.ep
#	  models/tty1a.mi
#	  models/tty2d.mi
#	  models/unixlogin.ep
#
mkdir bperr ckermit doc ecuungetty help models sea uucp xsel386 z
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
echo "x - extracting README (Text)"
sed 's/^X//' << 'SHAR_EOF' > README &&
XECU is a asynchronous communications program for SCO XENIX V 286 or
X386.  The operating system and development system is expected to be
Xrevision 2.3.1 or later.
X
XThis program is a three-year hack, originally meant to meet personal
Xneeds for asynchronous communications.  Especially during the early
Xtimes, coding was done when the need arose, when immediate results
Xwere needed.  Also, often, I did not go back and "fix" things.  As a
Xresult, the program is offered as-is, with no apologies as to
Xmerchantability or any of that brouhaha, to deficiencies regarding
Xcoding style, methods, operational consistency, etc.  blah, blsh.
X
XAs such, it is a perfect case for submission to alt.sources, even if
Xit is rather large.
X
XThis is a HACKER's environment (original definition: "late-night,
Xincessantly working programmer", not political/press definition:
X"criminal, spuriously decadent, left-handed Communist").  I would love
Xto hear bug reports and suggestions and will reply to all mail.  I
Xhope this code is useful, but I'd like to keep the mail pretty
Xtechnical.  You'll need a bit of uucp experience to get the uucp
Xinterface working.
X
XThe doc subdirectory has all of the .txt files used to produce
Xecu.man, the manual of sorts for the program.
X
X--------------------------------------------------------------------
XNOTE: This program, it sources, objects and utilities are Copyright
X1989 Warren H.  Tucker, III.  All rights are reserved.
X
XYou may USE this software:
X
X1) regularly, only on computer systems owned by individuals or
Xeducational institutions, or on computer systems located at a place
Xother than your normal place of business, or
X2) briefly, on any computer system for the purpose of making,
Xevaluating, testing or debugging the program.
X
XWithout legal gobbledegook that will be ignored by dishonest persons,
Xlet me explain the spirit of my wishes: I want ECU to be used by
Xpeople to get their personal goals accomplished.  If that means
Xworking on your professional commitments at home, that is OK with me.
XI am a quadriplegic with one before-accident and two after-accident
Xman years of effort in this still unmerchantable, but commercially
Xpromising collection of software.  If corporations or companies want
Xto use this software for the pursuit of business goals, I would
Xappreciate your contacting me to make some _very_ reasonable financial
Xarrangements (and documentation/support improvements).
X
XYou may REDISTRIBUTE this software:
X
XMy address: Warren H. Tucker    (404)587-5766
X            150 West Lake Drive ...!gatech!emory!tridom!n4hgf!wht
X            Roswell, Ga.  30075
X--------------------------------------------------------------------
XNotes:
X
X1.  To get the Kermit protocol working, you must obtain Columbia
XUniversity's C-Kermit version 4E or later and modify ckutio.c.  An
Xexample modified ckutio.c is supplied in the ckermit subdirectory for
Xa guide.  Usage of the Columbia University code must be in keeping
Xwith their copyright.  I claim (of course) no rights.
X
X2.  SCO XENIX V/386 Release 2.3.1 (and evidently 2.3.2) have a
Xbroken-dead, yet fixable, BSD-style select() feature which is needed
Xto support ads.  Also, select() is missing from libc.a.  The x386sel
Xsubdirectory in this release has information (thanks to csch@netcs,
Xivar@acc, and ag@elgar) on how to fix the kernel and to add select()
Xto libc.a.
X
X3.  ECU for the 386 CAN use the select() system call to advantage.  It
Xis not necessary.  If you wish to turn it on, comment out the
XNO_SELECT definition in eculine.c
X
X4.  The uucp directory has an SCO uucp dialer for some various
Xmodems.
SHAR_EOF
chmod 0644 README || echo "restore of README fails"
echo "x - extracting Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile &&
X#  CHK=0x95EA
X#+-------------------------------------------------------------------
X# Makefile for ecu and related programs
X# Copyright 1986,1989 Warren H. Tucker, III. All Rights Reserved
X#
X# NOTE: assumes select.o has been added to Slibx.a
X# NOTE: run make install as root
X#--------------------------------------------------------------------
X#+:EDITS:*/
X#:07-03-1989-22:57-wht------------- ecu 2.00 ----------------
X#:06-11-1989-21:36-wht-source control point 1.85
X#:05-08-1989-15:27-wht-strip a.out file at ld time
X#:02-28-1989-20:33-wht-combined 286/386 Makefile
X#:12-31-1988-12:24-wht-386 + make depend
X#:10-24-1988-16:49-wht-works under BSD4 again (mostly)! 
X
XLBIN = /usr/local/bin
X
XSHELL = /bin/sh
X.SUFFIXES: .o .c .h  
X
XSYSTEM = `./sysdep =M_I386 Xenix/386 Sys V =M_I286 Xenix/286 Sys V`
XCOMFLAGS = -i `./sysdep =M_I386 -Zi -M3e =M_I286 -M2let32 -LARGE -F 8000`
XCFLAGS  = -Ox -DLINT_ARGS -DSHM -DAUTO_DIAL_PROC $(COMFLAGS)
XLDFLAGS = `./sysdep =M_I386 =M_I286 -SEG 256` -lx -lcrypt -lcurses -ltermcap
X
X.PRECIOUS = lint_args.h
X.c.o:;	./fcrc -u $*.c ; /bin/time cc -c $(CFLAGS) $*.c 
X
XSRC	= \
X	bamboozle.c\
X	cmdtbl.c\
X	ecu.c\
X	ecuLCK.c\
X	ecuchdir.c\
X	ecudump.c\
X	ecufinsert.c\
X	ecufkey.c\
X	ecufork.c\
X	ecuhayes.c\
X	eculine.c\
X	ecunumrev.c\
X	ecuicmaux.c\
X	ecuicmhelp.c\
X	ecuicmd.c\
X	ecuphone.c\
X	ecuphrase.c\
X	ecurcvr.c\
X	ecuscrdump.c\
X	ecusetup.c\
X	ecushm.c\
X	ecusighdl.c\
X	ecutcap.c\
X	ecutime.c\
X	ecutty.c\
X	ecuuclc.c\
X	ecuusage.c\
X	ecuutil.c\
X	ecuwinutil.c\
X	ecuxenix.c\
X	ecuxfer.c\
X	esdutil.c\
X	feval.c\
X	gint.c\
X	gstr.c\
X	hdbintf.c\
X	logevent.c\
X	pcmd.c\
X	pcmdif.c\
X	pcmdfile.c\
X	pcmdtty.c\
X	pcmdwhile.c\
X	pcmdxfer.c\
X	poutput.c\
X	pprintf.c\
X	proc.c\
X	proc_error.c\
X	procframe.c\
X	regexp.c\
X	smap.c\
X	var.c
X
XOBJ	= \
X	bamboozle.o\
X	cmdtbl.o\
X	ecu.o\
X	ecuLCK.o\
X	ecudump.o\
X	ecuchdir.o\
X	ecufinsert.o\
X	ecufkey.o\
X	ecufork.o\
X	ecuhayes.o\
X	eculine.o\
X	ecunumrev.o\
X	ecuicmaux.o\
X	ecuicmhelp.o\
X	ecuicmd.o\
X	ecuphone.o\
X	ecuphrase.o\
X	ecurcvr.o\
X	ecuscrdump.o\
X	ecusetup.o\
X	ecushm.o\
X	ecusighdl.o\
X	ecutcap.o\
X	ecutime.o\
X	ecutty.o\
X	ecuuclc.o\
X	ecuusage.o\
X	ecuutil.o\
X	ecuwinutil.o\
X	ecuxenix.o\
X	ecuxfer.o\
X	esdutil.o\
X	feval.o\
X	gint.o\
X	gstr.o\
X	hdbintf.o\
X	logevent.o\
X	pcmd.o\
X	pcmdif.o\
X	pcmdfile.o\
X	pcmdtty.o\
X	pcmdwhile.o\
X	pcmdxfer.o\
X	poutput.o\
X	pprintf.o\
X	proc.o\
X	proc_error.o\
X	procframe.o\
X	regexp.o\
X	smap.o\
X	var.o
X
Xall: sysdep afterlint fcrc ecu
X
Xecuhelp:
X	cd help;make depend;make lint;make all
X
Xecuz:
X	cd z;make all
X
Xecus:
X	cd sea;make all
X
Xecubp:
X	cd bperr;make
X
Xecu: $(OBJ)
X	buildrev `date` $(SYSTEM)  >ecurev.c
X	cc -c $(CFLAGS) ecurev.c; rm ecurev.c
X	/bin/time cc $(COMFLAGS) ecurev.o $(OBJ) $(LDFLAGS) -o ecu 
X	rm ecurev.o
X
Xproc_error.c: ecuerror.h
X	bperr/bperr
X
Xecu.fls: $(SRC)
X	ls $(SRC) >ecu.fls
X
Xlint: ecu.fls
X	csh zgcc ecu.fls lint_args.h $(CFLAGS)
X	fcrc -u Makefile *.h
X
Xinstall: all ecuhelp ecuz ecus ecuungetty #run as root
X	cp ecu z/ecusz z/ecurz sea/ecusea $(LBIN)
X	-mkdir /usr/lib/ecu
X	cp models/*.mi help/ecuhelp.data /usr/lib/ecu
X	cp ecuungetty/ecuungetty /usr/lib/ecu
X	chmod u+s /usr/lib/ecu/ecuungetty
X
Xshar:
X	csh -c 'shar -D -c -v -l30 -o/tmp/ecu. README Makefile *.c *.h \
Xhelp/Makefile \
Xhelp/*.{c,src} ecuungetty/Makefile ecuungetty/*.{c,h} \
Xz/Makefile z/*.{c,h} sea/Makefile sea/*.{c,h,doc} \
Xuucp/*.c xsel386/* \
Xckermit/* doc/*.{txt,man} doc/runoff models/*'
X
Xfcrc: fcrc.c
X	cc -O fcrc.c -o $@
X
Xsysdep: sysdep.c
X	cc -O sysdep.c -o $@
X
Xafterlint: afterlint.c
X	cc -O afterlint.c -o $@
X
X#
X#
X#
X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
X#
Xdepend:
X		rm -f depend.tmp
X		if test '$(SRC)' ;\
X		then (grep '^#include' $(SRC) \
X		| sed	-e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
X			-e 's?:[^"]*"\([^"]*\)".*?: \1?'\
X			-e 's?\(.*\)\.c?\1.o?'\
X			-e 's?ecuerror.h?ecu.h?'\
X		 >> depend.tmp) ;\
X		fi
X
X		echo '/^# DO NOT DELETE THIS LINE' >exdep.tmp
X		echo '.+1,$$d' >>exdep.tmp
X		echo 'r depend.tmp' >> exdep.tmp
X		echo 'w' >> exdep.tmp
X		cp Makefile Makefile.new
X		ex Makefile.new < exdep.tmp
X		rm exdep.tmp depend.tmp
X		echo '#	DEPENDENCIES MUST END AT END OF	FILE' >>Makefile.new
X		echo '#	IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
X		echo '#	see make depend	above'>>Makefile.new
X		mv Makefile Makefile.bak
X		mv Makefile.new Makefile
X		fcrc -u Makefile
X
X# DO NOT DELETE THIS LINE
Xcmdtbl.o: ecucmd.h
Xecu.o: ecu.h
Xecu.o: ecukey.h
Xecu.o: ecuxkey.h
XecuLCK.o: ecu.h
XecuLCK.o: /usr/include/utmp.h
Xecuchdir.o: ecu.h
Xecuchdir.o: ecukey.h
Xecuchdir.o: /usr/include/pwd.h
Xecudump.o: ecu.h
Xecufinsert.o: ecu.h
Xecufinsert.o: ecukey.h
Xecufkey.o: ecu.h
Xecufkey.o: ecukey.h
Xecufkey.o: ecufkey.h
Xecufkey.o: ecuxkey.h
Xecufkey.o: ecufork.h
Xecufork.o: ecu.h
Xecufork.o: ecufork.h
Xecuhayes.o: ecu.h
Xecuhayes.o: ecukey.h
Xecuhayes.o: esd.h
Xecuhayes.o: var.h
Xecuhayes.o: ecupde.h
Xecuhayes.o: ecu.h
Xecuhayes.o: relop.h
Xeculine.o: ecu.h
Xeculine.o: ecukey.h
Xecuicmaux.o: ecu.h
Xecuicmaux.o: ecu.h
Xecuicmaux.o: ecucmd.h
Xecuicmhelp.o: /usr/include/curses.h
Xecuicmhelp.o: ecu.h
Xecuicmhelp.o: ecucmd.h
Xecuicmhelp.o: ecukey.h
Xecuicmhelp.o: pc_scr.h
Xecuicmhelp.o: stdio_lint.h
Xecuicmd.o: ecu.h
Xecuicmd.o: esd.h
Xecuicmd.o: ecufkey.h
Xecuicmd.o: ecucmd.h
Xecuphone.o: /usr/include/curses.h
Xecuphone.o: pc_scr.h
Xecuphone.o: ecu.h
Xecuphone.o: ecupde.h
Xecuphone.o: ecukey.h
Xecuphone.o: ecuxkey.h
Xecuphrase.o: ecu.h
Xecurcvr.o: ecu.h
Xecurcvr.o: ecukey.h
Xecuscrdump.o: ecu.h
Xecuscrdump.o: pc_scr.h
Xecusetup.o: /usr/include/curses.h
Xecusetup.o: ecu.h
Xecusetup.o: ecukey.h
Xecusetup.o: ecuxkey.h
Xecusetup.o: pc_scr.h
Xecushm.o: ecu.h
Xecushm.o: ecushm.h
Xecushm.o: /usr/include/sys/ipc.h
Xecushm.o: /usr/include/sys/shm.h
Xecusighdl.o: ecu.h
Xecusighdl.o: ecufork.h
Xecutcap.o: ecu.h
Xecutcap.o: ecukey.h
Xecutcap.o: pc_scr.h
Xecutime.o: /usr/include/sys/types.h
Xecutime.o: /usr/include/time.h
Xecutime.o: /usr/include/sys/timeb.h
Xecutty.o: /usr/include/sys/machdep.h
Xecutty.o: ecu.h
Xecutty.o: esd.h
Xecutty.o: ecukey.h
Xecutty.o: ecuxkey.h
Xecutty.o: ecu.h
Xecuusage.o: /usr/include/stdio.h
Xecuutil.o: ecu.h
Xecuutil.o: ecufork.h
Xecuutil.o: /usr/include/sys/locking.h
Xecuwinutil.o: /usr/include/curses.h
Xecuwinutil.o: ecukey.h
Xecuwinutil.o: pc_scr.h
Xecuxenix.o: ecu.h
Xecuxenix.o: ecukey.h
Xecuxenix.o: ecufkey.h
Xecuxenix.o: ecuxkey.h
Xecuxenix.o: ecufork.h
Xecuxenix.o: esd.h
Xecuxenix.o: /usr/include/local/morse_dvr.h
Xecuxfer.o: /usr/include/curses.h
Xecuxfer.o: ecu.h
Xecuxfer.o: ecukey.h
Xecuxfer.o: ecuxkey.h
Xecuxfer.o: ecu.h
Xecuxfer.o: pc_scr.h
Xesdutil.o: /usr/include/ctype.h
Xesdutil.o: ecu.h
Xesdutil.o: ecu.h
Xesdutil.o: esd.h
Xfeval.o: ecu.h
Xfeval.o: ecu.h
Xfeval.o: esd.h
Xfeval.o: proc.h
Xfeval.o: var.h
Xfeval.o: feval.h
Xgint.o: ecu.h
Xgint.o: ecu.h
Xgint.o: esd.h
Xgint.o: var.h
Xgstr.o: ecu.h
Xgstr.o: ecu.h
Xgstr.o: esd.h
Xgstr.o: var.h
Xpcmd.o: ecu.h
Xpcmd.o: ecu.h
Xpcmd.o: ecukey.h
Xpcmd.o: esd.h
Xpcmd.o: var.h
Xpcmd.o: proc.h
Xpcmdif.o: /usr/include/ctype.h
Xpcmdif.o: ecu.h
Xpcmdif.o: ecu.h
Xpcmdif.o: esd.h
Xpcmdif.o: var.h
Xpcmdif.o: proc.h
Xpcmdif.o: relop.h
Xpcmdfile.o: ecu.h
Xpcmdfile.o: ecukey.h
Xpcmdfile.o: ecu.h
Xpcmdfile.o: esd.h
Xpcmdfile.o: var.h
Xpcmdfile.o: proc.h
Xpcmdtty.o: ecu.h
Xpcmdtty.o: ecu.h
Xpcmdtty.o: esd.h
Xpcmdwhile.o: /usr/include/ctype.h
Xpcmdwhile.o: ecu.h
Xpcmdwhile.o: ecu.h
Xpcmdwhile.o: esd.h
Xpcmdwhile.o: var.h
Xpcmdwhile.o: proc.h
Xpcmdwhile.o: relop.h
Xpcmdxfer.o: ecu.h
Xpcmdxfer.o: ecukey.h
Xpcmdxfer.o: ecu.h
Xpcmdxfer.o: esd.h
Xpcmdxfer.o: var.h
Xpcmdxfer.o: proc.h
Xpoutput.o: ecu.h
Xpoutput.o: ecukey.h
Xpoutput.o: ecu.h
Xpoutput.o: esd.h
Xpprintf.o: /usr/include/stdio.h
Xpprintf.o: /usr/include/varargs.h
Xproc.o: /usr/include/ctype.h
Xproc.o: ecu.h
Xproc.o: ecu.h
Xproc.o: esd.h
Xproc.o: var.h
Xproc.o: proc.h
Xproc.o: ecucmd.h
Xproc_error.o: ecu.h
Xproc_error.o: ecu.h
Xprocframe.o: /usr/include/ctype.h
Xprocframe.o: ecu.h
Xprocframe.o: ecukey.h
Xprocframe.o: ecu.h
Xprocframe.o: esd.h
Xprocframe.o: var.h
Xprocframe.o: proc.h
Xsmap.o: /usr/include/stdio.h
Xsmap.o: /usr/include/signal.h
Xsmap.o: stdio_lint.h
Xvar.o: ecu.h
Xvar.o: esd.h
Xvar.o: var.h
Xvar.o: ecukey.h
Xvar.o: ecu.h
X#	DEPENDENCIES MUST END AT END OF	FILE
X#	IF YOU PUT STUFF HERE IT WILL GO AWAY
X#	see make depend	above
SHAR_EOF
chmod 0644 Makefile || echo "restore of Makefile fails"
echo "x - extracting afterlint.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > afterlint.c &&
X/* CHK=0xE825 */
X/*+-------------------------------------------------------------------------
X	afterlint.c -- process -Zg output
X
XUse with zgcc:
X
X	#!/bin/csh
X	#zgcc -- build prototyping "LINT_ARGS"
X	echo C sources in $1';' result file $2
X	rm -f zg.t
X	foreach i(`cat $1`)
X	cc -DBUILDING_LINT_ARGS -Zg $argv[3-] $i > zg1.t
X	sort zg1.t > zg2.t
X	echo '/ *' $i '* /' >> zg.t    #remove spaces inside comment markers
X	cat zg2.t >> zg.t
X	end
X	afterlint zg.t $2
X	rm -f zg.t zg?.t
X	echo Output in $2
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-13-1988-19:50-wht-creation */
X
X#include <stdio.h>
X
X#define ff fprintf
X
X#ifdef BSD4
X#include <sys/time.h>
X#define strchr index
X#define strrchr rindex
Xchar *index();
Xchar *rindex();
X/**************************/
X#else	/* assuming XENIX */
X/**************************/
X#include <time.h>
X#include <sys/types.h>
X#include <sys/timeb.h>
Xchar *strchr();
Xchar *strrchr();
X#endif	/* system dependencies */
X
Xextern long time();
Xextern struct tm *localtime();
X
X/*+-------------------------------------------------------------------------
X	emit_editnote(fp)
X--------------------------------------------------------------------------*/
Xvoid
Xemit_editnote(fp)
XFILE	*fp;
X{
X	struct tm *ltime;
X	long cur_time;
X#ifdef XENIX
X#ifdef MESSED_UP_DST
X	struct timeb tp;
X#endif
X#endif
X
X	cur_time = time((long *)0);
X
X#ifdef XENIX
X#ifdef MESSED_UP_DST
X	ftime(&tp);				/* localtime() does not know about DST */
X	if(tp.dstflag)			/* so we adjust with ftime, which does know */
X		cur_time += 3600L;	/* problem in BSD too, but no ftime there */
X#endif
X#endif
X
X	ltime = localtime(&cur_time);
X
X	fputs("/*+:EDITS:*/\n",fp);
X
X	ff(fp,"/*:%02d-%02d-%04d-%02d:%02d-afterlint-creation */\n",
X	    ltime->tm_mon+1,ltime->tm_mday,ltime->tm_year + 1900,
X	    ltime->tm_hour,ltime->tm_min);
X
X}	/* end of emit_editnote */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar	**argv;
Xchar	**envp;
X{
X	register char *cptr;
X	register FILE *fpin;
X	register FILE *fpout;
X	char	buf[256];
X	char	*basename;
X
X	if(argc < 2)
X	{
X		ff(stderr,"usage: afterlint <infile> [<outfile>]\n");
X		ff(stderr,"if outfile not supplied, output is to stdout\n");
X		exit(1);
X	}
X
X	if((fpin = fopen(argv[1],"r")) == NULL)
X	{
X		perror(argv[1]);
X		exit(1);
X	}
X
X	if(argc > 2)
X	{
X		if((fpout = fopen(argv[2],"w")) == NULL)
X		{
X			perror(argv[2]);
X			exit(1);
X		}
X		basename = argv[2];
X	}
X	else
X		fpout = stdout;
X
X	ff(fpout,
X	    "/*+-----------------------------------------------------------------------\n");
X	if(argc > 2)
X		ff(fpout,"\t%s\n",basename);
X	else
X		ff(fpout,"\tfunction declarations\n",basename);
X	ff(fpout,
X	    "------------------------------------------------------------------------*/\n");
X
X	emit_editnote(fpout);
X	ff(fpout,"\n");
X	ff(fpout,"#ifndef BUILDING_LINT_ARGS\n");
X	ff(fpout,"#ifdef LINT_ARGS\n\n");
X
X	while(fgets(buf,sizeof(buf),fpin) != NULL)
X	{
X		cptr = (strncmp(buf,"/*global*/  ",12)) ? buf : buf + 12;
X		fputs(cptr,fpout);
X	}
X
X	ff(fpout,"\n#else\t\t/* compiler doesn't know about prototyping */\n\n");
X
X	fclose(fpin);
X	fpin = fopen(argv[1],"r");
X
X	while(fgets(buf,sizeof(buf),fpin) != NULL)
X	{
X		cptr = (strncmp(buf,"/*global*/  ",12)) ? buf : buf + 12;
X		if(strncmp(cptr,"int ",4))
X		{
X			if(strchr(cptr,'('))
X			{
X				while(*cptr != '(')
X					fputc(*cptr++,fpout);
X				fputs("();\n",fpout);
X			}
X			else
X				fputs(cptr,fpout);
X		}
X	}
X
X	ff(fpout,"\n#endif /* LINT_ARGS */\n");
X	ff(fpout,"#endif /* BUILDING_LINT_ARGS */\n");
X	ff(fpout,"\n/* end of %s */\n",
X	    (argc > 2) ? basename : "function declarations");
X
X	fclose(fpin);
X	fclose(fpout);
X	exit(0);
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
chmod 0644 afterlint.c || echo "restore of afterlint.c fails"
echo "x - extracting bamboozle.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > bamboozle.c &&
X/* CHK=0x8574 */
X/*+-------------------------------------------------------------------------
X	bamboozle.c - ecu/ecuungetty protection scheme
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:07-03-1989-01:50-wht-creation */
X
Xchar *crypt(char *,char *);
X
X
X/*+-------------------------------------------------------------------------
X	bamboozle(pid)
X--------------------------------------------------------------------------*/
Xchar *
Xbamboozle(pid)
Xint pid;
X{
Xchar pidstr[32];
Xchar *cptr;
X
X	sprintf(pidstr,"z%08d",pid);
X	pidstr[0] = 'G';	/* fool strings searchers */
X	cptr = crypt(pidstr,"ba");
X	return(cptr);
X
X}	/* end of bamboozle */
X
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of bamboozle.c */
SHAR_EOF
chmod 0644 bamboozle.c || echo "restore of bamboozle.c fails"
echo "x - extracting cmdtbl.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > cmdtbl.c &&
X/* CHK=0x1613 */
X/*+-------------------------------------------------------------------------
X	cmdtbl.c
X	Copyright 1989 Warren H. Tucker, III. All Rights Reserved
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:52-wht-flush edits --- ecu 1.95 */
X
X#define DECLARE_P_CMD
X#include "ecucmd.h"
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of cmdtbl.c */
SHAR_EOF
chmod 0644 cmdtbl.c || echo "restore of cmdtbl.c fails"
echo "x - extracting ecu.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > ecu.c &&
X/* CHK=0x1ABD */
X/*+-----------------------------------------------------------------------
X	ecu.c
X	Copyright 1986,1989 Warren H. Tucker, III. All Rights Reserved
X
X  Defined functions:
X	main(argc,argv,envp)
X	xmtr()
X
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-03-1989-22:57-wht------------- ecu 2.00 ---------------- */
X/*:06-24-1989-16:52-wht-flush edits --- ecu 1.95 */
X
X#define DECLARE_LINEVARS_PUBLIC
X#include "ecu.h"
X#include "esd.h"
X#include "proc.h"
X#include "ecukey.h"
X#include "ecuxkey.h"
X#include "ecuhangup.h"
X
Xchar *getenv();
X
Xextern char *revision;		/* ecurev.c temp file from buildrev */
Xextern char *numeric_revision;	/*ecunumrev.c */
Xextern ESD *icmd_prompt;
Xextern char *select_rev_modifier; /* select(S) usage (see eculine.c) */
Xextern char kbdeof;			/* current input EOF */
Xextern char kbdeol2;		/* current secondary input EOL */
Xextern char kbdeol;			/* current input EOL */
Xextern char kbderase;		/* current input ERASE */
Xextern char kbdintr;		/* current input INTR */
Xextern char kbdkill;		/* current input KILL */
Xextern char kbdquit;		/* current input QUIT */
Xextern ulong current_colors;
Xextern int there_is_hdb_on_this_machine;
X
Xchar *optarg;
Xchar curr_dir[258];		/* current working directory of process */
Xchar hello_str[80];		/* msg printed upon BOJ */
Xchar errmsg[128];
Xchar modem_ctl_fname[128];
Xchar initial_procedure[128] = "";
Xint usage_quit =0;
Xint init_proc_argc = 0;
Xchar *init_proc_argv[MAX_PARGV];
Xint quiet = 0;			/* don't shut up is default */
Xint rcvr_pid = -1;		/* pid for rcvr process (-1 == no proc active) */
X	/* ... -2 == special flag for xenix modem control/timed-read procedures */
Xint xmtr_pid = 0;
Xlong xmit_chars = 0L;
Xlong xmit_chars_this_connect = 0L;
Xint quit_on_init_proc_fail = 0;
X
X/*-----------------------*/
Xint nice_value = 3;		/* go for hi priority */
Xushort geteuid();
Xushort getuid();
Xushort euid;
Xushort uid;
X/*-----------------------*/
X
X/*+-----------------------------------------------------------------------
X	xmtr() --  copy stdin to comm line
X
X  THE INITIAL PROCESS EXECUTES THIS PROCESS UNTIL PROGRAM TERMINATION
X
X  TTY input lines beginning with % have special significance
X  (see ecuicmd.c)
X------------------------------------------------------------------------*/
Xint
Xxmtr()
X{
Xchar xmtr_char;
Xchar nlchar = NL;
Xint escape;
Xint last_xmtr_char_was_eol = 1;
Xvoid xmtr_SIGINT_handler();
X
X	ttymode(1);
X	xmtr_signals();
X	while(1)
X	{
X/* bug somewhere ... may be SIGINT too rapidly causing SIG_IGN ????? */
X		signal(SIGINT,xmtr_SIGINT_handler);	/* so make sure */
X		xmtr_char = ttygetc(1);
X
X		if(xmtr_char == 0x1F)	/* if ^_ */
X			xmtr_char = XFhome;
X
X		if(xmtr_char & 0x80)
X		{
X			xenix_kbd_escape(xmtr_char);
X			continue;
X		}
X
X		lputc(xmtr_char);
X		if(Lfull_duplex == 0)		/* echo character if asked */
X			write(TTYERR,&xmtr_char,1);
X
X		if(xmtr_char == CR)
X		{
X			if(Ladd_nl_outgoing)
X				lputc('\n');
X			if(Lfull_duplex == 0)
X				write(TTYERR,&nlchar,1);
X		}
X	}		/* end of while we can read a character */
X	return(HANGUP_XMTR_LOGIC_ERROR);	/* should not have gotten here */
X
X}	/* end of xmtr */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X
X  main() program forks to create rcvr process; then main()
X  becomes the xmtr process
X------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xchar *cptr;
Xint iargv;
Xint swchar;
Xint itmp;
Xulong colors_save;
X
X	setbuf(stderr,NULL);
X	ttyinit();				/* init console tty mode handler */
X	clear_screen();
X	xmtr_pid = getpid();
X
X/* get this off quick, cause we'll be busy for a little while on 286 */
X	sprintf(hello_str,"ecu %s%s Copyright 1986,1989 Warren H. Tucker (pid %d)",
X		numeric_revision,select_rev_modifier,xmtr_pid);
X	ff(se,"%s\n",hello_str);
X
X/* if we are root (as we should be on 286 versions), nice to very bad
X   and set uid to real uid */
X
X	uid = getuid();
X	euid = geteuid();
X	if((euid == 0) || (uid == 0))	/* if root running or prog text ... */
X	{								/* ... sets to root, then grab gusto */
X	int old_nice = nice(0) + 20;
X		nice(-old_nice + nice_value) + 20;
X		if(uid != euid)					/* but if user not really root ... */
X		{
X			if(setuid(uid))			/* ... take away the privilege */
X			{
X				ff(se,"\r\n");
X				perror("setuid");
X				ff(se,"\r\n");
X				exit(-1);
X			}
X		}
X	}
X
X	shm_init();				/* open shared segment */
X
X	keyset_init();			/* intialize keyset */
X
X	make_ecu_subdir();		/* needs to be very early before lots of init */
X
X	xmtr_signals();			/* catch xmtr signals */
X
X	get_curr_dir(curr_dir,sizeof(curr_dir));
X	cd_array_init();		/* read %cd directory list */
X
X	hdb_init();
X
X	var_init();				/* initialize procedure variables */
X	poutput_init();			/* initialize procedure output */
X
X	icmd_prompt = make_esd(64);
X	set_default_escape_prompt();
X	ttymode(1);				/* put user console in `raw' mode */
X
X/* init line variables */
X	Lline[0] = 0;				/* no line chosen yet */
X	Liofd = -1;					/* no line open now */
X	Lbaud = DEFAULT_BAUD_RATE;	/* see ecu.h */
X	Lparity = 0;				/* no parity selected ... default NONE */
X	Ltelno[0] = 0;				/* no telephone number for remote yet */
X	Llogical[0] = 0;			/* no logical name for remote yet */
X	Ldescr[0] = 0;				/* no description for remote yet */
X	Lmodem_off_hook = 0;		/* assume modem on hook */
X	Ladd_nl_incoming = 0;		/* dont add nl to incoming cr */
X	Ladd_nl_outgoing = 0;		/* dont add nl to outgoing cr */
X	Lfull_duplex = 1;			/* assume full duplex */
X	Lmodem_already_init = 0;	/* modem has not been initialized */
X
X	for(iargv = 1; iargv < argc; iargv++)
X	{
X		if(*argv[iargv] != '-')
X			continue;
X		swchar = *(argv[iargv] + 1);
X		optarg = "";
X		if((swchar == 'c') || (swchar == 'l') || (swchar == 'b') ||
X			(swchar == 'p'))
X		{
X			if(*(argv[iargv] + 2) == 0)
X			{
X				if(iargv < argc - 1)
X				{
X					++iargv;
X					optarg = argv[iargv];
X				}
X			}
X			else		/* we have a switch setting */
X				optarg = argv[iargv] + 2;
X			switch( swchar )
X			{
X				case 'b':
X					if(((*optarg == 0) || (*optarg == '-')))
X					{
X						ff(se,"-b must have a baud rate argument\r\n");
X						usage();
X						/*NOTREACHED*/
X					}
X					if(valid_baud_rate(Lbaud = atoi(optarg)) < 0)
X					{
X						ff(se,"invalid baud rate\r\n");
X						usage();
X					}
X					break;
X				case 'c':
X					if(((*optarg == 0) || (*optarg == '-')))
X					{
X						ff(se,"-c must have a modem control filename\r\n");
X						usage();
X						/*NOTREACHED*/
X					}
X					strcpy(modem_ctl_fname,optarg);
X					break;
X				case 'l':
X					if(((*optarg == 0) || (*optarg == '-')))
X					{
X						ff(se,"-l must have a valid suffix for '/dev/tty'\r\n");
X						usage();
X						/*NOTREACHED*/
X					}
X					strcpy(Lline,"/dev/tty");
X					strcat(Lline,optarg);
X					break;
X				case 'p':
X					if(((*optarg == 0) || (*optarg == '-')))
X					{
X						ff(se,"-p must have a initial procedure name\r\n");
X						usage();
X						/*NOTREACHED*/
X					}
X					strcpy(initial_procedure,optarg);
X					break;
X				default:
X					ff(se,"logic error in optarg procssing\r\n");
X					exit(99);
X					break;
X			}	/* end of swchar with optional string */
X			continue;
X		}	/* end of if keyword switch (requiring additonal string) */
X
X		/* simple switches */
X		cptr = argv[iargv] + 1;
X		while(swchar = *cptr++)
X		{
X			switch(swchar)
X			{
X				case 'h': Lfull_duplex = 0; break;
X				case 'f': Lfull_duplex = 1; break;
X				case 'd': quit_on_init_proc_fail = 1;
X				case 't': Ladd_nl_incoming = 1;
X				          Ladd_nl_outgoing = 1; break;
X				case 'e': Lparity = 'e'; break;
X				case 'o': Lparity = 'o'; break;
X				case '?': usage();
X				          /*NOTREACHED*/
X				default:
X					ff(se,"unrecognized switch -'%c' (ignored)\r\n",swchar);
X					usage_quit = 1;
X					break;
X			}
X		}	/* end of while simple switches may be after one '-' */
X	}		/* end of argv loop */
X
X	if(usage_quit)
X		usage();
X
X
X/* check out line */
X	if(!Lline[0])
X	{
X		if(!there_is_hdb_on_this_machine)
X			strcpy(Lline,"/dev/tty1a");
SHAR_EOF
echo "End of part 1"
echo "File ecu.c is continued in part 2"
echo "2" > s2_seq_.tmp
exit 0
-- 
-------------------------------------------------------------------
Warren Tucker, Tridom Corporation       ...!gatech!emory!tridom!wht 
Ker-au'-lo-phon.  An 8-foot partial flue-stop, having metal pipes
surmounted by adjustable rings, and with a hole bored near the top
of each pipe, producing a soft and "reedy" tone.