home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume16
/
ecu3
/
part15
< prev
next >
Wrap
Internet Message Format
|
1991-01-06
|
57KB
From: wht@n4hgf.uucp (Warren Tucker)
Newsgroups: comp.sources.misc
Subject: v16i039: ECU async comm package rev 3.0, Part15/35
Message-ID: <1991Jan6.052220.28027@sparky.IMD.Sterling.COM>
Date: 6 Jan 91 05:22:20 GMT
Approved: kent@sparky.imd.sterling.com
X-Checksum-Snefru: 03d6364f 1dbdfcce 75671310 11a90ed2
Submitted-by: wht@n4hgf.uucp (Warren Tucker)
Posting-number: Volume 16, Issue 39
Archive-name: ecu3/part15
---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 15 of ecu3
if touch 2>&1 | fgrep 'amc' > /dev/null
then TOUCH=touch
else TOUCH=true
fi
# ============= regexp.c ==============
echo 'x - extracting regexp.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'regexp.c' &&
X/*+-------------------------------------------------------------------------
X regexp.c -- regular expression functions made sane
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X#include "stdio_lint.h"
X#include "lint_args.h"
X#include "ecuerror.h"
X#include "esd.h"
X#include "var.h"
X#include <setjmp.h>
X
X#define CBRA 2
X#define CCHR 4
X#define CDOT 8
X#define CCL 12
X#define CDOL 20
X#define CCEOF 22
X#define CKET 24
X#define CBACK 36
X
X#define STAR 01
X#define RNGE 03
X
X#define NBRA 9
X
X#define PLACE(c) ep[c >> 3] |= bittab[c & 07]
X#define ISTHERE(c) (ep[c >> 3] & bittab[c & 07])
X
Xvoid getrnge();
X
Xextern int proctrace;
Xextern int proc_level;
X
Xchar *braslist[NBRA];
Xchar *braelist[NBRA];
Xint nbra,ebra;
Xchar *match_start,*match_end,*locs;
Xint sed;
Xint nodelim;
Xint circf;
Xint low;
Xint size;
X
Xchar bittab[] = { 1,2,4,8,16,32,64,128 };
X
Xjmp_buf compile_error_jmpbuf;
X
Xvoid
Xcompile(pattern,ep,endbuf,seof)
Xregister char *ep;
Xchar *pattern,*endbuf;
X{
X register char *sp = pattern;
X register c;
X register eof = seof;
X char *lastep = pattern;
X int cclcnt;
X char bracket[NBRA],*bracketp;
X int closed;
X char neg;
X int lc;
X int i,cflg;
X
X lastep = 0;
X if((c = *sp++) == eof || c == '\n')
X {
X if(c == '\n')
X {
X --sp;
X nodelim = 1;
X }
X if(*ep == 0 && !sed)
X longjmp(compile_error_jmpbuf,41);
X return;
X }
X bracketp = bracket;
X circf = closed = nbra = ebra = 0;
X if(c == '^')
X circf++;
X else
X --sp;
X while(1)
X {
X if(ep >= endbuf)
X longjmp(compile_error_jmpbuf,50);
X c = *sp++;
X if(c != '*' && ((c != '\\') || (*sp != '{')))
X lastep = ep;
X if(c == eof)
X {
X *ep++ = CCEOF;
X return;
X }
X switch(c)
X {
X
X case '.':
X *ep++ = CDOT;
X continue;
X
X case '\n':
X if(!sed)
X {
X --sp;
X *ep++ = CCEOF;
X nodelim = 1;
X return;
X }
X else longjmp(compile_error_jmpbuf,36);
X case '*':
X if(lastep==0 || *lastep==CBRA || *lastep==CKET)
X goto defchar;
X *lastep |= STAR;
X continue;
X
X case '$':
X if(*sp != eof && *sp != '\n')
X goto defchar;
X *ep++ = CDOL;
X continue;
X
X case '[':
X if(&ep[17] >= endbuf)
X longjmp(compile_error_jmpbuf,50);
X
X *ep++ = CCL;
X lc = 0;
X for(i = 0; i < 16; i++)
X ep[i] = 0;
X
X neg = 0;
X if((c = *sp++) == '^')
X {
X neg = 1;
X c = *sp++;
X }
X
X do
X {
X if(c == '\0' || c == '\n')
X longjmp(compile_error_jmpbuf,49);
X if(c == '-' && lc != 0)
X {
X if((c = *sp++) == ']')
X {
X PLACE('-');
X break;
X }
X while(lc < c)
X {
X PLACE(lc);
X lc++;
X }
X }
X if(c == '\\')
X {
X switch(c = *sp++)
X {
X case 'n':
X c = '\n';
X break;
X }
X }
X lc = c;
X PLACE(c);
X } while((c = *sp++) != ']');
X if(neg)
X {
X for(cclcnt = 0; cclcnt < 16; cclcnt++)
X ep[cclcnt] ^= -1;
X ep[0] &= 0376;
X }
X
X ep += 16;
X
X continue;
X
X case '\\':
X switch(c = *sp++)
X {
X
X case '(':
X if(nbra >= NBRA)
X longjmp(compile_error_jmpbuf,43);
X *bracketp++ = nbra;
X *ep++ = CBRA;
X *ep++ = nbra++;
X continue;
X
X case ')':
X if(bracketp <= bracket || ++ebra != nbra)
X longjmp(compile_error_jmpbuf,42);
X *ep++ = CKET;
X *ep++ = *--bracketp;
X closed++;
X continue;
X
X case '{':
X if(lastep == (char *) (0))
X goto defchar;
X *lastep |= RNGE;
X cflg = 0;
Xnlim:
X c = *sp++;
X i = 0;
X do
X {
X if('0' <= c && c <= '9')
X i = 10 * i + c - '0';
X else
X longjmp(compile_error_jmpbuf,16);
X } while(((c = *sp++) != '\\') && (c != ','));
X if(i >= 255)
X longjmp(compile_error_jmpbuf,11);
X *ep++ = i;
X if(c == ',')
X {
X if(cflg++)
X longjmp(compile_error_jmpbuf,44);
X if((c = *sp++) == '\\')
X *ep++ = 255;
X else
X {
X --sp;
X goto nlim;
X /* get 2'nd number */
X }
X }
X if(*sp++ != '}')
X longjmp(compile_error_jmpbuf,45);
X if(!cflg) /* one number */
X *ep++ = i;
X else if((ep[-1] & 0377) < (ep[-2] & 0377))
X longjmp(compile_error_jmpbuf,46);
X continue;
X
X case '\n':
X longjmp(compile_error_jmpbuf,36);
X
X case 'n':
X c = '\n';
X goto defchar;
X
X default:
X if(c >= '1' && c <= '9')
X {
X if((c -= '1') >= closed)
X longjmp(compile_error_jmpbuf,25);
X *ep++ = CBACK;
X *ep++ = c;
X continue;
X }
X }
X /* Drop through to default to use \ to turn off special chars */
X
Xdefchar:
X default:
X lastep = ep;
X *ep++ = CCHR;
X *ep++ = c;
X }
X }
X}
X
Xstep(p1,p2)
Xregister char *p1,*p2;
X{
X register c;
X
X if(circf)
X {
X match_start = p1;
X return(advance(p1,p2));
X }
X /* fast check for first character */
X if(*p2==CCHR)
X {
X c = p2[1];
X do
X {
X if(*p1 != c)
X continue;
X if(advance(p1,p2))
X {
X match_start = p1;
X return(1);
X }
X } while(*p1++);
X return(0);
X }
X /* regular algorithm */
X do
X {
X if(advance(p1,p2))
X {
X match_start = p1;
X return(1);
X }
X } while(*p1++);
X return(0);
X}
X
Xadvance(lp,ep)
Xregister char *lp,*ep;
X{
X register char *curlp;
X char c;
X char *bbeg;
X int ct;
X
X while(1)
X switch(*ep++)
X {
X
X case CCHR:
X if(*ep++ == *lp++)
X continue;
X return(0);
X
X case CDOT:
X if(*lp++)
X continue;
X return(0);
X
X case CDOL:
X if(*lp==0)
X continue;
X return(0);
X
X case CCEOF:
X match_end = lp;
X return(1);
X
X case CCL:
X c = *lp++ & 0177;
X if(ISTHERE(c))
X {
X ep += 16;
X continue;
X }
X return(0);
X case CBRA:
X braslist[*ep++] = lp;
X continue;
X
X case CKET:
X braelist[*ep++] = lp;
X continue;
X
X case CCHR|RNGE:
X c = *ep++;
X getrnge(ep);
X while(low--)
X if(*lp++ != c)
X return(0);
X curlp = lp;
X while(size--)
X if(*lp++ != c)
X break;
X if(size < 0)
X lp++;
X ep += 2;
X goto star;
X
X case CDOT|RNGE:
X getrnge(ep);
X while(low--)
X if(*lp++ == '\0')
X return(0);
X curlp = lp;
X while(size--)
X if(*lp++ == '\0')
X break;
X if(size < 0)
X lp++;
X ep += 2;
X goto star;
X
X case CCL|RNGE:
X getrnge(ep + 16);
X while(low--)
X {
X c = *lp++ & 0177;
X if(!ISTHERE(c))
X return(0);
X }
X curlp = lp;
X while(size--)
X {
X c = *lp++ & 0177;
X if(!ISTHERE(c))
X break;
X }
X if(size < 0)
X lp++;
X ep += 18; /* 16 + 2 */
X goto star;
X
X case CBACK:
X bbeg = braslist[*ep];
X ct = braelist[*ep++] - bbeg;
X
X if(ecmp(bbeg,lp,ct))
X {
X lp += ct;
X continue;
X }
X return(0);
X
X case CBACK|STAR:
X bbeg = braslist[*ep];
X ct = braelist[*ep++] - bbeg;
X curlp = lp;
X while(ecmp(bbeg,lp,ct))
X lp += ct;
X
X while(lp >= curlp)
X {
X if(advance(lp,ep)) return(1);
X lp -= ct;
X }
X return(0);
X
X
X case CDOT|STAR:
X curlp = lp;
X while(*lp++);
X goto star;
X
X case CCHR|STAR:
X curlp = lp;
X while(*lp++ == *ep);
X ep++;
X goto star;
X
X case CCL|STAR:
X curlp = lp;
X do
X {
X c = *lp++ & 0177;
X } while(ISTHERE(c));
X ep += 16;
X goto star;
X
Xstar:
X do
X {
X if(--lp == locs)
X break;
X if(advance(lp,ep))
X return(1);
X } while(lp > curlp);
X return(0);
X
X }
X}
X
Xvoid
Xgetrnge(regexp)
Xregister char *regexp;
X{
X low = *regexp++ & 0377;
X size = ((*regexp & 0377) == 255) ? 20000 : (*regexp & 0377) - low;
X}
X
Xecmp(a,b,count)
Xregister char *a,*b;
Xregister count;
X{
X while(count--)
X if(*a++ != *b++)
X return(0);
X return(1);
X}
X
X/*+-------------------------------------------------------------------------
X itmp = regexp_compile(regexp,cmpbuf,cmpbuf_size,emsg)
X
Xreturns 0 if no compile error,
Xelse error occurred (*emsg points to error message text)
X--------------------------------------------------------------------------*/
Xint
Xregexp_compile(regexp,cmpbuf,cmpbuf_size,emsg)
Xchar *regexp;
Xchar *cmpbuf;
Xint cmpbuf_size;
Xchar **emsg;
X{
X register int itmp;
X static char errm[40];
X
X if(itmp = setjmp(compile_error_jmpbuf))
X {
X switch(itmp)
X {
X case 11:
X *emsg = "Range endpoint too large";
X break;
X case 16:
X *emsg = "Bad number";
X break;
X case 25:
X *emsg = "\"\\digit\" out of range";
X break;
X case 36:
X *emsg = "Illegal or missing delimiter";
X break;
X case 41:
X *emsg = "No previous regular expression";
X break;
X case 42:
X *emsg = "More \\)'s than \\('s in regular expression";
X break;
X case 43:
X *emsg = "More \\('s than \\)'s in regular expression";
X break;
X case 44:
X *emsg = "More than 2 numbers in \\{ \\}";
X break;
X case 45:
X *emsg = "} expected after \\";
X break;
X case 46:
X *emsg = "First number exceeds second in \\{ \\}";
X break;
X case 49:
X *emsg = "[] imbalance";
X break;
X case 50:
X *emsg = "Regular expression too complex";
X break;
X default:
X sprintf(errm,"Unknown regexp compile error %d",itmp);
X *emsg = errm;
X break;
X }
X return(itmp);
X }
X
X compile(regexp,cmpbuf,cmpbuf + cmpbuf_size,0);
X return(0);
X} /* end of regexp_compile */
X
X/*+-------------------------------------------------------------------------
X regexp_scan(cmpbuf,str_to_search,&match,&matchlen)
Xreturn 1 if string match found, else 0
Xif string matches, match receives pointer to first byte, matchlen = length
Xof matching string
X--------------------------------------------------------------------------*/
Xregexp_scan(cmpbuf,str_to_search,match,matchlen)
Xchar *cmpbuf;
Xchar *str_to_search;
Xchar **match;
Xint *matchlen;
X{
X register int itmp = step(str_to_search,cmpbuf);
X if(itmp)
X {
X *match = match_start;
X *matchlen = (int)(match_end - match_start);
X }
X return(itmp);
X} /* end of regexp_scan */
X
X#define CMPBUF_SIZE 256
Xchar cmpbuf[CMPBUF_SIZE];
X
X/*+-------------------------------------------------------------------------
X regexp_operation(match_str,regexp_str,rtn_value)
X--------------------------------------------------------------------------*/
Xint
Xregexp_operation(match_str,regexp_str,rtn_value)
Xchar *match_str;
Xchar *regexp_str;
Xlong *rtn_value;
X{
Xchar *emsg;
Xchar *match;
Xint matchlen;
X
X if(regexp_compile(regexp_str,cmpbuf,sizeof(cmpbuf),&emsg))
X {
X pprintf("compile 1 error: %s\n",emsg);
X return(eFATAL_ALREADY);
X }
X
X if(regexp_scan(cmpbuf,match_str,&match,&matchlen))
X {
X *rtn_value = (long)(match - match_str);
X iv[0] = (long)matchlen;
X if(proc_level && proctrace)
X pprintf("%match set $i00 = %ld\n",iv[0]);
X }
X else
X *rtn_value = -1;
X
X return(0);
X} /* end of regexp_operation */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of regexp.c */
SHAR_EOF
$TOUCH -am 1224224490 'regexp.c' &&
chmod 0644 regexp.c ||
echo 'restore of regexp.c failed'
Wc_c="`wc -c < 'regexp.c'`"
test 10229 -eq "$Wc_c" ||
echo 'regexp.c: original size 10229, current size' "$Wc_c"
# ============= sysdep.c ==============
echo 'x - extracting sysdep.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'sysdep.c' &&
X/*+-------------------------------------------------------------------------
X sysdep.c -- system dependency aid
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X
Xchar *defines[] =
X{
X#if defined(M_UNIX)
X "M_UNIX",
X#undef M_XENIX /* <---------------------- */
X#endif
X#if defined(M_XENIX)
X "M_XENIX",
X#endif
X#if defined(M_SYS5)
X "M_SYS5",
X#endif
X#if defined(M_I386)
X "M_I386",
X#endif
X#if defined(M_I286)
X "M_I286",
X#endif
X#if defined(M_I186)
X "M_I186",
X#endif
X#if defined(M_I8086)
X "M_I8086",
X#endif
X#if defined(M_I86)
X "M_I86",
X#endif
X#if defined(pyr)
X "pyr",
X#endif
X#if defined(i386)
X "i386",
X#endif
X#if defined(sun)
X "sun",
X#endif
X#if defined(sun2)
X "sun2,
X#endif
X#if defined(sun3)
X "sun3",
X#endif
X#if defined(sun4)
X "sun4",
X#endif
X#if defined(vax)
X "vax",
X#endif
X#if defined(pdp11)
X "pdp11",
X#endif
X#if defined(M_INTERNAT)
X "M_INTERNAT",
X#endif
X (char *)0
X};
X
X/*+-------------------------------------------------------------------------
X pos_in_ztermed_list(test,list)
X--------------------------------------------------------------------------*/
Xint
Xpos_in_ztermed_list(test,list)
Xchar *test;
Xchar **list;
X{
X register int itmp = 0;
X
X while(*list)
X {
X if(!strcmp(*list++,test))
X return(itmp);
X itmp++;
X }
X return(-1);
X} /* end of pos_in_ztermed_list */
X
X/*+-------------------------------------------------------------------------
X main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister int iargv;
Xchar **cpptr;
X
X for(iargv = 1; iargv < argc; iargv++)
X {
X if(*argv[iargv] == '=')
X {
X if(pos_in_ztermed_list(argv[iargv] + 1,defines) >= 0)
X break;
X }
X }
X if(iargv == argc)
X {
X fprintf(stderr,"\n\nsysdep: no system match\n\n");
X fprintf(stderr,"On this system, I recognize:\n");
X cpptr = defines;
X while(*cpptr)
X fprintf(stderr," %s\n",*cpptr++);
X fputs("\n",stderr);
X exit(1);
X }
X
X while(++iargv <argc)
X {
X if(*argv[iargv] == '=')
X break;
X fputs(argv[iargv],stdout);
X fputc(' ',stdout);
X }
X fputs("\n",stdout);
X exit(0);
X} /* end of main */
X
SHAR_EOF
$TOUCH -am 1224224490 'sysdep.c' &&
chmod 0644 sysdep.c ||
echo 'restore of sysdep.c failed'
Wc_c="`wc -c < 'sysdep.c'`"
test 2206 -eq "$Wc_c" ||
echo 'sysdep.c: original size 2206, current size' "$Wc_c"
# ============= utmpstat.c ==============
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/*: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 "ecuhangup.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 hangup(HANGUP_LINE_OPEN_ERROR);
X }
X
X while(read(ufd,(char *)&last_utmp,sizeof(last_utmp)) > 0)
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 defined(M_UNIX)
X if((!strncmp(namecopy,"uugetty",7) ||
X !strncmp(namecopy,"getty",5)) &&
X (ulindex(idcopy,line + 8) == (strlen(idcopy) - 2)))
X {
X if(itmp = line_locked(line))
X status = US_DIALOUT;
X else
X status = US_LOGIN;
X break;
X }
X else if((!strcmpi(last_utmp.ut_line,line + 5)) &&
X (!kill(last_utmp.ut_pid,0) || (errno != ESRCH)))
X {
X status = US_LOGGEDIN;
X break;
X }
X#else
X if((!strcmpi(last_utmp.ut_line,line + 5)) &&
X (!kill(last_utmp.ut_pid,0) || (errno != ESRCH)))
X {
X if(!strcmp(last_utmp.ut_name,"LOGIN"))
X status = US_LOGIN;
X else if(!strcmp(last_utmp.ut_name,"DIALOUT"))
X status = US_DIALOUT;
X else
X status = US_LOGGEDIN;
X break;
X }
X#endif
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 1224224490 'utmpstat.c' &&
chmod 0644 utmpstat.c ||
echo 'restore of utmpstat.c failed'
Wc_c="`wc -c < 'utmpstat.c'`"
test 3906 -eq "$Wc_c" ||
echo 'utmpstat.c: original size 3906, current size' "$Wc_c"
# ============= var.c ==============
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/*: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] = make_esd(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)
Xtrusts caller not to exceed 5120 max size
X--------------------------------------------------------------------------*/
Xbuild_mkvs_primitive(name,length)
Xchar *name;
Xint length;
X{
XMKV *mkv;
XESD *text;
X
X if((text = make_esd((int)length)) == (ESD *)0)
X return(eNoMemory);
X
X if((mkv = alloc_MKV(name)) == (MKV *)0)
X {
X free_esd(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 > 5120)
X {
X pprintf("max string size is 5120 ... cannot make %lu byte string\n",
X 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 free_esd(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 1224224490 'var.c' &&
chmod 0644 var.c ||
echo 'restore of var.c failed'
Wc_c="`wc -c < 'var.c'`"
test 10027 -eq "$Wc_c" ||
echo 'var.c: original size 10027, current size' "$Wc_c"
# ============= dialprog.h ==============
echo 'x - extracting dialprog.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'dialprog.h' &&
X/*+-------------------------------------------------------------------------
X dialprog.h - HDB UUCP dialer program return code error codes
X wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:39-wht@n4hgf-ecu3.00-flush old edit history */
X
X#define RC_FAIL 0x80 /* 1 = failed to connect */
X#define RCE_NULL 0 /* general purpose or unknown error code */
X#define RCE_INUSE 1 /* line in use */
X#define RCE_SIG 2 /* signal aborted dialer */
X#define RCE_ARGS 3 /* invalid arguments */
X#define RCE_PHNO 4 /* invalid phone number */
X#define RCE_SPEED 5 /* invalid baud rate -or- bad connect baud */
X#define RCE_OPEN 6 /* can't open line */
X#define RCE_IOCTL 7 /* ioctl error */
X#define RCE_TIMOUT 8 /* timeout */
X#define RCE_NOTONE 9 /* no dial tone */
X#define RCE_BUSY 13 /* phone is busy */
X#define RCE_NOCARR 14 /* no carrier */
X#define RCE_ANSWER 15 /* no answer */
X
X/* code writing aid */
X#ifdef NEVER
X case RCE_NULL: /* general purpose or unknown error code */
X case RCE_INUSE: /* line in use */
X case RCE_SIG: /* signal aborted dialer */
X case RCE_ARGS: /* invalid arguments */
X case RCE_PHNO: /* invalid phone number */
X case RCE_SPEED: /* invalid baud rate -or- bad connect baud */
X case RCE_OPEN: /* can't open line */
X case RCE_IOCTL: /* ioctl error */
X case RCE_TIMOUT: /* timeout */
X case RCE_NOTONE: /* no dial tone */
X case RCE_BUSY: /* phone is busy */
X case RCE_NOCARR: /* no carrier */
X case RCE_ANSWER: /* no answer */
X#endif
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of dialprog.h */
SHAR_EOF
$TOUCH -am 1224222690 'dialprog.h' &&
chmod 0644 dialprog.h ||
echo 'restore of dialprog.h failed'
Wc_c="`wc -c < 'dialprog.h'`"
test 1616 -eq "$Wc_c" ||
echo 'dialprog.h: original size 1616, current size' "$Wc_c"
# ============= dlent.h ==============
echo 'x - extracting dlent.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'dlent.h' &&
X/*+-------------------------------------------------------------------------
X dlent.h - HDB UUCP Dialers file entry (a la pwent.h)
X wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:39-wht@n4hgf-ecu3.00-flush old edit history */
X
Xstruct dlent
X{
X char *name; /* Dialer name */
X char *tlate; /* translate string */
X char *script; /* expect-respond script */
X};
X
Xstruct dlent *getdlent();
Xvoid enddlent();
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of dlent.h */
SHAR_EOF
$TOUCH -am 1224222690 'dlent.h' &&
chmod 0644 dlent.h ||
echo 'restore of dlent.h failed'
Wc_c="`wc -c < 'dlent.h'`"
test 545 -eq "$Wc_c" ||
echo 'dlent.h: original size 545, current size' "$Wc_c"
# ============= dvent.h ==============
echo 'x - extracting dvent.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'dvent.h' &&
X/*+-------------------------------------------------------------------------
X dvent.h - HDB UUCP Devices file entry (a la pwent.h)
X wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:39-wht@n4hgf-ecu3.00-flush old edit history */
X
Xstruct dvent
X{
X char *type; /* ACU or Direct */
X char *line; /* tty name "ttyxx"-style */
X char *dialer; /* "801" dialer line */
X uint low_baud; /* lowest baud rate */
X uint high_baud; /* highest baud rate */
X char *dialprog; /* dialer program */
X};
X
Xstruct dvent *getdvent();
Xstruct dvent *getdvbaud();
Xstruct dvent *getdvline();
Xvoid enddvent();
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of dvent.h */
SHAR_EOF
$TOUCH -am 1224222690 'dvent.h' &&
chmod 0644 dvent.h ||
echo 'restore of dvent.h failed'
Wc_c="`wc -c < 'dvent.h'`"
test 722 -eq "$Wc_c" ||
echo 'dvent.h: original size 722, current size' "$Wc_c"
# ============= ecu.h ==============
echo 'x - extracting ecu.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecu.h' &&
X/*+-----------------------------------------------------------------------
X ecu.h -- TuckerWare Extended Calling Unit
X wht@n4hgf.Mt-Park.GA.US
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:39-wht@n4hgf-ecu3.00-flush old edit history */
X
X#define ECULIBDIR "/usr/local/lib/ecu"
X
X#if defined(__STDC__) /* sigh ... malloc and such types */
X#define VTYPE void
X#else
X#define VTYPE char
X#endif
X
X#if defined(M_UNIX)
X#undef M_XENIX /* we don't want this defined in UNIX world */
X#undef NO_SELECT /* UNIX select(S) works */
X#endif
X
X#if defined(M_I286) && !defined(NO_SELECT)
X#define NO_SELECT /* the last 286 XENIX I saw (2.2.1) had no select */
X#endif
X
X#ifndef ECULIBDIR
X#define ECULIBDIR "/usr/lib/ecu"
X#endif
X
X#if !defined(STDIO_H_INCLUDED)
X#include <stdio.h>
X#endif
X#include <signal.h>
X#include <ctype.h>
X#include <sys/types.h>
X#include <errno.h>
X#include <sys/timeb.h>
X
X#include <memory.h>
X#include <sys/stat.h>
X#include <string.h>
X#include <fcntl.h>
X#if !defined(OMIT_TERMIO_REFERENCES)
X#include <termio.h>
X#endif
X
X#include "ecuhangup.h"
X#include "ecushm.h"
X
X/* already in ecushm.h */
X/* #if !defined(ushort) */
X/* #define ushort unsigned short */
X/* #endif */
X/* #if !defined(uchar) */
X/* #define uchar unsigned char */
X/* #endif */
X/* #if !defined(uint) */
X/* #define uint unsigned int */
X/* #endif */
X/* #if !defined(ulong) */
X/* #define ulong unsigned long */
X/* #endif */
X
X#define MALLOC_3X
X#if defined(MALLOC_3X)
X#include <malloc.h>
X#endif
X
X/* for better source line utilization, frequent use of 'fprintf' and 'stderr'
X warrants the following */
X#define pf printf
X#define ff fprintf
X#define se stderr
X#define so stdout
X
X#define DEFAULT_BAUD_RATE 2400
X#define DEFAULT_PARITY 0 /* 0=none, else 'e' or 'o' */
X#define TTYIN 0
X#define TTYOUT 1 /* ditto tty output */
X#define TTYERR 2 /* ditty tty output error channel */
X
X/* xbell codes */
X#if defined(M_XENIX) || defined(M_UNIX)
X#define XBELL_DONE 1 /* octaves or morse 'd' */
X#define XBELL_ATTENTION 2 /* morse .-.-.- ATTENTION */
X#define XBELL_C 3 /* morse -.-. C */
X#define XBELL_3T 4 /* --- really 'o' */
X#endif
X
X/* lopen() and related routines error codes */
X#define LOPEN_INVALID -1 /* for invalid tty name */
X#define LOPEN_UNKPID -2 /* unknown pid using line */
X#define LOPEN_LCKERR -3 /* lock file open error */
X#define LOPEN_NODEV -4 /* device does not exist */
X#define LOPEN_OPNFAIL -5 /* could not open line */
X#define LOPEN_ALREADY -6 /* line already open */
X#define LOPEN_ENABLED -7 /* line enabled for login */
X#define LOPEN_ENABLED_IN_USE -8 /* line in use by incoming login */
X#define LOPEN_DIALOUT_IN_USE -9 /* line in use by another dial out */
X#define LOPEN_NOPTY -10 /* pty not supported */
X
Xextern int errno;
Xextern char *sys_errlist[];
Xextern int sys_nerr;
X
X#if defined(DECLARE_LINEVARS_PUBLIC)
Xchar LLCKname[128]; /* lock file name */
X#if !defined(OMIT_TERMIO_REFERENCES)
Xstruct termio Ltermio; /* attributes for the line to remote */
X#endif
Xuchar Lmodem_sreg[20]; /* allow for more later */
X#else
Xextern char LLCKname[];
X#if !defined(OMIT_TERMIO_REFERENCES)
Xextern struct termio Ltermio;
X#endif
Xextern uchar Lmodem_sreg[];
X#endif
X/* setcolor variables - see setcolor() */
Xextern ulong colors_current;
Xextern ulong colors_normal;
Xextern ulong colors_success;
Xextern ulong colors_alert;
Xextern ulong colors_error;
Xextern ulong colors_notify;
X
Xtypedef struct lrwt /* param to lgets_timeout in eculine.c */
X{
X ulong to1; /* timeout for 1st character (granularity 20) */
X ulong to2; /* timeout for each next char (granularity 20) */
X int raw_flag; /* !=0, rtn full buffer, ==0, rtn filtered hayes result */
X char *buffer; /* buffer to fill */
X int bufsize; /* size of buffer */
X int count; /* from proc, count rcvd */
X char *delim; /* ending string for lgets_timeout_or_delim */
X int echo; /* echo incdoming chars to screen */
X} LRWT;
X
X#include "stdio_lint.h"
X#include "lint_args.h"
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
$TOUCH -am 1224222690 'ecu.h' &&
chmod 0644 ecu.h ||
echo 'restore of ecu.h failed'
Wc_c="`wc -c < 'ecu.h'`"
test 4010 -eq "$Wc_c" ||
echo 'ecu.h: original size 4010, current size' "$Wc_c"
# ============= ecucmd.h ==============
echo 'x - extracting ecucmd.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecucmd.h' &&
X/*+-------------------------------------------------------------------------
X ecucmd.h -- command definitions
X wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X/* interactive command tokens */
X
X#define CTax 1
X#define CTbaud 2
X#define CTbn 3
X#define CTbreak 4
X#define CTcd 5
X#define CTclrx 6
X#define CTda 7
X#define CTdial 8
X#define CTdo 9
X#define CTduplex 10
X#define CTexit 11
X#define CTfi 12
X#define CTfkey 13
X#define CTgetf 14
X#define CThangup 15
X#define CThelp 16
X#define CTllp 17
X#define CTloff 18
X#define CTlog 19
X#define CTnl 21
X#define CTnlin 22
X#define CTnlout 23
X#define CToa 24
X#define CTparity 25
X#define CTpcmd 26
X#define CTpid 27
X#define CTplog 28
X#define CTptrace 29
X#define CTputf 30
X#define CTpwd 31
X#define CTredial 32
X#define CTrev 33
X#define CTrk 34
X#define CTrs 35
X#define CTrtscts 36
X#define CTrx 37
X#define CTry 38
X#define CTrz 39
X#define CTsdname 40
X#define CTsgr 41
X#define CTsk 43
X#define CTss 44
X#define CTstat 45
X#define CTsx 46
X#define CTsy 47
X#define CTsz 48
X#define CTtime 50
X#define CTts 51
X#define CTtty 52
X#define CTxa 53
X#define CTxlog 54
X#define CTxon 55
X#if defined(ESIO_IN_USE)
X#define CTesio 56
X#endif
X
X#define CTdummy1 120
X#define CTdummy2 121
X#define CTdummy3 122
X#define CTdummy4 123
X
X#define TOKEN_QUAN 128 /* for help package */
X
Xtypedef int (*PFI)();
X
X#if defined(HELPGEN)
X#define Z {;}
X#else
X#define Z ;
X#endif
X
Xint pcmd_baud() Z
Xint pcmd_break() Z
Xint pcmd_cd() Z
Xint pcmd_clrx() Z
Xint pcmd_cls() Z
Xint pcmd_color() Z
Xint pcmd_continue() Z
Xint pcmd_cursor() Z
Xint pcmd_delline() Z
Xint pcmd_dial() Z
Xint pcmd_do() Z
Xint pcmd_duplex() Z
Xint pcmd_echo() Z
Xint pcmd_eeol() Z
Xint pcmd_else() Z
X#if defined(ESIO_IN_USE)
Xint pcmd_esio() Z
X#endif
Xint pcmd_exit() Z
Xint pcmd_expresp() Z
Xint pcmd_getf() Z
Xint pcmd_fchmod() Z
Xint pcmd_fclose() Z
Xint pcmd_fgetc() Z
Xint pcmd_fgets() Z
Xint pcmd_fkey() Z
Xint pcmd_flush() Z
Xint pcmd_fopen() Z
Xint pcmd_fputc() Z
Xint pcmd_fputs() Z
Xint pcmd_fread() Z
Xint pcmd_fseek() Z
Xint pcmd_fdel() Z
Xint pcmd_fwrite() Z
Xint pcmd_gosub() Z
Xint pcmd_gosubb() Z
Xint pcmd_goto() Z
Xint pcmd_gotob() Z
Xint pcmd_hangup() Z
Xint pcmd_hexdump() Z
Xint pcmd_home() Z
Xint pcmd_icolor() Z
Xint pcmd_insline() Z
Xint pcmd_ifge() Z
Xint pcmd_ifgt() Z
Xint pcmd_ifi() Z
Xint pcmd_ifle() Z
Xint pcmd_iflt() Z
Xint pcmd_ifnz() Z
Xint pcmd_ifs() Z
Xint pcmd_ifz() Z
Xint pcmd_lbreak() Z
Xint pcmd_lgets() Z
Xint pcmd_logevent() Z
Xint pcmd_lookfor() Z
X/* int pcmd_mkdir() Z */
Xint pcmd_mkvar() Z
Xint pcmd_nap() Z
Xint pcmd_parity() Z
Xint pcmd_pclose() Z
Xint pcmd_plog() Z
Xint pcmd_popen() Z
Xint pcmd_prompt() Z
Xint pcmd_ptrace() Z
Xint pcmd_putf() Z
Xint pcmd_return() Z
Xint pcmd_rk() Z
Xint pcmd_rname() Z
Xint pcmd_rs() Z
Xint pcmd_rx() Z
Xint pcmd_ry() Z
Xint pcmd_rz() Z
Xint pcmd_scrdump() Z
Xint pcmd_send() Z
Xint pcmd_set() Z
Xint pcmd_sk() Z
Xint pcmd_ss() Z
Xint pcmd_sx() Z
Xint pcmd_sy() Z
Xint pcmd_system() Z
Xint pcmd_sz() Z
Xint pcmd_vidcolor() Z
Xint pcmd_vidnorm() Z
Xint pcmd_vidrev() Z
Xint pcmd_whilei() Z
Xint pcmd_whiles() Z
Xint pcmd_xon() Z
X
X/* command classification */
X#define ccG 1 /* general command */
X#define ccC 2 /* comm command */
X#define ccT 3 /* transfer command */
X#define ccP 4 /* procedure-related command */
X
Xtypedef struct p_cmd
X{
X char *cmd; /* command string */
X short min; /* min chars for match (0 if not interactive) */
X short token; /* command number (if interactive) */
X char *descr; /* command description (if interactive) */
X PFI proc; /* procedure cmd handler (or 0) */
X short cmdclass; /* cc{C,G,P,X} or 0 (for help processor) */
X} P_CMD;
X
X#if !defined(DECLARE_P_CMD)
X#if defined(NEED_P_CMD)
Xextern P_CMD icmd_cmds[];
X#endif
X#else
XP_CMD icmd_cmds[] =
X{
X { "ax", 2,CTax, "ascii char to hex/oct/dec", 0, ccG},
X { "baud", 2,CTbaud, "set/display line baud rate", pcmd_baud, ccC},
X { "bn", 2,CTbn, "all console event alarm", 0, ccG},
X { "break", 2,CTbreak, "send break to remote", pcmd_break, ccC},
X { "cd", 2,CTcd, "change current directory", pcmd_cd, ccG},
X { "clrx", 2,CTclrx, "simulate XON from remote", pcmd_clrx, ccC},
X { "cls", 0,0, "", pcmd_cls, 0 },
X { "color", 0,0, "", pcmd_color, 0 },
X { "continue",0,0, "", pcmd_continue,0 },
X { "cursor", 0,0, "", pcmd_cursor, 0 },
X { "da", 2,CTda, "decimal to ascii char", 0, ccG},
X { "dial", 1,CTdial, "dial remote destination", pcmd_dial, ccC},
X { "delline",0,0, "", pcmd_delline,0 },
X { "do", 2,CTdo, "perform procedure", pcmd_do, ccP},
X { "duplex", 2,CTduplex, "set/display duplex", pcmd_duplex,ccC},
X { "echo", 0,0, "", pcmd_echo, 0 },
X { "eeol", 0,0, "", pcmd_eeol, 0 },
X { "else", 0,0, "", pcmd_else, 0 },
X#if defined(ESIO_IN_USE)
X { "esio", 2,CTesio, "ESIO/FAS driver control", pcmd_esio, ccC},
X#endif
X { "exit", 2,CTexit, "hang up, exit program", pcmd_exit, ccG},
X { "expresp",0,0, "", pcmd_expresp,0 },
X { "fchmod", 0,0, "", pcmd_fchmod, 0 },
X { "fclose", 0,0, "", pcmd_fclose, 0 },
X { "fdel", 0,0, "", pcmd_fdel, 0 },
X { "fgetc", 0,0, "", pcmd_fgetc, 0 },
X { "fgets", 0,0, "", pcmd_fgets, 0 },
X { "fi", 2,CTfi, "send text file to line", 0, ccG},
X { "fkey", 2,CTfkey, "function key definition", pcmd_fkey, ccG},
X { "flush", 0,0, "", pcmd_flush, 0 },
X { "fopen", 0,0, "", pcmd_fopen, 0 },
X { "fputc", 0,0, "", pcmd_fputc, 0 },
X { "fputs", 0,0, "", pcmd_fputs, 0 },
X { "fread", 0,0, "", pcmd_fread, 0 },
X { "fseek", 0,0, "", pcmd_fseek, 0 },
X { "fwrite", 0,0, "", pcmd_fwrite, 0 },
X { "getf", 0,0, "", pcmd_getf, 0 },
X { "gosub", 0,0, "", pcmd_gosub, 0 },
X { "gosubb", 0,0, "", pcmd_gosubb, 0 },
X { "goto", 0,0, "", pcmd_goto, 0 },
X { "gotob", 0,0, "", pcmd_gotob, 0 },
X { "hangup", 2,CThangup, "hang up modem", pcmd_hangup,ccC},
X { "help", 2,CThelp, "invoke help", 0, ccG},
X { "hexdump",0,0, "", pcmd_hexdump,0 },
X { "home", 0,0, "", pcmd_home, 0 },
X { "icolor", 0,0, "", pcmd_icolor, 0 },
X { "ifge", 0,0, "", pcmd_ifge, 0 },
X { "ifgt", 0,0, "", pcmd_ifgt, 0 },
X { "ifi", 0,0, "", pcmd_ifi, 0 },
X { "ifle", 0,0, "", pcmd_ifle, 0 },
X { "iflt", 0,0, "", pcmd_iflt, 0 },
X { "ifnz", 0,0, "", pcmd_ifnz, 0 },
X { "ifs", 0,0, "", pcmd_ifs, 0 },
X { "ifz", 0,0, "", pcmd_ifz, 0 },
X { "insline",0,0, "", pcmd_insline,0 },
X { "lbreak", 0,0, "", pcmd_lbreak, 0 },
X { "llp", 2,CTllp, "set session log to /dev/lp", 0, ccG},
X { "lgets", 0,0, "", pcmd_lgets, 0 },
X { "loff", 3,CTloff, "turn off session logging", 0, ccG},
X { "log", 3,CTlog, "session logging control", 0, ccG},
X { "logevent",0,0, "", pcmd_logevent,0 },
X { "lookfor",0,0, "", pcmd_lookfor,0 },
X/* { "mkdir", 3,CTmkdir, "mkdir <dirname>", pcmd_mkdir, ccG}, */
X { "mkvar", 0,0, "", pcmd_mkvar, 0 },
X { "nap", 0,0, "", pcmd_nap, 0 },
X { "nl", 2,CTnl, "display CR/LF mapping", 0, ccC},
X { "nlin", 3,CTnlin, "set receive CR/LF mapping", 0, ccC},
X { "nlout", 3,CTnlout, "set transmit CR/LF mapping", 0, ccC},
X { "oa", 2,CToa, "octal to ascii char", 0, ccG},
X { "parity", 3,CTparity, "set/display line parity", pcmd_parity, ccC},
X { "pclose", 0,0, "", pcmd_pclose, 0 },
X { "pcmd", 2,CTpcmd, "execute a procedure command", 0, ccP},
X { "pid", 2,CTpid, "display process ids", 0, ccG},
X { "plog", 2,CTplog, "control procedure logging", pcmd_plog, ccP},
X { "popen", 0,0, "", pcmd_popen, 0 },
X { "prompt", 0,0, "", pcmd_prompt, 0 },
X { "ptrace", 2,CTptrace, "control procedure trace", pcmd_ptrace,ccP},
X { "putf", 0,0, "", pcmd_putf, 0 },
X { "pwd", 2,CTpwd, "print working directory", 0, ccG},
X { "redial", 3,CTredial, "redial last number", 0, ccC},
X { "return", 0,0, "", pcmd_return, 0 },
X { "rev", 3,CTrev, "ecu revision/make date", 0, ccG},
X { "rk", 2,CTrk, "receive via C-Kermit", pcmd_rk, ccT},
X { "rname", 0,0, "", pcmd_rname, 0 },
X { "rs", 2,CTrs, "receive via SEAlink", pcmd_rs, ccT},
X { "rtscts", 3,CTrtscts, "control RTS/CTS flow control", 0, ccC},
X { "rx", 2,CTrx, "receive via XMODEM/CRC", pcmd_rx, ccT},
X { "ry", 2,CTry, "receive via YMODEM Batch", pcmd_ry, ccT},
X { "rz", 2,CTrz, "receive via ZMODEM/CRC32", pcmd_rz, ccT},
X { "scrdump",0,0, "", pcmd_scrdump,0 },
X { "sdname", 3,CTsdname, "select screen dump name", 0, ccC},
X { "send", 0,0, "", pcmd_send, 0 },
X { "set", 0,0, "", pcmd_set, 0 },
X { "sgr", 2,CTsgr, "send command/get response", 0, ccC},
X { "sk", 2,CTsk, "send via C-Kermit", pcmd_sk, ccT},
X { "ss", 2,CTss, "send via SEAlink", pcmd_ss, ccT},
X { "stat", 2,CTstat, "general status", 0, ccG},
X { "sx", 2,CTsx, "send via XMODEM/CRC", pcmd_sx, ccT},
X { "sy", 2,CTsy, "send via YMODEM Batch", pcmd_sy, ccT},
X { "system", 0,CTsy, "", pcmd_system, 0 },
X { "sz", 2,CTsz, "send via ZMODEM/CRC32", pcmd_sz, ccT},
X { "time", 2,CTtime, "time of day", 0, ccG},
X { "ts", 2,CTts, "termio display", 0, ccC},
X { "tty", 2,CTtty, "console tty name", 0, ccG},
X { "vidcolor",0,0, "", pcmd_vidcolor,0 },
X { "vidnorm",0,0, "", pcmd_vidnorm,0 },
X { "vidrev", 0,0, "", pcmd_vidrev, 0 },
X { "whilei", 0,0, "", pcmd_whilei, 0 },
X { "whiles", 0,0, "", pcmd_whiles, 0 },
X { "xa", 2,CTxa, "hex to ascii char", 0, ccG},
X { "xlog", 2,CTxlog, "protocol packet logging", 0, ccT},
X { "xon", 2,CTxon, "control xon/xoff flow control",pcmd_xon, ccC},
X/* these cmds are interecepted by special code in ecucmd.h and appear
X * here only so they will be picked up by the help system.
X */
X { "!", 1,CTdummy1, "execute shell (tty)", 0, ccG},
X { "$", 1,CTdummy2, "execute shell (comm line)", 0, ccG},
X { "-", 1,CTdummy3, "execute program", 0, ccG},
X { "?", 1,CTdummy4, "get help", 0, ccG},
X { "", 0,-1,"",0,0 } /* list ends with token value of -1 */
X};
X#endif
X
X/* end of ecucmd.h */
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
$TOUCH -am 1224223090 'ecucmd.h' &&
chmod 0644 ecucmd.h ||
echo 'restore of ecucmd.h failed'
Wc_c="`wc -c < 'ecucmd.h'`"
test 11044 -eq "$Wc_c" ||
echo 'ecucmd.h: original size 11044, current size' "$Wc_c"
# ============= ecuerror.h ==============
echo 'x - extracting ecuerror.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecuerror.h' &&
X/*+-------------------------------------------------------------------------
X ecuerror.h
X wht@n4hgf.Mt-Park.GA.US
X
Xe_... values must not be changed without careful looking through code
Xerror numbers should be <= 0x7FFF to avoid problems with M_I286 versions
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#define e_USER 0x1000 /* user error differentiation */
X
X/* warning errors - do not stop proc execution */
X#define e_WARNING 0x3000
X#define eProcEmpty 0x3001 /* empty procedure */
X#define eWARNING_ALREADY 0x3002 /* warning already printed */
X#define eConnectFailed 0x3003 /* failed to connect */
X#define eNoSwitches 0x3004 /* no switch(es) to command */
X
X/* fatal errors - stop proc execution */
X#define e_FATAL 0x4000
X#define eIllegalCommand 0x4003 /* invalid command */
X#define eNoMemory 0x4004 /* no more memory available */
X#define eSyntaxError 0x4005 /* syntax error */
X#define eIllegalVarNumber 0x4006 /* variable number is invalid or out of range */
X#define eIllegalVarType 0x4007 /* unrecognized variable type */
X#define eNotInteger 0x4008 /* integer expected and not found */
X#define eFATAL_ALREADY 0x4011 /* fatal to proc, info already printed */
X#define eCONINT 0x4012 /* abort due to interrupt */
X#define eInvalidFunction 0x4013 /* invalid function name */
X#define eMissingLeftParen 0x4014 /* did not find expected left paren */
X#define eMissingRightParen 0x4015 /* did not find expected right paren */
X#define eCommaExpected 0x4016 /* expected comma not found */
X#define eProcStackTooDeep 0x4017 /* procedure stack depth exceeded */
X#define eInvalidRelOp 0x4018 /* invalid relational operator */
X#define eInvalidIntOp 0x4019 /* invalid integer operator */
X#define eInvalidStrOp 0x4020 /* invalid string operator */
X#define eNotExecutingProc 0x4022 /* not executing DO at this time */
X#define eInvalidLabel 0x4023 /* invalid label */
X#define eInternalLogicError 0x4025 /* internal logic error ... whoops */
X#define eEOF 0x4026 /* end of file or read error */
X#define eBufferTooSmall 0x4027 /* string too long */
X#define eNoParameter 0x4028 /* expected parameter not found */
X#define eBadParameter 0x4029 /* bad parameter */
X#define eInvalidHexNumber 0x402A /* invalid hexadecimal digit */
X#define eInvalidDecNumber 0x402B /* invalid decimal digit */
X#define eInvalidOctNumber 0x402C /* invalid octal digit */
X#define eInteractiveCmd 0x402E /* interactive command */
X#define eNoLineAttached 0x402F /* no line (modem) attached */
X#define eBadFileNumber 0x4030 /* file number out of range */
X#define eNotImplemented 0x4031 /* not implemented */
X#define eDuplicateMatch 0x4032 /* more than one condition matches */
X#define eColonExpected 0x4033 /* expected colon not found */
X#define eLabelInvalidHere 0x4034 /* label not allowed on this statement */
X#define eNoCloseFrame 0x4035 /* missing '}' for '{' */
X#define eNoFrame 0x4036 /* missing command or command group after 'while' or 'if' */
X#define eMissingCommand 0x4037 /* expected command not found */
X#define eBreakCommand 0x4038 /* 'break' outside 'while' */
X#define eContinueCommand 0x4039 /* 'continue' outside 'while' */
X#define eElseCommand 0x403A /* 'else' without matching 'if' */
X#define eInvalidVarName 0x403B /* invalid variable name */
X#define eNoSuchVariable 0x403C /* variable by this name not defined */
X#define eInvalidLogicOp 0x403D /* invalid logical operator */
X#define eExpectRespondFail 0x403E /* expect-respond failed */
X
X/* DO attention getter */
X#define e_ProcAttn 0x7000
X#define eProcAttn_GOTO 0x7000 /* GOTO detected */
X#define eProcAttn_GOTOB 0x7001 /* GOTOB detected */
X#define eProcAttn_RETURN 0x7002 /* RETURN detected */
X#define eProcAttn_ESCAPE 0x7003 /* ESCAPE detected */
X#define eProcAttn_Interrupt 0x7004 /* procedure interrupted */
X
SHAR_EOF
$TOUCH -am 1224222890 'ecuerror.h' &&
chmod 0644 ecuerror.h ||
echo 'restore of ecuerror.h failed'
Wc_c="`wc -c < 'ecuerror.h'`"
test 3939 -eq "$Wc_c" ||
echo 'ecuerror.h: original size 3939, current size' "$Wc_c"
# ============= ecufkey.h ==============
echo 'x - extracting ecufkey.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecufkey.h' &&
X/*+-------------------------------------------------------------------------
X ecufkey.h -- AT XENIX/UNIX function key phrases
X wht@n4hgf.Mt-Park.GA.US
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X/*
X * indices to key mapping tables
X *
X * these are close to being magic numbers - don't change w/o looking
X * at KDEk_to_XF in ecutty.c
X */
X#define KDEk_F1 0
X#define KDEk_F2 1
X#define KDEk_F3 2
X#define KDEk_F4 3
X#define KDEk_F5 4
X#define KDEk_F6 5
X#define KDEk_F7 6
X#define KDEk_F8 7
X#define KDEk_F9 8
X#define KDEk_F10 9
X#define KDEk_F11 10
X#define KDEk_F12 11
X#define KDEk_CUU 12
X#define KDEk_CUD 13
X#define KDEk_CUL 14
X#define KDEk_CUR 15
X#define KDEk_CU5 16
X#define KDEk_PGUP 17
X#define KDEk_PGDN 18
X#define KDEk_END 19
X#define KDEk_INS 20
X#define KDEk_BKTAB 21
X#define KDEk_HOME 22
X
X#define KDE_COUNT 23
X
X#define KDE_LOGICAL_MAX 12
X#define KDE_OUTSTR_MAX 10
X
X#define KDEt_NAME 1
X#define KDEt_ENTRY 2
X#define KDEt_COMMENT 3
X#define KDEt_EOF 4
X
Xtypedef struct kde
X{
X char logical[KDE_LOGICAL_MAX];
X uchar KDEt;
X char count;
X char str[KDE_OUTSTR_MAX];
X} KDE;
X
X/* when an count is not a count but an action: */
X#define KACT_COMMAND -1
X#define KACT_LOCAL_SHELL -2
X#define KACT_REDISPLAY -3
X
Xtypedef struct XF_KDE_NAME
X{
X uchar xf;
X char kde;
X char *name;
X} XF_KDE_NAME;
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of ecufkey.h */
SHAR_EOF
$TOUCH -am 1224222890 'ecufkey.h' &&
chmod 0644 ecufkey.h ||
echo 'restore of ecufkey.h failed'
Wc_c="`wc -c < 'ecufkey.h'`"
test 1457 -eq "$Wc_c" ||
echo 'ecufkey.h: original size 1457, current size' "$Wc_c"
true || echo 'restore of ecufork.h failed'
echo End of part 15, continue with part 16
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.