From pa.dec.com!decwrl!uunet!sparky!kent Sun Aug 11 15:43:00 PDT 1991
Article: 2581 of comp.sources.misc
Newsgroups: comp.sources.misc
Path: pa.dec.com!decwrl!uunet!sparky!kent
From: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
Subject:  v21i071:  ecu - ECU async comm package rev 3.10, Part19/37
Message-ID: <1991Aug4.162844.18390@sparky.IMD.Sterling.COM>
X-Md4-Signature: 2e9115a3cfcd2fb797b02ddfc5eb7d91
Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
Organization: Sterling Software, IMD
References: <csm-v21i053=ecu.215539@sparky.imd.sterling.com>
Date: Sun, 4 Aug 1991 16:28:44 GMT
Approved: kent@sparky.imd.sterling.com
Lines: 1928

Submitted-by: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
Posting-number: Volume 21, Issue 71
Archive-name: ecu/part19
Environment: SCO, XENIX, ISC
Supersedes: ecu3: Volume 16, Issue 25-59

---- Cut Here and feed the following to sh ----
#!/bin/sh
# this is ecu310.19 (part 19 of ecu310)
# do not concatenate these parts, unpack them in order with /bin/sh
# file termecu.h continued
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
if test ! -r _shar_seq_.tmp; then
	echo 'Please unpack part 1 first!'
	exit 1
fi
(read Scheck
 if test "$Scheck" != 19; then
	echo Please unpack part "$Scheck" next!
	exit 1
 else
	exit 0
 fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
	echo 'x - still skipping termecu.h'
else
echo 'x - continuing file termecu.h'
sed 's/^X//' << 'SHAR_EOF' >> 'termecu.h' &&
X#define TERMECU_BSD4_IOCTL			132
X#define TERMECU_SHM_ABL				133
X#define TERMECU_SHM_RTL				134
X#define TERMECU_NO_FORK_FOR_RCVR	135
X#define TERMECU_TTYIN_READ_ERROR	136
X#define TERMECU_LINE_OPEN_ERROR		137
X#define TERMECU_PWENT_ERROR			138
X#define TERMECU_USAGE				139
X#define TERMECU_CONFIG_ERROR		140
X#define TERMECU_CURSES_ERROR		141
X#define TERMECU_RCVR_FATAL_ERROR	142
X
X#define TERMECU_INIT_PROC_ERROR		192
X
X#define TERMECU_USER1				193
X#define TERMECU_USERN				223
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of termecu.h */
SHAR_EOF
echo 'File termecu.h is complete' &&
$TOUCH -am 0725125991 'termecu.h' &&
chmod 0644 termecu.h ||
echo 'restore of termecu.h failed'
Wc_c="`wc -c < 'termecu.h'`"
test 1148 -eq "$Wc_c" ||
	echo 'termecu.h: original size 1148, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= utmpstat.c ==============
if test -f 'utmpstat.c' -a X"$1" != X"-c"; then
	echo 'x - skipping utmpstat.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting utmpstat.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'utmpstat.c' &&
X#if defined(SHARE_DEBUG)
X#define LOG_UTMP
X#endif
X/*+-------------------------------------------------------------------------
X	utmpstat.c - utmp status for XENIX/UNIX line
X	wht@n4hgf.Mt-Park.GA.US
X
X  Defined functions:
X	strcmpi(s1,s2)
X	utmp_status(line)
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
X/*:02-13-1991-02:00-ache@hq.demos.su-swap patch 5 US_ return values */
X/*:02-07-1991-00:28-wht@n4hgf-utmp_status() was really messed up */
X/*:02-03-1991-17:52-ache@hq.demos.su-fix for XENIX utmp handling bug */
X/*:10-16-1990-20:43-wht@n4hgf-add SHARE_DEBUG */
X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include "ecu.h"
X#include "termecu.h"
X#include "utmpstatus.h"
X#include "ecuungetty.h"
X#include "dialprog.h"
X#include <errno.h>
X#include <utmp.h>
X
X#if !defined(ut_name)		/* nobody can keep their mind made up; ... */
X#define ut_name ut_user		/* ... this is getting verry difficult, very old */
X#endif
X
Xextern int errno;
X
Xchar *utmp_file = "/etc/utmp";
Xstruct utmp last_utmp;
X
X/*+-------------------------------------------------------------------------
X	strcmpi(s1,s2) - case-insensitive strcmp
XIn here rather than ecuutil.c since other executables besides ecu
Xuses this module and strcmpi needed there too 
X--------------------------------------------------------------------------*/
Xint
Xstrcmpi(s1,s2)
Xregister char *s1;
Xregister char *s2;
X{
Xregister char c1,c2;
X
X	for( ; *s1 ; s1++,s2++)
X	{
X		if(isupper(*s1))
X			c1 = tolower(*s1);
X		else
X			c1 = *s1;
X		if(isupper(*s2))
X			c2 = tolower(*s2);
X		else
X			c2 = *s2;
X		if(c1 != c2)
X			break;
X	}
X	return(*s1 - *s2);
X}	/* end of strcmpi */
X
X/*+-------------------------------------------------------------------------
X	utmp_status(line) - check line status in utmp
X'line' is "/dev/ttyxx"-style
Xreturns US_ value and global utmp struct last_utmp;
X--------------------------------------------------------------------------*/
Xint
Xutmp_status(line)
Xchar *line;
X{
Xregister ufd;
Xregister itmp;
Xregister status = US_NOTFOUND;
X#if defined(LOG_UTMP)
Xchar logstr[128];
X#endif
X
X/*
X * crock/bozo alert: 
X * ut_name ain't but EIGHT characters long, but
X * EIGHT characters are often stored, so ya don't get no null
X * ut_id ain't but FOUR characters long, but
X * FOUR characters are routinely stored, so ya don't get no null
X */
Xchar namecopy[sizeof(last_utmp.ut_name) + 1];
Xchar idcopy[sizeof(last_utmp.ut_id) + 1];
X
X	if((ufd = open(utmp_file,O_RDONLY,755)) < 0)
X	{
X		perror(utmp_file);
X		termecu(TERMECU_LINE_OPEN_ERROR);
X	}
X
X	while((status == US_NOTFOUND) &&
X		(read(ufd,(char *)&last_utmp,sizeof(last_utmp)) > 0))
X	{
X	    if(strcmpi(last_utmp.ut_line,line + 5))
X			continue;
X
X		strncpy(namecopy,last_utmp.ut_name,sizeof(last_utmp.ut_name));
X		namecopy[sizeof(namecopy) - 1] = 0;
X
X		strncpy(idcopy,last_utmp.ut_id,sizeof(last_utmp.ut_id));
X		idcopy[sizeof(idcopy) - 1] = 0;
X
X	    if(!strcmp(namecopy,"LOGIN"))
X			status = US_LOGIN;
X	    else if(!strcmp(namecopy,"DIALOUT"))
X			status = US_DIALOUT;
X	    else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty")))
X		{
X			if(itmp = line_locked(line))
X				status = US_DIALOUT;
X			else
X				status = US_LOGIN;
X		}
X		else if(!kill(last_utmp.ut_pid,0) || (errno != ESRCH))
X			status = US_LOGGEDIN;
X	}
X
X#if defined(LOG_UTMP)
X	if(status == US_NOTFOUND)
X		sprintf(logstr,"UTMP %s: no entry in utmp, status=%d",line,status);
X	else
X	{
X	char *ctime();
X		sprintf(logstr,"UTMP %s:%s:%s:%d:status=%d:%s",
X		    namecopy,idcopy,last_utmp.ut_line,
X		    last_utmp.ut_pid,status,ctime(&last_utmp.ut_time));
X		logstr[strlen(logstr) - 1] = 0;	/* kill NL from ctime() */
X	}
X	ecu_log_event(getpid(),logstr);
X#endif
X
X	close(ufd);
X	return(status);
X
X}	/* end of utmp_status */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of utmpstat.c */
SHAR_EOF
$TOUCH -am 0725125991 'utmpstat.c' &&
chmod 0644 utmpstat.c ||
echo 'restore of utmpstat.c failed'
Wc_c="`wc -c < 'utmpstat.c'`"
test 3907 -eq "$Wc_c" ||
	echo 'utmpstat.c: original size 3907, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= utmpstatus.h ==============
if test -f 'utmpstatus.h' -a X"$1" != X"-c"; then
	echo 'x - skipping utmpstatus.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting utmpstatus.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'utmpstatus.h' &&
X/*+-------------------------------------------------------------------------
X	utmpstatus.h
X	wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X/* utmp_status defines */
X#define US_NOTFOUND	100	/* not in utmp, or getty dead */
X#define US_LOGIN	101	/* enabled for login, idle */
X#define US_DIALOUT	102	/* enabled for login, currently dialout */
X#define US_LOGGEDIN	103	/* enabled for login, in use */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of utmpstatus.h */
SHAR_EOF
$TOUCH -am 0725125991 'utmpstatus.h' &&
chmod 0644 utmpstatus.h ||
echo 'restore of utmpstatus.h failed'
Wc_c="`wc -c < 'utmpstatus.h'`"
test 642 -eq "$Wc_c" ||
	echo 'utmpstatus.h: original size 642, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= var.c ==============
if test -f 'var.c' -a X"$1" != X"-c"; then
	echo 'x - skipping var.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting var.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'var.c' &&
X/*+-------------------------------------------------------------------------
X	var.c - ecu variable routines
X	wht@n4hgf.Mt-Park.GA.US
X
X  Defined functions:
X	alloc_MKV(name)
X	build_mkvi(param)
X	build_mkvi_primitive(name)
X	build_mkvs(param)
X	build_mkvs_primitive(name,length)
X	pcmd_mkvar(param)
X	find_mkvs(name,ppesd,auto_create)
X	find_mkvi(name,pplong,auto_create)
X	free_mkvi(mkv)
X	free_mkvs(mkv)
X	get_ivptr(param,ppiv,auto_create)
X	get_subscript(param,psubscript)
X	get_svptr(param,ppsv,auto_create)
X	mkv_proc_starting(pcb)
X	mkv_proc_terminating(pcb)
X	var_init()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include "ecu.h"
X#include "esd.h"
X#define VDECL
X#include "var.h"
X#include "proc.h"
X#include "ecukey.h"
X#include "ecuerror.h"
X
Xextern int proc_level;
Xextern int proctrace;
X
Xtypedef union mkvu_type
X{
X	ESD	*sv;
X	long iv;
X} MKVU;
X
Xtypedef struct mkv_type
X{
X	MKVU item;				/* pointer to esd if sv or long if iv */
X	struct mkv_type *next;	/* next MKV in chain; if==NULL, no more in chain */
X	struct mkv_type *prev;	/* previous MKV in chain; if==NULL, top of chain */
X	char *name;				/* name of variable */
X} MKV;
X
XMKV *mkvi_last = (MKV *)0;
XMKV *mkvs_last = (MKV *)0;
X
X/*+-------------------------------------------------------------------------
X	var_init()
X--------------------------------------------------------------------------*/
Xvoid
Xvar_init()
X{
Xregister itmp;
X
X	for(itmp = 0; itmp < SVQUAN; itmp++)
X	{
X		if((sv[itmp] = esdalloc(SVLEN)) == (ESD *)0)
X		{
X			pputs("out of memory\n");
X			exit(1);
X		}
X	}
X
X	for(itmp = 0; itmp < IVQUAN; itmp++)
X		iv[itmp] = 0;
X
X}	/* end of var_init */
X
X/*+-------------------------------------------------------------------------
X	alloc_MKV(name)
X--------------------------------------------------------------------------*/
XMKV *
Xalloc_MKV(name)
Xchar *name;
X{
XMKV *mkv;
X	if(!(mkv = (MKV *)malloc(sizeof(MKV))))
X		return((MKV *)0);
X	if(!(mkv->name = malloc(strlen(name) + 1)))
X	{
X		free((char *)mkv);
X		return((MKV *)0);
X	}
X	strcpy(mkv->name,name);
X	mkv->item.iv = 0;
X	return(mkv);
X}	/* end of alloc_MKV */
X
X/*+-------------------------------------------------------------------------
X	build_mkvi_primitive(name)
X--------------------------------------------------------------------------*/
Xbuild_mkvi_primitive(name)
Xchar *name;
X{
XMKV *mkv;
X
X	if((mkv = alloc_MKV(name)) == (MKV *)0)
X		return(eNoMemory);
X	if(mkvi_last)
X		mkvi_last->next = mkv;
X	mkv->prev = mkvi_last;
X	mkv->next = (MKV *)0;
X	mkvi_last = mkv;
X	return(0);
X}	/* end of build_mkvi_primitive */
X
X/*+-------------------------------------------------------------------------
X	build_mkvi(param)
X--------------------------------------------------------------------------*/
Xbuild_mkvi(param)
XESD *param;
X{
Xregister erc;
Xchar name[16];
X
X	if(erc = get_alphanum_zstr(param,name,sizeof(name)))
X		return(erc);
X	return(build_mkvi_primitive(name));
X
X}	/* end of build_mkvi */
X
X/*+-------------------------------------------------------------------------
X	build_mkvs_primitive(name,length)
X
Xtrusts caller not to exceed ESD_MAXSIZE
X--------------------------------------------------------------------------*/
Xbuild_mkvs_primitive(name,length)
Xchar *name;
Xint length;
X{
XMKV *mkv;
XESD *text;
X
X	if((text = esdalloc((int)length)) == (ESD *)0)
X		return(eNoMemory);
X
X	if((mkv = alloc_MKV(name)) == (MKV *)0)
X	{
X		esdfree(text);
X		return(eNoMemory);
X	}
X
X	mkv->item.sv = text;
X
X	if(mkvs_last)
X		mkvs_last->next = mkv;
X	mkv->prev = mkvs_last;
X	mkv->next = (MKV *)0;
X	mkvs_last = mkv;
X	return(0);
X
X}	/* end of build_mkvs_primitive */
X
X/*+-------------------------------------------------------------------------
X	build_mkvs(param)
X--------------------------------------------------------------------------*/
Xbuild_mkvs(param)
XESD *param;
X{
Xregister erc;
Xchar name[16];
Xulong length;
X
X	if(erc = get_alphanum_zstr(param,name,sizeof(name)))
X		return(erc);
X
X	if(erc = skip_paren(param,1))
X		return(erc);
X	if(erc = gint(param,&length))
X		return(erc);
X	if(length > ESD_MAXSIZE)
X	{
X		pprintf("max string size is %d ... cannot make %lu byte string\n",
X			ESD_MAXSIZE,length);
X		return(eFATAL_ALREADY);
X	}
X	if(erc = skip_paren(param,0))
X		return(erc);
X
X	return(build_mkvs_primitive(name,(int)length));
X
X}	/* end of build_mkvs */
X
X/*+-------------------------------------------------------------------------
X	pcmd_mkvar(param)
X
Xmkvar i<name>
Xmkvar s<name>(<size-int>)
X--------------------------------------------------------------------------*/
Xint
Xpcmd_mkvar(param)
XESD *param;
X{
Xregister erc;
Xchar vartype;
X
X	if(!proc_level)
X		return(eNotExecutingProc);
X
X	do {
X		if(erc = get_cmd_char(param,&vartype))
X			return(erc);
X		if(vartype == '$')
X		{
X			if(erc = get_cmd_char(param,&vartype))
X				return(erc);
X		}
X		vartype = to_lower(vartype);
X		switch(vartype)
X		{
X			case 'i':
X				erc = build_mkvi(param);
X				break;
X			case 's':
X				erc = build_mkvs(param);
X				break;
X			default:
X				return(eIllegalVarType);
X		}
X		if(erc)
X			return(erc);
X	} while(!skip_comma(param));
X
X	if(!end_of_cmd(param))
X		return(eSyntaxError);
X
X	return(0);
X
X}	/* end of pcmd_mkvar */
X
X/*+-------------------------------------------------------------------------
X	free_mkvi(mkv)
X--------------------------------------------------------------------------*/
Xvoid
Xfree_mkvi(mkv)
XMKV *mkv;
X{
X	free(mkv->name);
X	free((char *)mkv);
X}	/* end of free_mkvi */
X
X/*+-------------------------------------------------------------------------
X	free_mkvs(mkv)
X--------------------------------------------------------------------------*/
Xvoid
Xfree_mkvs(mkv)
XMKV *mkv;
X{
X	esdfree(mkv->item.sv);
X	free(mkv->name);
X	free((char *)mkv);
X}	/* end of free_mkvs */
X
X/*+-------------------------------------------------------------------------
X	mkv_proc_starting(pcb)
X--------------------------------------------------------------------------*/
Xvoid
Xmkv_proc_starting(pcb)
XPCB *pcb;
X{
X	pcb->mkvs_last = (char *)mkvs_last;
X	pcb->mkvi_last = (char *)mkvi_last;
X}	/* end of mkv_proc_starting */
X
X/*+-------------------------------------------------------------------------
X	mkv_proc_terminating(pcb)
X--------------------------------------------------------------------------*/
Xvoid
Xmkv_proc_terminating(pcb)
XPCB *pcb;
X{
XMKV *pmkv;
X
X	while(mkvi_last != (MKV *)pcb->mkvi_last)
X	{
X		pmkv = mkvi_last->prev;
X		free_mkvi(mkvi_last);
X		mkvi_last = pmkv;
X	}
X	while(mkvs_last != (MKV *)pcb->mkvs_last)
X	{
X		pmkv = mkvs_last->prev;
X		free_mkvs(mkvs_last);
X		mkvs_last = pmkv;
X	}
X
X}	/* end of mkv_proc_terminating */
X
X/*+-------------------------------------------------------------------------
X	find_mkvs(name,ppesd,auto_create)
X--------------------------------------------------------------------------*/
Xint
Xfind_mkvs(name,ppesd,auto_create)
Xchar *name;
XESD **ppesd;
Xint auto_create;
X{
Xint erc;
XMKV *mkv = mkvs_last;
X
X	while(mkv)
X	{
X		if(!strcmp(name,mkv->name))
X		{
X			*ppesd = mkv->item.sv;
X			return(0);
X		}
X		mkv = mkv->prev;
X	}
X
X	if(auto_create)
X	{
X		if(proctrace)
X			pprintf("creating $s%s(256)\n",name);
X		if(erc = build_mkvs_primitive(name,256))
X			return(erc);
X		*ppesd = mkvs_last->item.sv;
X		return(0);
X	}
X
X	return(eNoSuchVariable);
X
X}	/* end of find_mkvs */
X
X/*+-------------------------------------------------------------------------
X	find_mkvi(name,pplong,auto_create)
X--------------------------------------------------------------------------*/
Xint
Xfind_mkvi(name,pplong,auto_create)
Xchar *name;
Xlong **pplong;
Xint auto_create;
X{
Xint erc;
XMKV *mkv = mkvi_last;
X
X	while(mkv)
X	{
X		if(!strcmp(name,mkv->name))
X		{
X			*pplong = &mkv->item.iv;
X			return(0);
X		}
X		mkv = mkv->prev;
X	}
X
X	if(auto_create)
X	{
X		if(proctrace)
X			pprintf("creating $i%s\n",name);
X		if(erc = build_mkvi_primitive(name))
X			return(erc);
X		*pplong = &mkvi_last->item.iv;
X		return(0);
X	}
X
X	return(eNoSuchVariable);
X
X}	/* end of find_mkvi */
X
X/*+-------------------------------------------------------------------------
X	get_subscript(param,psubscript)
Xonly called when '[' at pb + index
X--------------------------------------------------------------------------*/
Xget_subscript(param,psubscript)
XESD *param;
Xulong *psubscript;
X{
Xregister erc;
X
X	param->index++;
X	if(erc = gint(param,psubscript))
X		return(erc);
X	if(skip_cmd_char(param,']'))
X		return(eSyntaxError);
X	return(0);
X}	/* end of get_subscript */
X
X/*+-------------------------------------------------------------------------
X	get_ivptr(param,ppiv,auto_create)
Xcalled with index set to $i.....
X                           ^
X--------------------------------------------------------------------------*/
Xget_ivptr(param,ppiv,auto_create)
XESD *param;
Xlong **ppiv;
Xint auto_create;
X{
Xregister erc;
Xulong varnum;
Xchar name[16];
X
X	if(end_of_cmd(param))
X		return(eSyntaxError);
X	else if(!get_numeric_value(param,&varnum))
X		goto TEST_VARNUM;
X	else if(*(param->pb + param->index) == '[')
X	{
X		if(erc = get_subscript(param,&varnum))
X			return(erc);
XTEST_VARNUM:
X		if(varnum >= IVQUAN)
X			return(eIllegalVarNumber);
X		*ppiv = &iv[(int)varnum];
X		return(0);
X	}
X	else if(get_alphanum_zstr(param,name,sizeof(name)))
X		return(eInvalidVarName);
X
X	return(find_mkvi(name,ppiv,auto_create));
X
X}	/* end of get_ivptr */
X
X/*+-------------------------------------------------------------------------
X	get_svptr(param,ppsv,auto_create)
Xcalled with index set to $s.....
X                           ^
X--------------------------------------------------------------------------*/
Xget_svptr(param,ppsv,auto_create)
XESD *param;
XESD **ppsv;
Xint auto_create;
X{
Xregister erc;
Xulong varnum;
Xchar name[16];
X
X	if(end_of_cmd(param))
X		return(eSyntaxError);
X	else if(!get_numeric_value(param,&varnum))
X		goto TEST_VARNUM;
X	else if(*(param->pb + param->index) == '[')
X	{
X		if(erc = get_subscript(param,&varnum))
X			return(erc);
XTEST_VARNUM:
X		if(varnum >= SVQUAN)
X			return(eIllegalVarNumber);
X		*ppsv = sv[(int)varnum];
X		return(0);
X	}
X	if(get_alphanum_zstr(param,name,sizeof(name)))
X		return(eInvalidVarName);
X	return(find_mkvs(name,ppsv,0));
X
X}	/* end of get_svptr */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of var.c */
SHAR_EOF
$TOUCH -am 0725125991 'var.c' &&
chmod 0644 var.c ||
echo 'restore of var.c failed'
Wc_c="`wc -c < 'var.c'`"
test 10091 -eq "$Wc_c" ||
	echo 'var.c: original size 10091, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= var.h ==============
if test -f 'var.h' -a X"$1" != X"-c"; then
	echo 'x - skipping var.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting var.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'var.h' &&
X/*+-------------------------------------------------------------------------
X	var.h - ecu user variable declarations
X	wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#if !defined(VDECL)
X#define VDECL extern
X#endif
X
X#define SVLEN	256
X#define SVQUAN	50
X#define IVQUAN	50
X
XVDECL ESD *sv[SVQUAN];
XVDECL long iv[SVQUAN];
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of var.h */
SHAR_EOF
$TOUCH -am 0725125991 'var.h' &&
chmod 0644 var.h ||
echo 'restore of var.h failed'
Wc_c="`wc -c < 'var.h'`"
test 555 -eq "$Wc_c" ||
	echo 'var.h: original size 555, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= bperr/bperr.c ==============
if test ! -d 'bperr'; then
    echo 'x - creating directory bperr'
    mkdir 'bperr'
fi
if test -f 'bperr/bperr.c' -a X"$1" != X"-c"; then
	echo 'x - skipping bperr/bperr.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting bperr/bperr.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'bperr/bperr.c' &&
X/*+-------------------------------------------------------------------------
X	bperr.c - build proc_error .c from ecuerror.h
X	wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:55-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:39-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X#include <time.h>
X#include "../stdio_lint.h"
X
X#define MAXLINE 256
X#define MAXFLDS 50
X
Xchar *strchr();
X
Xchar line[MAXLINE];
Xchar copy[MAXLINE];
Xchar *fields[MAXFLDS + 1];
X
Xchar *bc = 
X"/*+-------------------------------------------------------------------------";
Xchar *ec = 
X"--------------------------------------------------------------------------*/";
X/*+-------------------------------------------------------------------------
X	splitter(sep)
X--------------------------------------------------------------------------*/
Xsplitter(sep)
Xchar *sep;
X{
Xchar *tmp = copy;
Xregister int fld;
X
X	for (fld = 1; fld <= MAXFLDS; fld++)
X		fields[fld] = NULL;
X	if (!strlen(sep) || !strlen(line))
X		return(0);
X	fld = 1;
X	sprintf(copy, "%s", line);
X	while (fld < MAXFLDS)
X	{
X		while (strchr(sep, *tmp))
X			if (!*++tmp) return fld;
X		fields[fld++] = tmp++;
X		while (!strchr(sep, *tmp))
X			if (!*++tmp) return fld;
X		*tmp++ = '\0';
X	}
X	return(fld);
X}	/* end of splitter */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv)
X--------------------------------------------------------------------------*/
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X{
Xregister field_count;
Xregister itmp;
Xlong time();
Xstruct tm *localtime();
Xlong cur_time;
Xstruct tm *ltime;
XFILE *fp;
Xchar cmd[256];
X
X	freopen("proc_error.c","w",stdout);
X
X	puts(bc);
X	puts("\tproc_error.c - print ecu procedure error");
X	puts(ec);
X	puts("/*+:EDITS:*/");
X
X	cur_time = time((long *)0);
X	ltime = localtime(&cur_time);
X	printf(
X	"/*:%02d-%02d-%04d-%02d:%02d-build_err-creation from ecuerror.h */\n",
X	    ltime->tm_mon+1,ltime->tm_mday,ltime->tm_year + 1900,
X	    ltime->tm_hour,ltime->tm_min);
X	puts("");
X	puts("#include \"ecu.h\"");
X	puts("#include \"ecuerror.h\"");
X	puts("");
X	puts(bc);
X	puts("\tproc_error(erc) - print error message");
X	puts(ec);
X	puts("void");
X	puts("proc_error(erc)");
X	puts("int erc;");
X	puts("{");
X	puts("\tswitch(erc)");
X	puts("\t{");
X
X	for(itmp = 0; itmp <= MAXFLDS; itmp++)
X		fields[itmp] = NULL;
X
X	fp = fopen("ecuerror.h","r");
X
X	while(fgets(line,sizeof(line),fp))
X	{
X		line[strlen(line) - 1] = 0;
X		fields[0] = line;
X		field_count = splitter(" \t");
X		if(!field_count || (strcmp(fields[1],"#define")))
X			continue;
X		if((!strcmp(fields[2],"eFATAL_ALREADY")) ||
X			(!strcmp(fields[2],"eWARNING_ALREADY")) ||
X			(!strncmp(fields[2],"e_",2)))
X			continue;
X		printf("\t\tcase %s:\n",fields[2]);
X		fputs("\t\t\tpputs(\"",stdout);
X
X		for(itmp = 1; itmp < field_count - 1; itmp++)
X			if(!strcmp(fields[itmp],"/*"))
X				break;
X		itmp++;
X
X		for(; itmp < field_count - 1; itmp++)
X		{
X			fputs(fields[itmp],stdout);
X			if(itmp != field_count - 2)
X				fputc(' ',stdout);
X		}
X		fputs("\\n\");\n",stdout);
X		puts("\t\t\tbreak;");
X	}
X	puts("\t\tcase eFATAL_ALREADY:");
X	puts("\t\tcase eWARNING_ALREADY:");
X	puts("\t\t\tbreak;");
X	puts("\t\tdefault:");
X	puts("\t\t\tpprintf(\"unknown error %x\\n\",erc);");
X	puts("\t\t\tbreak;");
X
X	puts("\t}");
X	puts("} /* end of proc_error */\n");
X	puts("/* vi: set tabstop=4 shiftwidth=4: */");
X	puts("/* end of proc_error.c */");
X	freopen("/dev/tty","a",stdout);
X	sprintf(cmd,"fcrc -u proc_error.c");
X	system(cmd);
X	exit(0);
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of bperr.c */
SHAR_EOF
$TOUCH -am 0725125591 'bperr/bperr.c' &&
chmod 0644 bperr/bperr.c ||
echo 'restore of bperr/bperr.c failed'
Wc_c="`wc -c < 'bperr/bperr.c'`"
test 3611 -eq "$Wc_c" ||
	echo 'bperr/bperr.c: original size 3611, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= help/helpgen.c ==============
if test -f 'help/helpgen.c' -a X"$1" != X"-c"; then
	echo 'x - skipping help/helpgen.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting help/helpgen.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/helpgen.c' &&
X/*+-------------------------------------------------------------------------
X	helpgen.c -- ecu command help file maker
X	wht@n4hgf.Mt-Park.GA.US
X
X  Defined functions:
X	build_ecudoc()
X	build_ecuhelp()
X	main(argc,argv,envp)
X	search_cmd_list(cmd)
X	show_cmds()
X	test_help()
X	usage()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
X/*:07-12-1991-14:50-wht@n4hgf-remove obsolete ecuhelp.txt generator */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#if defined(M_SYSV)
X#if !defined(LINT_ARGS)
X#define LINT_ARGS
X#endif
X#endif
X# include "lint_args.h"
X#include <sys/types.h>
X#include <termio.h>
X
X#define DECLARE_P_CMD
X#define HELPGEN
X#include "../ecucmd.h"
X
X#include "../esd.h"
X#include "../stdio_lint.h"
X
X#define PSRC	"ecuhelp.src"
X#define PDAT	"ecuhelp.data"
X#define PDOC	"ecuhelp.doc"
X
Xlong start_pos[TOKEN_QUAN];
Xint token_line[TOKEN_QUAN];
XFILE	*fpsrc;		/* help source file */
XFILE	*fpdat;		/* help data file */
XFILE	*fpdoc;		/* help doc file */
XFILE	*fptxt;		/* help nroff file */
XP_CMD	*pcmd;
Xint src_line = 0;
Xchar buf[128];
X
X/*+-------------------------------------------------------------------------
X	usage()
X--------------------------------------------------------------------------*/
Xusage()
X{
X	fprintf(stderr,"usage: helpgen [-b] [-d] [-s] [-t]\n");
X	fprintf(stderr," -b build %s from %s\n",PDAT,PSRC);
X	fprintf(stderr," -d build %s from %s\n",PDOC,PDAT);
X	fprintf(stderr," -s show list of commands\n");
X	fprintf(stderr," -t test help\n");
X	fprintf(stderr,"At least one switch must be issued.  They are executed\n");
X	fprintf(stderr,"in the order shown on the usage line.\n");
X	exit(1);
X}	/* end of usage */
X
X/*+-------------------------------------------------------------------------
X	search_cmd_list(cmd)
X--------------------------------------------------------------------------*/
XP_CMD *
Xsearch_cmd_list(cmd)
Xregister char *cmd;
X{
Xregister P_CMD	*cmd_list = icmd_cmds;
X
X	while(cmd_list->token != -1)
X	{
X		if(strcmp(cmd_list->cmd,cmd) == 0)
X			break;
X		cmd_list++;
X	}
X	if(cmd_list->token == -1)
X		return((P_CMD *)0);
X	else
X		return(cmd_list);
X
X}	/* end of search_cmd_list */
X
X/*+-------------------------------------------------------------------------
X	show_cmds()
Xcommands with null descriptions are "undocumented"
X--------------------------------------------------------------------------*/
Xvoid
Xshow_cmds()
X{
Xregister int itmp;
Xregister P_CMD *pcmd = icmd_cmds;
Xregister int longest_cmd = 0;
Xregister int longest_descr = 0;
Xregister int nl_flag = 0;
Xchar s80[80];
XP_CMD *longest_cmd_p = 0;
XP_CMD *longest_descr_p = 0;
X
X	while(pcmd->token != -1)
X	{
X		if(!*pcmd->descr)
X		{
X			pcmd++;
X			continue;
X		}
X		itmp = strlen(pcmd->cmd);
X		if(itmp > longest_cmd)
X		{
X			longest_cmd = itmp;
X			longest_cmd_p = pcmd;
X		}
X		itmp = strlen(pcmd->descr);
X		if(itmp > longest_descr)
X		{
X			longest_descr = itmp;
X			longest_descr_p = pcmd;
X		}
X		pcmd++;
X	}
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if((!pcmd->mincnt) || (!*pcmd->descr))
X		{
X			pcmd++;
X			continue;
X		}
X		strcpy(s80,pcmd->cmd);
X		pad_zstr_to_len(s80,longest_cmd + 2);
X		for(itmp = 0; itmp < pcmd->mincnt; itmp++)
X			s80[itmp] = to_upper(s80[itmp]);
X		fputs(s80,stderr);
X
X		strcpy(s80,pcmd->descr);
X		pad_zstr_to_len(s80,longest_descr + 1);
X		fputs(s80,stderr);
X
X		if(nl_flag)
X			fputs("\r\n",stderr);
X		else
X			fputs("| ",stderr);
X		nl_flag = (nl_flag) ? 0 : 1;
X
X		pcmd++;
X	}
X	if(nl_flag)
X		fputs("\r\n",stderr);
X
X	itmp = longest_cmd + longest_descr + 5;
X	sprintf(s80,"recwidth = %d\r\n",itmp);
X	fprintf(stderr,s80);
X	pcmd = longest_cmd_p;
X	sprintf(s80,"longest cmd: %s: %s\r\n",pcmd->cmd,pcmd->descr);
X	fprintf(stderr,s80);
X	pcmd = longest_descr_p;
X	sprintf(s80,"longest dsc: %s: %s\r\n",pcmd->cmd,pcmd->descr);
X	fprintf(stderr,s80);
X
X}	/* end of show_cmds */
X
X/*+-------------------------------------------------------------------------
X	build_ecuhelp()
X--------------------------------------------------------------------------*/
Xvoid
Xbuild_ecuhelp()
X{
Xregister int itmp;
Xregister char *cptr;
X
X	printf("\nBuilding %s\n",PDAT);
X
X/* use proc cmd entry for flag */
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		pcmd->proc = (PFI)0;
X		pcmd++;
X	}
X
X	for(itmp = 0; itmp < TOKEN_QUAN; itmp++)
X	{
X		start_pos[itmp] = 0L;
X		token_line[itmp] = 0;
X	}
X
X	if((fpsrc = fopen(PSRC,"r")) == NULL)
X	{
X		perror(PSRC);
X		exit(1);
X	}
X
X	if((fpdat = fopen(PDAT,"w")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X
X	fwrite((char *)start_pos,sizeof(long),	/* write null table */
X			TOKEN_QUAN,fpdat);
X
X	while(fgets(buf,sizeof(buf),fpsrc) != NULL)
X	{
X		src_line++;
X		itmp = strlen(buf);
X		buf[--itmp] = 0;						/* kill trailing nl */
X		if((buf[0] == '#') || (buf[0] == '/'))	/* ignore comments */
X			continue;
X		if(buf[0] == '%')		/* command indication */
X		{
XSEARCH_CMD_LIST:
X			if(!(pcmd = search_cmd_list(&buf[1])))
X			{
X#ifdef notdef	/* primarily because of 'eto' and 'fasi' */
X				printf("line %d: '%s' not in command table\n",
X						src_line,&buf[1]);
X#endif
X				while(fgets(buf,sizeof(buf),fpsrc) != NULL)
X				{
X					src_line++;
X					itmp = strlen(buf);
X					buf[--itmp] = 0;					/* kill trailing nl */
X					if(buf[0] == '%')		/* command indication */
X						goto SEARCH_CMD_LIST;
X				}
X				break;
X			}
X			if(start_pos[pcmd->token])
X			{
X				printf("line %d: '%s' already found on line %d\n",
X						src_line,&buf[1],token_line[pcmd->token]);
X				exit(1);
X			}
X			fputs("\n",fpdat);	/* terminate previous command description */
X			start_pos[pcmd->token] = ftell(fpdat);
X			token_line[pcmd->token] = src_line;
X			fputs("   ",fpdat);
X			cptr = &buf[1];	/* command text */
X			itmp = 0;
X			pcmd->proc = (PFI)1;	/* indicate we save command info */
X			while(*cptr)		/* show cmd and min chars required */
X			{
X				if(itmp < pcmd->mincnt)
X					fputc(to_upper(*cptr++),fpdat);
X				else
X					fputc(to_lower(*cptr++),fpdat);
X				itmp++;
X			}
X			if(*pcmd->descr)		/* if description present */
X				fprintf(fpdat," : %s\n \n",pcmd->descr);
X			else
X				fputs("\n \n",fpdat);
X			continue;
X		}
X		fprintf(fpdat," %s\n",buf);
X	}
X
X	fseek(fpdat,0L,0);	/* back to position table */
X	fwrite((char *)start_pos,sizeof(long),	/* write actual table */
X		TOKEN_QUAN,fpdat);
X	fclose(fpsrc);
X	fputs("\n",fpdat);	/* terminate last command */
X	fclose(fpdat);
X
X/* say which commands weren't in the help source */
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if(pcmd->mincnt && !pcmd->proc)
X			fprintf(stderr,"'%s' not in help source\n",pcmd->cmd);
X		pcmd++;
X	}
X
X
X}	/* end of build_ecuhelp */
X
X/*+-------------------------------------------------------------------------
X	build_ecudoc()
X--------------------------------------------------------------------------*/
Xvoid
Xbuild_ecudoc()
X{
Xregister int itmp;
X
X	printf("\nBuilding %s\n",PDOC);
X	if((fpdat = fopen(PDAT,"r")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X	if((fpdoc = fopen(PDOC,"w")) == NULL)
X	{
X		perror(PDOC);
X		exit(1);
X	}
X	fprintf(fpdoc,
X		"\n     ECU  Command  Help  Documentation  (PRELIMINARY)\n\n");
X	fprintf(fpdoc,
X		"Commands are accessed by pressing the HOME key followed by one\n");
X	fprintf(fpdoc,
X		"of the following commands (capitalized portions are sufficient\n");
X	fprintf(fpdoc,
X		"to invoke the command):\n");
X	fprintf(fpdoc,"\n");
X	fprintf(fpdoc,
X"---------------------------------------------------------------------\n");
X	fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if(!pcmd->token)
X		{
X			pcmd++;
X			continue;
X		}
X		if(pcmd->mincnt && !start_pos[pcmd->token])
X		{
X			printf("no help available for '%s'\n",pcmd->cmd);
X			pcmd++;
X			continue;
X		}
X		fseek(fpdat,start_pos[pcmd->token],0);
X		while(fgets(buf,sizeof(buf),fpdat) != NULL)
X		{
X			itmp = strlen(buf);
X			buf[--itmp] = 0;
X			if(itmp == 0)
X				break;
X			fprintf(fpdoc,"%s\n",buf);
X		}
X		fprintf(fpdoc,
X"---------------------------------------------------------------------\n");
X		pcmd++;
X	}
X	fclose(fpdat);
X	fclose(fpdoc);
X}	/* end of build_ecudoc */
X
X/*+-------------------------------------------------------------------------
X	test_help()
X--------------------------------------------------------------------------*/
Xvoid
Xtest_help()
X{
Xregister int itmp;
X
X/* test code */
X	printf("\nNow to test\n");
X	if((fpdat = fopen(PDAT,"r")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X	fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
X	while(1)
X	{
X		printf("\ncommand: ");
X		fgets(buf,sizeof(buf),stdin);
X		itmp = strlen(buf);
X		buf[--itmp] = 0;
X		if(itmp == 0)
X			break;
X		if(!(pcmd = search_cmd_list(buf)))
X		{
X			printf("'%s' not found in ecu cmd table\n",buf);
X			continue;
X		}
X		if(pcmd->mincnt && !start_pos[pcmd->token])
X		{
X			printf("no help available for '%s'\n",buf);
X			continue;
X		}
X		fseek(fpdat,start_pos[pcmd->token],0);
X		while(fgets(buf,sizeof(buf),fpdat) != NULL)
X		{
X			itmp = strlen(buf);
X			buf[--itmp] = 0;
X			if(itmp == 0)
X				break;
X			printf("%s\n",buf);
X		}
X	}
X}	/* end of test_help */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister int itmp;
Xint iargv;
Xint b_flag = 0;
Xint s_flag = 0;
Xint t_flag = 0;
Xint f_flag = 0;
Xint d_flag = 0;
X
X	setbuf(stdout,NULL);
X	setbuf(stderr,NULL);
X
X	if(argc < 1)
X		usage();
X	for(iargv = 1; iargv < argc; iargv++)
X	{
X		if(argv[iargv][0] == '-')
X		{
X			switch(itmp = (argv[iargv][1]))
X			{
X				case 'b': b_flag = 1; break;
X				case 's': s_flag = 1; break;
X				case 't': t_flag = 1; break;
X				case 'd': d_flag = 1; break;
X				default:
X					usage();
X					break;
X			}
X		}
X		else
X			usage();
X	}
X	if(!b_flag && !s_flag && !t_flag && !d_flag && !f_flag)
X		usage();
X
X	if(b_flag)
X		build_ecuhelp();
X	if(d_flag)
X		build_ecudoc();
X	if(s_flag)
X		show_cmds();
X	if(t_flag)
X		test_help();
X
X	exit(0);
X}	/* end of main */
X/* end of helpgen.c */
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
$TOUCH -am 0725125891 'help/helpgen.c' &&
chmod 0644 help/helpgen.c ||
echo 'restore of help/helpgen.c failed'
Wc_c="`wc -c < 'help/helpgen.c'`"
test 9990 -eq "$Wc_c" ||
	echo 'help/helpgen.c: original size 9990, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= help/lint_args.h ==============
if test -f 'help/lint_args.h' -a X"$1" != X"-c"; then
	echo 'x - skipping help/lint_args.h (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting help/lint_args.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/lint_args.h' &&
X/*+-----------------------------------------------------------------------
X	lint_args.h
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* helpgen.c */
Xint main(int ,char **,char **);
Xint usage(void );
Xstruct p_cmd *search_cmd_list(char *);
Xvoid build_ecudoc(void );
Xvoid build_ecuhelp(void );
Xvoid build_ecutxt(void );
Xvoid show_cmds(void );
Xvoid test_help(void );
X/* util.c */
Xchar to_lower(char );
Xchar to_upper(char );
Xvoid pad_zstr_to_len(char *,int );
X
X#else		/* compiler doesn't know about prototyping */
X
X/* helpgen.c */
Xstruct p_cmd *search_cmd_list();
Xvoid build_ecudoc();
Xvoid build_ecuhelp();
Xvoid build_ecutxt();
Xvoid show_cmds();
Xvoid test_help();
X/* util.c */
Xchar to_lower();
Xchar to_upper();
Xvoid pad_zstr_to_len();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of lint_args.h */
SHAR_EOF
$TOUCH -am 0725125891 'help/lint_args.h' &&
chmod 0644 help/lint_args.h ||
echo 'restore of help/lint_args.h failed'
Wc_c="`wc -c < 'help/lint_args.h'`"
test 1015 -eq "$Wc_c" ||
	echo 'help/lint_args.h: original size 1015, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= help/util.c ==============
if test -f 'help/util.c' -a X"$1" != X"-c"; then
	echo 'x - skipping help/util.c (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting help/util.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/util.c' &&
X/*+-------------------------------------------------------------------------
X	util.c
X	wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X# include "lint_args.h"
X
X/*+-------------------------------------------------------------------------
X	all touuper/tolower not created equally, so this works!
X--------------------------------------------------------------------------*/
Xchar to_upper(ch)
Xregister char    ch;
X{ return( ((ch >= 'a') && (ch <= 'z')) ? ch - 0x20 : ch);
X}   /* end of to_upper() */
X
Xchar to_lower(ch)
Xregister char    ch;
X{ return( ((ch >= 'A') && (ch <= 'Z')) ? ch + 0x20 : ch);
X}   /* end of to_lower() */
X
X
X/*+-----------------------------------------------------------------------
X	pad_zstr_to_len(zstr,len)
X
X  pads with spaces to specified length, unless already longer than
X  len in which case the string is truncated to 'len' characters.
X------------------------------------------------------------------------*/
Xvoid
Xpad_zstr_to_len(zstr,len)
Xchar	*zstr;
Xint		len;
X{
Xregister int	izstr;
X
X	izstr = strlen(zstr);
X	if(izstr >= len)
X		zstr[len] = 0;
X	else
X	{
X		while(izstr < len)
X			zstr[izstr++] = 0x20;
X		zstr[izstr] = 0;
X	}
X}	/* end of pad_zstr_to_len */
X
SHAR_EOF
$TOUCH -am 0725125891 'help/util.c' &&
chmod 0644 help/util.c ||
echo 'restore of help/util.c failed'
Wc_c="`wc -c < 'help/util.c'`"
test 1357 -eq "$Wc_c" ||
	echo 'help/util.c: original size 1357, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= help/Make.src ==============
if test -f 'help/Make.src' -a X"$1" != X"-c"; then
	echo 'x - skipping help/Make.src (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting help/Make.src (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/Make.src' &&
X#  CHK=0xFF6D
X#+---------------------------------------------------------------
X# Makefile for helpgen (ecu help system)
X#----------------------------------------------------------------
X#+:EDITS:*/
X#:07-25-1991-12:58-wht@n4hgf-ECU release 3.10
X#:04-21-1991-13:31-wht@n4hgf-convert to Make.src
X
XSHELL = /bin/sh
XPROGRAM = helpgen
X
X.SUFFIXES:
X.SUFFIXES: .c .o .h
X.c.o:;	$(BINTIME) $(CC) -c $(CFLAGS) $*.c 
X
XSRC	= \
X	$(PROGRAM).c\
X	util.c
X
XOBJ	= \
X	$(PROGRAM).o\
X	util.o
X
Xall: $(PROGRAM) ecuhelp.data # ecuhelp.doc
X
X$(PROGRAM): $(OBJ)
X	$(BINTIME) $(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $(PROGRAM) 
X
X$(OBJ): Makefile
X
Xecuhelp.data: ecuhelp.src $(PROGRAM)
X	./$(PROGRAM) -b
X
Xecuhelp.doc: ecuhelp.src $(PROGRAM)
X	./$(PROGRAM) -d
X
X$(PROGRAM).fls: $(SRC)
X	ls $(SRC) >$(PROGRAM).fls
X
Xinstall:
X	../makedirs -m 755 $(ECULIBDIR)
X	cp ecuhelp.data $(ECULIBDIR)
X	chmod 755 $(ECULIBDIR)/ecuhelp.data
X
Xneat:
X	rm -f core Makefile.bak tags cscope.out
X	-rm -f *~ *# *.orig *.rej make.log a.out
X
Xclean: neat
X	rm -f $(OBJ)
X
Xclobber: clean
X	rm -f $(PROGRAM) ecuhelp.data ecuhelp.doc
X
X#MSC -Zg is broken and even my kludge mechanism can't make this one
X#anymore.  Decommitted until some future day.
X#protos: lint_args.h
X#
X#lint_args.h: $(PROGRAM).fls
X#	echo > lint_args.h
X#	csh ../zgcc $(PROGRAM).fls lint_args.h $(CFLAGS)
X
X#
X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
X#
Xdepend: Makefile
X
XMakefile: $(SRC)
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	 >> 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
X# DO NOT DELETE THIS LINE
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
$TOUCH -am 0725125891 'help/Make.src' &&
chmod 0644 help/Make.src ||
echo 'restore of help/Make.src failed'
Wc_c="`wc -c < 'help/Make.src'`"
test 2188 -eq "$Wc_c" ||
	echo 'help/Make.src: original size 2188, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= help/ecuhelp.src ==============
if test -f 'help/ecuhelp.src' -a X"$1" != X"-c"; then
	echo 'x - skipping help/ecuhelp.src (File already exists)'
	rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting help/ecuhelp.src (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/ecuhelp.src' &&
X# ecu help source file
X#+:EDITS:
X#:04-28-1991-04:45-wht@n4hgf-add eto and nice
X#:11-03-1989-16:21-wht------ unet2 -----
X#:06-17-1988-11:10-wht-add 'exit' command
X#:06-13-1988-15:38-wht-creation
X#--------------------------------------------------------------------
X%ax
XUsage: ax [<param>]
X
X<param> may be a single ASCII character, a standard ASCII identifier
X(such as ETX), or a two-character control character identifier (such as
X^C, typed as a caret followed by a C).
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%xa
XUsage: xa [<hex-val>]
X
X<hex-val> is a hexadecimal value between 0 and FF; the parity (sign) bit
Xis stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%oa
XUsage: oa [<octal-val>]
X
X<octal-val> is a octal value between 0 and 0377; the parity (sign) bit
Xis stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%da
XUsage: da [<decimal-val>]
X
X<decimal-val> is a decimal value between 0 and 0377; the parity (sign)
Xbit is stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%baud
XUsage: baud [<baud-rate>]
X
X<baud-rate>, if specified, must be taken from the values 110, 300, 600,
X1200, 2400, 4800, 9600, 19200 and 38400.  On some systems, 19200 and
X38400 may not be supported.  If baud rate 110 is selected, 2 stop bits
Xare automatically specified; other baud rates set 1 stop bit.  If
X<baud-rate> is not supplied, the current baud rate is displayed.
X
XThe setting may be automatically changed as the result of a 'dial'
Xcommand.  See also the 'dial' and 'parity' command descriptions.
X#--------------------------------------------------------------------
X%bn
XUsage: bn [ 0 | 1 | 2 ]
X
X"bell notify": This command is only available under XENIX.  If no
Xparameter is supplied, the current setting is displayed.  Specifying 0
Xdisables the facility; 1 causes an audible alarm to be sounded on all of
Xthe XENIX virtual consoles upon receipt of a bell (0x07) character from
Xthe remote system; 2 causes an audible alarm to be sent to all consoles
Xupon receipt of ANY characters from the remote system.  A non-zero value
Xalso causes an audible alarm to be sent to all console upon the
Xsuccessful completion of a 'redial' command which must retry more than
Xone redial attempt or upon completion of a file transfer operation.
X
XDifferent alarms are sent depending upon the the type of event causing
Xthe alarms.
X#--------------------------------------------------------------------
X%break
XUsage: break
X
XThis command sends a break signal to the remote system.
X#--------------------------------------------------------------------
X%cd
XUsage: cd [<dir-path>]
X
XThis command allows you to change the working directory of the ecu
Xprocess.  If <dir-path> is supplied, the previous working directory is
Xdisplayed, and <dir-path> is made the new working directory.  A history
Xof previous directory changes is maintained.  Entering the 'cd' command
Xshows the numbered history list and allows you to select a new directory
Xby entering the number.  Other commands allow deletion of directories
Xfrom the list or saving the list to file ~/.ecu/dir.  This file is
Xautomatically read at ecu startup, providing a convenient list of
Xdirectories available for quick selection.
X#--------------------------------------------------------------------
X%dial
XUsage: dial [<dial-param>]
X
X<dial-param> may take one of two forms, a telephone number to dial or a
Xlogical name which can be found in the user phone directory (in file
X~/.ecu/phone).
X
XIf a telephone number is supplied, the phone number is dialed; you must
Xfirst have set the desired baud rate and parity using the 'baud' and
X'parity' commands.  If a logical name is entered, the phone directory is
Xsearched; if the entry is found, the baud rate and parity is
Xautomatically set and the number dialed.
X
XIf <dial-param> is not supplied, then a screen-oriented self-documenting
Xdirectory manager is executed; you may scan the the directory to select
Xa number to dial, as well as add, remove and edit entries.  See also
X'baud' and 'parity'.
X#--------------------------------------------------------------------
X%do
XUsage: do <procname> [<arg> ... ]
X
XPerform ecu procedure.  Ecu searches for <procname>.ep in the current
Xdirectory.  If the file is not found, the program looks for the file in
Xthe ~/.ecu directory.  One or more arguments may be passed to the
Xprocedure.
X#--------------------------------------------------------------------
X%duplex
XUsage: duplex [ Full | Half ]
X
XThis command specifies whether or not ecu is to locally echo characters
Xtyped by you at the keyboard.  The overwhelming majority of remote
Xsystems provide the echo function, in which case full duplex must be
Xused.  For the rare occasions when the remote system does not echo your
Xkeyboard input, setting half duplex will allow you to see what you are
Xtyping.
X
XWhen communicating with another terminal in a "teletype conver- sation",
Xsetting half duplex is generally required.  In such cases, use of the
X'nl', 'nlin' and 'nlout' commands may also be required.
X
XThe default setting for duplex is full.
X#--------------------------------------------------------------------
X#%esc
X#Usage esc <hex-constant>
X#"command escape ": This command is used only on non-XENIX systems.
X#It specifies the equivalent character for the HOME key used
X#by XENIX versions of ecu to enter the commands being described
X#by this help function.  The default setting for this command escape
X#s '%'.  To change the value, you must enter the hexadecimal value
X#of the desired character; it must be in the range 01 through 7F.
X#You may use the 'ax' command to aid in converting an ASCII
X#character to the appropriate hexadecimal value.
X#--------------------------------------------------------------------
X%fasi
XUsage: fasi [reset]
X
XThis command displays or resets the FAS/i tty driver statistics.
XThe command is found only in versions compiled for FAS/i support.
X#--------------------------------------------------------------------
X%fi
XUsage: fi [<filename>]
X
X"file insert": This command causes file characters to be inserted into
Xthe transmit data stream as though they had been entered at the
Xkeyboard.  If <filename> is not entered on the command line, a prompt
Xfor the filename is made.  Once the filename has been entered and file
Xhas been opened, you are asked whether the file should be transmitted at
Xfull speed, by "echo pacing" or by a single line at a time.  You may
Xalso append an 'f', 'e' or 's' argument to the command line.  If your
Xremote can tolerate it, full speed transmission is the fastest.
XPressing the interrupt key (DEL) stops a full speed transmission.  By
Xspecifying echo pacing, it is possible to increase the likelihood of
Xproper receipt.  Pressing the interrupt key (DEL) stops an echo paced
Xtransmission.  As a last resort, if echo pacing is not working for you,
X(i.e., you are using the command in an environment where the remote does
Xnot echo your characters), use single line at a time transmission.  You
Xmust press the space key to initiate sending each line.  Pressing 'ESC'
Xor 's' stops the transfer.
X#--------------------------------------------------------------------
X%fkey
XUsage: fkey [<keyset_name>]
X
XThis command allows the mapping of function keys F1-F12, PgUp, PgDn, End
Xand Ins and the cursor up, down, left and right keys to emit a desired
Xsequence of characters when a function key is pressed.  <keyset_name>
Xspecifies which key set in ~/.ecu/keys is to be selected: Sample entry
Xin ~/.ecu/keys:
X
Xhayes
X	F1:escape:+ + +
X	F2:autoans:A T S 0 = 1 cr
X	F3:dial:A T D T
Xbbs
X	F1:cancel:^K
X	F2:yes:y cr
X
XIf a keyset_name matches a logical dial directory name, it is loaded
Xwhen the number is dialed.
X#--------------------------------------------------------------------
X%hangup
XUsage: hangup
X
XThis causes DTR to be momentarily interrupted, terminating any
Xoutstanding connection.  Your DCE (modem) must be able to drop carrier
Xupon loss of DTR.
X#--------------------------------------------------------------------
X%help
XUsage: help [<cmd-name>]
X
XIssuing this command with no argument displays a list of commands
Xfollowed by a request for a command for further information.
X#--------------------------------------------------------------------
X%llp
XUsage: llp
X
XThis command is a shorthand version of 'log /dev/lp'.
X/dev/lp must not be under the control of a print spooler.
X#--------------------------------------------------------------------
X%loff
XUsage: loff
X
XThis command is shorthand for 'log off'.  If session logging
Xis active, it is turned off.
X#--------------------------------------------------------------------
X%log
XUsage: log [-s] [-r] [ | off | filename ]
X       -s "scratch" previous file contents; otherwise append
X       -r "raw" logging; otherwise non-printable characters
X          other than tab and newline are omitted from the log
X
XThis command controls session logging; issuing the command with no
Xargument causes the status of session logging to be displayed.  The
Xspecial argument 'off' causes active logging to be terminated.  Other
Xargument values cause logging to start using the argument as a filename.
XIssuing a 'log filename' command when logging is already active causes
Xthe previous file to be closed and the new file to be opened.  Switches
Xare meaningful only when used in conjunction with a filename to start
Xlogging.
X#--------------------------------------------------------------------
X%nl
XUsage: nl
X
XDisplay the current setting of CR/LF mapping.  For more information,
Xrefer to the 'nlin' and 'nlout' command descriptions.
X#--------------------------------------------------------------------
X%nlin
XUsage: nlin [<y-n>]
X
XThis command controls whether or not a newline (NL/LF) character is sent
Xto the screen upon receipt of a carriage return (CR) from the remote
Xsystem.  Most remote computers supply a NL after CR.  When communicating
Xwith another terminal in a "teletype conversation", this is generally
Xnot the case (see also the 'duplex' command).
X
XIssuing the command without <y-n> causes the current setting to be
Xdisplayed.  The format of <y-n> is flexible: 'y' or '1' enables
Xappending NL to CR, 'n' or '0' causes the feature to be disabled.
X#--------------------------------------------------------------------
X%nlout
XUsage: nlout [<y-n>]
X
XThis command controls whether or not a newline (NL/LF) character is sent
Xto the remote system upon transmission of a carriage return (CR) entered
Xby the keyboard.  Most remote computers do not require (indeed
X"dislike") a NL after CR.  When communicating with another terminal in a
X"teletype conversation", this is generally not the case (see also the
X'duplex' command).
X
XIssuing the command without <y-n> causes the current setting to be
Xdisplayed.  The format of <y-n> is flexible: 'y' or '1' enables
Xappending NL to CR, 'n' or '0' causes the feature to be disabled.
X#--------------------------------------------------------------------
X%parity
SHAR_EOF
true || echo 'restore of help/ecuhelp.src failed'
fi
echo 'End of ecu310 part 19'
echo 'File help/ecuhelp.src is continued in part 20'
echo 20 > _shar_seq_.tmp
exit 0
--------------------------------------------------------------------
Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
Hacker Extraordinaire  d' async PADs,  pods,  proteins and protocols

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.


