[comp.sources.misc] v16i058: ECU async comm package rev 3.0, Part34/35

wht@n4hgf.uucp (Warren Tucker) (01/06/91)

Submitted-by: wht@n4hgf.uucp (Warren Tucker)
Posting-number: Volume 16, Issue 58
Archive-name: ecu3/part34

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 34 of ecu3
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= doc/_p_ifunc.txt ==============
if test ! -d 'doc'; then
    echo 'x - creating directory doc'
    mkdir 'doc'
fi
echo 'x - extracting doc/_p_ifunc.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_p_ifunc.txt' &&
X.*s 2 "Integer Functions"
X
X.*s 3 "%argc"
X
XThis function returns the number of arguments passes to the current
Xprocedure.
X
X
X
X.*s 3 "%baud"
X
XThis function returns the baud rate of the communications line.
XIf no line is currently attached, the baud rate returned
Xis the value of the last line attached.  If no line has been attached
Xduring the current session, the default baud rate is returned.
X
X.*s 3 "%colors"
X
XThis function returns the state of the normal and reverse video
Xforeground and background colors in the 32-bit value:
X.DS I
X00000000001111111111222222222233
X01234567890123456789012345678901
X0000|--|0000|--|0000|--|0000|--|
X     fg      bk      fg      bk
X      reverse          normal
X.DE
X
XThe color values are obtained from the following lists:
X.DS L
X.B
X    Alphabetic Order
X.R
X    black        0
X    blue         1
X    brown        6
X    cyan         3
X    gray         8
X    green        2
X    hi_white    15
X    lt_blue      9
X    lt_cyan     11
X    lt_green    10
X    lt_magenta  13
X    lt_red      12
X    magenta      5
X    red          4
X    white        7
X    yellow      14
X.DE
X
X.DS L
X.B
X    Numeric Order
X.R
X    black        0
X    blue         1
X    green        2
X    cyan         3
X    red          4
X    magenta      5
X    brown        6
X    white        7
X    gray         8
X    lt_blue      9
X    lt_green    10
X    lt_cyan     11
X    lt_red      12
X    lt_magenta  13
X    yellow      14
X    hi_white    15
X.DE
X
X.*s 3 "%cols"
X
XThis function returns the screen width in columns.
XIf running non-interactively, the value will always be 80.
X
X.*s 3 "%conn"
X
XThis function returns the communications
Xline file descriptor if a connection is in progress, else 0.
XNOTE:  if carrier is lost abnormally, %conn will return non-zero
Xincorrectly.
X
X.*s 3 "%curx"
X
XThis function returns the display cursor column position last set by the
Xremote system.  This value does not reflect the actual hardware cursor.
X
X.*s 3 "%cury"
X
XThis function returns the display cursor row position last set by the
Xremote system.  This value does not reflect the actual hardware cursor.
X
X.*s 3 "%csec"
X
XThis function returns the number of seconds ECU has been
Xconnected to a remote system.  If ECU is not connected,
Xzero is returned.
X
X.*s 3 "%ctoi"
X
Xusage: %ctoi(str0)
X
XThis function returns the integer value of the first
Xcharacter in string str0.  If str0 is non-empty, the return value
Xwill be between 0 and 255, inclusive.  if str0 is empty,
Xthen -1 is returned.
X
X.*s 3 "%esecs"
X
Xusage: %esecs
X
XThis function , "Epoch SECondS,"
Xreturns the number of seconds since January 1, 1970 00:00 UTC
X(GMT).
X
X.*s 3 "%fatime"
X.DS L
Xusage: %fatime(int0)
X       %fatime(str0)
X.DE
X
XThis function returns the time of last access of the file referenced
Xby the argument.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
XThe return value is the number of seconds since January 1, 1970
Xat 0000 UTC.
XThe
X.B %edate
Xstring function may be used to convert the integer
Xvalue to a string representation of the date and time
Xexpressed relative to the current time zone.
X
X.*s 3 "%fmode"
X.DS L
Xusage: %fmode(int0)
X       %fmode(str0)
X.DE
X
XThis function returns the file mode value ("rwxrwx---" == 077)
Xof the file referenced
Xby the argument.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
X.*s 3 "%fmtime"
X.DS L
Xusage: %fmtime(int0)
X       %fmtime(str0)
X.DE
X
XThis function returns the time of last modified of the file referenced
Xby the argument.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
XThe return value is the number of seconds since January 1, 1970
Xat 0000 UTC.
XThe
X.B %edate
Xstring function may be used to convert the integer
Xvalue to a string representation of the date and time
Xexpressed relative to the current time zone.
X
X.*s 3 "%fmode"
X.DS L
Xusage: %fmode(int0)
X       %fmode(str0)
X.DE
X
XThis function returns the size
Xof the file referenced
Xby the argument.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
X.*s 3 "%ftell"
X
Xusage: ftell(int0)
X
XThis function returns the current file position
Xof the the file
Xopened by int0 with the
X.B fopen
Xcommand.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
X
X.*s 3 "%instr"
X
Xusage: %instr(str0,str1)
X
XThis function returns the leftmost column position withing str0
Xthat str1 is found (zero relative).  If str1 cannot be found in
Xstring str0, -1 is returned.  However, if str1 is null and str0 is not,
Xzero will be returned (i.e., the null string matches at the left).
X
XThe comparison is made without regard to case. See also
X.B %instr .
X
X.DS I
XExamples:
X
X            00000000001111111
X            01234567890123456
XAssume $s0='abcdefghijklmnabc'
X       $s1='abc'
X       $s2='gHi'
X       $s3='cat'
X
X       %instr($s0,$s1)        returns 0
X       %instr($s0,$s2)        returns 6
X       %instr($s0,$s3)        returns -1
X       %instr($s0,'bcd')      returns 2
X       %instr($s0,'bad')      returns -1
X.DE
X
X.*s 3 "%ischr"
X.DS L
Xusage: %ischr(int0)
X       %ischr(str0)
X.DE
X
XThis function returns 1 if the file referenced by the argument is a
Xcharacter special file,
Xelse 0.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
XExamples:
X
X.DS I
X%ischr('/dev/tty')    returns 1
X%ischr('/usr/bin')    returns 0
X%ischr('/xenix')      returns 0
X.DE
X
X.*s 3 "%isdir"
X.DS L
Xusage: %isdir(int0)
X       %isdir(str0)
X.DE
X
XThis function returns 1 if the file referenced by the argument is a
Xdirectory file,
Xelse 0.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
XExamples:
X
X.DS I
X%isdir('/dev/tty')    returns 0
X%isdir('/usr/bin')    returns 1
X%isdir('/xenix')      returns 0
X.DE
X
X.*s 3 "%isreg"
X.DS L
Xusage: %isreg(int0)
X       %isreg(str0)
X.DE
X
XThis function returns 1 if the file referenced by the argument is a
Xregular file,
Xelse 0.
XIf the argument is an integer, the file referenced is the file
Xopened by that number with the
X.B fopen
Xcommand.
XIf the argument is a string, it is the literal filename.
X
XIf int0 does not refer to an open file, the procedure
Xterminates with an error.
XIf the file specified by str0 does not exist, -1 is returned.
X
XExamples:
X
X.DS I
X%isreg('/dev/tty')    returns 0
X%isreg('/usr/bin')    returns 0
X%isreg('/xenix')      returns 1
X.DE
X
X.*s 3 "%len"
X
Xusage: %len(str0)
X
XThis function returns the length of str0.
X.DS I
XExample:
X
Xset str0='abcdef',i0=%len(str0),i1=%len('1234')
Xstr00 = 'abcdef'
Xint00 = 6
Xint01 = 4
X.DE
X
X.*s 3 "%lgetc"
X
Xusage: %lgetc
X
XReads a character from the line and returns it.
X
X.*s 3 "%lines"
X
XThis function returns the screen height in lines.
XIf running non-interactively, the value will always be 25.
X
X.*s 3 "%pid"
X
XThis function returns the process id (pid) of ECU.
X
X.*s 3 "%match"
X
Xusage: %match(str0,str1)
X
XThis function searches string str0 for a match with the regular
Xexpression in str1 (for information on regular expressions,
Xrefer to the ed(C) manual pages).
XThe function returns the index into str0 where the
Xmatch is found or -1 if no match can be found.
XThe matching process is case sensitive.
X
XThe variable $i0 receives the length of the matching
Xstring in str0 if a  match is found.  For this reason,
Xit is not advisable that $i0 otherwise be involved
Xin the operation.  Specifically to be avoided is:
X.DS I
Xset $i0=%instr(...)
X.DE
X.DS L
XExamples:
X
X            00000000001111111
X            01234567890123456
XAssume $s0='abcdefghijklmnabc'
X       $s1='abc'
X       $s2='n.*'
X
X       %match($s0,$s1)        returns 0   $i0=3
X       %match($s0,$s2)        returns 16  $i0=4
X       %match($s0,$s3)        returns -1  $i0 unchanged
X       %match($s0,'de..h')    returns 3   $i0=5
X       %match($s0,'de..H')    returns -1  $i0 unchanged
X.DE
X
X.*s 3 "%mhack"
X
Xusage: %mhack
X
XThis function ("Millisecond time HACK") returns the number of
Xmilliseconds since ecu was started.  It isn't a very useful
Xvalue by itself, but differences between the values
Xreturned by two calls to the function may be used to determine
Xthe time between two events with the maximum accuracy the
Xoperating system can deliver (1/HZ resolution with a bit of
Xlatency).
X
X.DS L
XExamples:
X    $i10 = %mhack
X    send 'test'
X    lookfor -e %chr(0x0A) 100
X    ifi $i0 == 0 echo 'no response in 10 seconds'
X    else echo 'response time '+%itos(%mhack - $i10)+' msec'
X.DE
X
X.*s 3 "%rchr"
X
XThis function returns the number of characters
Xreceived by ECU since the program starrted.
X
X.*s 3 "%rchrc"
X
XThis function returns the number of characters
Xreceived by ECU during the current connection.
X
X.*s 3 "%rinstr"
X
Xusage: %rinstr(str0,str1)
X
XThis function returns the rightmost column position withing str0
Xthat str1 is found (zero relative).  If str1 cannot be found in
Xstring str0, -1 is returned.  However, if str1 is null and str0 is not,
Xzero will be returned (i.e., the null string matches at the left).
X
XThe comparison is made without regard to case. See also
X.B %instr .
X
X.DS I
XExamples:
X
X            00000000001111111
X            01234567890123456
XAssume $s0='abcdefghijklmnabc'
X       $s1='abc'
X       $s2='gHi'
X       $s3='cat'
X
X       %instr($s0,$s1)        returns 14
X       %instr($s0,$s2)        returns 6
X       %instr($s0,$s3)        returns -1
X.DE
X
X.*s 3 "%shmid"
X
XThis function returns the integer shared memory segment id
Xfor the current ECU process.  It may be used to pass the id
Xto a "friend" process so that it may access the shared memory
Xsegment (described in header file ecushm.h).
XFor more details,
Xrefer to an earlier section entitled "Shared Memory 'Friend' Interface."
X
X.DS L
XExample:
X
X     system 'ecufriend '+%itos(%shmid)
X.DE
X
X.*s 3 "%stoi"
X
Xusage: %stoi(str0)
X
XThis function converts the contents of str0 to an
Xinteger and returns  the value.
X
X.*s 3 "%xchr"
X
XThis function returns the number of characters
Xtransmitted by ECU since the program starrted.
X
X.*s 3 "%xchrc"
X
XThis function returns the number of characters
Xtransmitted by ECU during the current connection.
X
X
SHAR_EOF
$TOUCH -am 1224122990 'doc/_p_ifunc.txt' &&
chmod 0644 doc/_p_ifunc.txt ||
echo 'restore of doc/_p_ifunc.txt failed'
Wc_c="`wc -c < 'doc/_p_ifunc.txt'`"
test 11341 -eq "$Wc_c" ||
	echo 'doc/_p_ifunc.txt: original size 11341, current size' "$Wc_c"
# ============= doc/_p_param.txt ==============
echo 'x - extracting doc/_p_param.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_p_param.txt' &&
X.*s 2 "Arguments"
X
XThere are five types of arguments to procedure commands:
X.DS I
XSwitch
XAlphabetic Token
XInteger
XString
XRelational Operators
X.DE
XThis section describes the syntax and construction of each type in turn.
XThere are separate groups of valid of relational operators for integers
Xand strings; thus, they are described under the appropriate sections.
X
X.*s 3 "Switches"
X
XSwitch arguments begin with a hyphen (minus, '-').  The switch
Xargument must be the first argument after the command.  Only
Xone switch argument is allowed on the command line.  If
Xswitches '-a', '-b' and '-c', are available and '-a' and '-b'
Xare desired, '-ab' or '-ba' is entered.
X
X.*s 3 "Alphabetic Tokens"
X
XAlphabetic tokens, for lack of a better term, are non-integer,
Xnon-quoted terms used as arguments for certain commands, such as:
X.DS I
Xplog off
X.DE
XSuch argument types are fairly simple to understand and use; they are
Xdescribed here for completeness.
X
X.*s 3 "Integers"
X
XInteger values are 32-bit quantities ranging between -2147483647
Xand 2147483647.
X
XIn one case, an integer is used to store a 32-bit color mask as
Xdescribed by the
X.B color
Xcommand and the
X.B %colors
Xinteger function.
X
X.*s 4 "Constants"
X
XInteger constants are numeric strings, optionally with an initial
Xminus sign, the absolue value of which must be less than 2147483648.
X
X.*s 4 "Variables"
X
XThere are 50 numbered, permanent integer variables referenced by
Xthe terms '$i0' through '$i49'.  When ECU is started, the value of each
Xvariable is zero.  Variables retain their
Xvalue until changed, even between procedure executions.
XThe integer variable number may be expressed
Xas an expression by enclosing an integer expression in brackets.
XFor instance:
X.DS L
X     $i[4+5]      refers to $i9
X
X     $i2=5
X     $i[20+$i2]   refers to $i25
X.DE
X
XInteger variables may be created for use as "local" variables or
Xto promote code readability.  Refer to the
X.B mkvar
Xcommand.
X
X.*s 4 "Functions"
X
XECU has many built-in functions which return the value of ecu- or
Xsystem-related information.  A list of the functions appears in a
Xlater section.
X
X.*s 4 "Expressions"
X
XIn almost any place an integer argument is allowed, an expression
Xmay be supplied.  Expressions are composed of two or more integer
Xconstants or variables separated by operators from the group:
X.DS L
X    +     addition
X    -     subtraction
X    *     multiplication
X    /     division
X    |     OR
X    @     MOD
X    ^     XOR
X    &     AND
X.DE
XEvaluation of expressions is left-to-right.  Parentheses are
Xnot allowed.
X
X.*s 4 "Relational Operators"
X
XInteger relational operators are chosen from the following group:
X.DS L
X     =       "is equal to"
X     ==      "is equal to"
X     !=      "is not equal to"
X     <>      "is not equal to"
X     >       "is greater than"
X     <       "is greater than"
X     >=      "is greater than or equal to"
X     <=      "is less than or equal to"
X.DE
X
X.*s 3 "Strings"
X
XStrings are classic concatenations of zero or more eight-bit
Xcharacters.  In general, the maximum size of a string used by
XECU is 256 characters.  The absolute maximum size is 5120 characters.
X
X.*s 4 "Constants"
X
XString constants are formed by placing alphanumeric characters
Xbetween single quote characters (apostrophes).  The backslash ('\\')
Xcharacter is used to "escape" certains characters:
X.DS L
X    '\\\\'    one backslash
X    '\\n'   newline
X    '\\t'   tab
X    '\\''   apostrophe
X.DE
X
X.*s 4 "Variables"
X
XThere are 50 numbered, permanent string variables referenced by
Xthe terms '$s0' through '$s49',
Xeach possessing a maximum length of 256 characters
XWhen ECU is started, the value of each
Xvariable is null (zero length).  Variables retain their
Xvalue until changed, even between procedure executions.
XThe string variable number may be expressed
Xas an expression by enclosing an string expression in brackets.
XFor instance:
X.DS L
X     $s[4+5]      refers to $s9
X
X     $s2=5
X     $s[20+$s2]   refers to $s25
X.DE
X
XString variables may be created for use as "local" variables or
Xto promote code readability.  Refer to the
X.B mkvar
Xcommand.  
XCreated variables have a life equal to the duration
Xof the procedure which created them.
XRegardless of the declared size of a created string variable,
XECU will automatically grow it to a maximum of 5120 characters
Xas necessary.  Numbered (permanent) string variables have a maximum
Xsize of 256 bytes.
X
X.*s 4 "Functions"
X
XECU has many built-in functions which return the value of ecu- or
Xsystem-related information.  A list of the functions appears in a
Xlater section.
X
X.*s 4 "Expressions"
X
XString expressions are formed by the concatenation of string
Xconstants, variables and function return values using the '+'
Xoperator:
X.DS L
XExample:
X   'The quick brown fox jumped over the '+$s0'+' dog at '+%time
X.DE
X
X.*s 4 "Relational Operators"
X
XString relational operators are chosen from the following group:
X.DS L
X     =       "is equal to"
X     ==      "is equal to"
X     !=      "is not equal to"
X     <>      "is not equal to"
X.DE
X
SHAR_EOF
$TOUCH -am 0815160490 'doc/_p_param.txt' &&
chmod 0644 doc/_p_param.txt ||
echo 'restore of doc/_p_param.txt failed'
Wc_c="`wc -c < 'doc/_p_param.txt'`"
test 4995 -eq "$Wc_c" ||
	echo 'doc/_p_param.txt: original size 4995, current size' "$Wc_c"
# ============= doc/_p_sfunc.txt ==============
echo 'x - extracting doc/_p_sfunc.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_p_sfunc.txt' &&
X.*s 2 "String Functions"
X
X.*s 3 "%argv"
X
Xusage: %argv(int0)
X
XThis function returns the string value of an argument passed
Xto the procedure by the 'do' command.  Argument 0 is the
Xname of the procedure itself.
XThe integer function %argc may be used to determine the
Xnumber of arguments passed to the procedure.  Specifying
Xan argument number greater than the number of arguments
Xpassed returns a null string (if procedure tracing is enabled
Xwith the 'ptrace' comand, a warning will be displayed
Xin this case).
X.DS I
XExample:
X    invocation from shell:
X    ecu -p test Quick Brown Fox
X
X    invocation from interactive command line:
X    do test Quick Brown Fox
X
X    invocation from procedure:
X    do 'test' 'Quick' 'Brown' 'Fox'
X    
X    results in:
X    %argv(0) = 'test'
X    %argv(1) = 'Quick'
X    %argv(2) = 'Brown'
X    %argv(3) = 'Fox'
X    %argv(4) = ''
X.DE
X
X.B NOTE:
Xthe interactive
X.B dial
Xcommand, the dialing directory menu and the initial setup menu
Xall can automatically execute a procedure which matches
Xa dialed
X.B
Xlogical telephone number.
X.R
XThere two arguments passed to these procedures, %argv(0) being
Xthe procedure name as always.  %argv(1) is set according to the following
Xtable:
X.DS I
X invoker              %argv(1)
X-------------------  -------------
Xinitial setup menu   !INITIAL
Xinteractive dial     !INTERACTIVE
Xdialing menu         !MENU
X.DE
XThus it is possible for the invoked procedure
Xto determine that it has been automatically executed
Xby testing %argv(1) for an exclamation point, or possibly
Xthe entire argument.
X
X.*s 3 "%basename"
X
XUsage: %basename(str0,str1)
X
XThis function is similar to the UNIX basename(1) utility in
Xthat it returns a filename minus a supplied suffix, if it is present.
XUnlike the UNIX basename(C) program, %basename does not remove
Xthe directory part of the filename.
XSee also
X.B %dirpart
Xand
X.B %filepart .
X
X.DS L
XExamples:
X
X    %basename('/u1/src/ecu/ecu.c','.c') = /u1/src/ecu/ecu
X    %basename('ecu.c','.c') = ecu
X    %basename('ecu.c','.x') = ecu.c
X.DE
X
X.*s 3 "%cgetc"
X
Xusage: %cgetc
X
XThis  function reads one character from the console keyboard
Xand returns it.  The character is not echoed.
X
X.*s 3 "%cgets"
X
Xusage: %cgets
X
XThis function reads a string from the console keyboard
Xand returns it.  Each character is echoed as it is typed
Xand the user's normal erase and kill character is available
Xto edit the input before terminating the read with ENTER.
X
X.*s 3 "%chr"
X
Xusage: %chr(int0)
X
XThis function returns the character value whose ASCII value
Xis supplied in int0.
X
X.DS L
XExample:
X
X    set $s0 = %chr(4)  places a ^D (EOT) character into $s0
X.DE
X
X.*s 3 "%date"
X
Xusage: %date
X
XThis function returns the current date in the form 'mm-dd-yyyy'
Xin the local time zone (daylight time if it applies).
X
X.*s 3 "%datez"
X
Xusage: %datez
X
XThis function returns the current date in the form 'mm-dd-yyyy'
Xin the UTC (Z) time zone.
X
X.*s 3 "%day"
X
Xusage: %day
X
XThis function returns the current day of the week as a three character
Xabbreviation: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
Xin the local time zone (daylight time if it applies).
X
X.*s 3 "%dayz"
X
Xusage: %dayz
X
XThis function returns the current day of the week as a three character
Xabbreviation: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
Xin the UTC (Z) time zone.
X
X.*s 3 "%dir"
X
Xusage: %dir
X
XThis function returns the
Xfull pathname of the current working directory.
X
X.*s 3 "%dirpart"
X
Xusage: %dirpart(str0)
X
XThis function returns the
Xdirectory portion of the pathname supplied in str0.
XSee also
X.B %basename
Xand
X.B %filepart .
X
X
X.DS L
XExamples:
X
X%dirpart('/u1/src/src/foo.c') = "/u1/src/src"
X%dirpart('foo.c') = "foo.c"
X%dirpart('/usr') = ""
X.DE
X
X.*s 3 "%edate"
X
Xusage: %edate(int0)
X
XThe value in int0 is expected to be a number of seconds since January 1,
X1970 00:00 UTC (Universal Coordinated Time) as returned by
Xthe integer functions %fatime and %fmtime.
XThis function converts the value into a string representing the
Xequivalent local time in the form 'mm-dd-yyyy hh:mm:ss'.
X.DS L
XExample:
X
Xset $i0=%fmtime('/xenix')
X$i00 = 601178971 (0x23d5435b,04365241533)
X
Xset $s0=%edate($i0)
X$s00 = '01-18-1989 21:09:31'
X.DE
X
X.*s 3 "%envvar"
X
Xusage: %envvar()
X
XThis function returns the string value of an environment
Xvariable.
X
X.DS L
XExample:
X
X    set $s0=%envvar('HOME') might set $s0 '/usr/user'
X.DE
X.DF L
XTypical Environment Variables:
X
X    HOME          pathname of home directory
X    EDITOR        user's preferred editor
X    PATH          program execution searchlist
X    TERM          terminal type
X    SHELL         user's preferred shell
X    MAIL          user's mail box file
X    ECUPROMPT     ECU interactive command prompt
X                  at beginning of execution
X.DE
X
X.*s 3 "%errstr"
X
Xusage: %errstr(int0)
X
XThis function returns the system error message, given int0 as an
X.B errno
Xas returned by a file-related command.
X.B fopen.
X
X.DS L
XExample:
X
X    echo %errstr(1)
X    Not owner
X.DE
X
X.*s 3 "%etime"
X
Xusage: %etime(int0)
X
XThis function returns a string representation of elapsed time
Xin the format 'hh:mm:ss'
Xfor the integer parameter int0, a number of seconds.
X
X.DS L
XExample:
X
X    echo %etime(62)
X    00:01:02
X.DE
X
X.*s 3 "%filepart"
X
Xusage: %filepart(str0)
X
XThis function returns the
Xfilename portion of the pathname supplied in str0.
XSee also
X.B %basename
Xand
X.B %dirpart .
X
X.DS L
XExamples:
X
X%filepart('/u1/src/src/foo.c') = "foo.c"
X%filepart('foo.c') = "foo.c"
X.DE
X
X.*s 3 "%fmodestr"
X
Xusage: %fmodestr(int0)
X
XThis function returns a string representation of the
Xfamiliar file mode string given the file mode integer int0.
X
X.DS L
XExample:
X
X    echo %fmodestr(0100755)
X    -rwxr-xr-x
X
X    echo %fmodestr(%fmode('/usr/lib'))
X    drwxr-xr-x
X.DE
X
X.*s 3 "%itos"
X
Xusage: %itos(int0[,format])
X
XThis function converts integer int0 to a string, optionally
Xcontrolling the format of the conversion.
X
XIf the format parameter is missing, the conversion is to
Xa minimum number of decimal characters necessary to
Xhold the result.
X
XIf the format parameter is present, it must of consist of
Xa non-null string made of one or both optional parts:
X.DS L
X    decimal number of digits to be part of result string
X    (a leading zero indicates leading zeroes are to
X    appear in the string; no leading zero pads with
X    leading spaces
X
X    a lower case letter from the following list:
X        d - decimal conversion
X        x - hexadecimal conversion
X        o - octal conversion
X.DE
X.DS L
XExample:
X
X    %itos(33)           '33'
X    %itos(33,d)         '33'
X    %itos(33,x)         '21'
X    %itos(33,5d)        '   33'
X    %itos(33,010d)      '0000000033'
X    %itos(33,10d)       '        33'
X    %itos(33,x)         '21'
X    %itos(33,04x)       '0021'
X    %itos(33,4x)        '  21'
X    %itos(33,o)         '41'
X    %itos(33,4o)        '    41'
X.DE
X
X.*s 3 "%left"
X
Xusage: %left(str0,int0)
X
XThis function returns the leftmost int0 characters of str0.
XIf the length of the string is less than int0,
Xthe entire str0 is returned.
X.DS L
XExample:
X
X    if $s0 == 'abcdefg'
X    %left($s0,3) returns 'abc'
X.DE
X
X.*s 3 "%line"
X
Xusage: %line
X
XThis function returns the name of the attached communications
Xline in the form "/dev/ttyxx".  If no line is currently
Xattached, the function returns null.
X
X.*s 3 "%logname"
X
Xusage: %logname
X
XThis function returns the login name of the user executing
XECU.  Note: the name returned is the name supplied to a login
Xprompt, not any current su(C) username that may be in effect.
X
X.*s 3 "%mid"
X
Xusage: %mid(str0,int0[,int1])
X
XThis function returns the middle portion of a string str0
Xbeginning with the character at position int0 and for a length
Xof int1 characters.
XIf int0 is greater than or equal to the length of
Xstro, a null string is returned.
XIf the optional argument int1 is not supplied, or
Xif the length of the string is less than int1,
Xthe entire str0 is returned.
X.DS L
XExample:
X
X    if $s0 == '0123456789abc'
X    %mid($s0,3,4)  returns '3456'
X    %mid($s0,3)    returns '3456789abc'
X    %mid($s0,10,2) returns 'ab'
X    %mid($s0,10,5) returns 'abc'
X.DE
X
X.*s 3 "%month"
X
Xusage: %month
X
XThis function returns the current month as a three character
Xabbreviation: 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'.
X
X.*s 3 "%rdesc"
X
Xusage: %rdesc
X
XThis function returns the
Xdescription
Xportion of the
Xdialing directory entry for the currently connected remote.
XIf no connection exists, the function returns null.
X
X.*s 3 "%right"
X
Xusage: %right(str0,int0)
X
XThis function returns the rightmost int0 characters of str0.
XIf the length of the string is less than int0,
Xthe entire str0 is returned.
X.DS L
XExample:
X
X    if $s0 == 'abcdefg'
X    %right($s0,3) returns 'efg'
X.DE
X
X.*s 3 "%rname"
X
Xusage: %rname
X
XThis function returns the
Xlogical name
Xportion of the
Xdialing directory entry for the currently connected remote.
XIf the remote was dialed directly, as in dial 5551212, the
Xreturned value is the phone number.
XIf no connection exists, the function returns null.
X
XThe value returned by this command may be overridden by use of the
X.B rname
Xprocedure command.
X
X.*s 3 "%rtelno"
Xusage: %rtelno
X
XThis function returns the
Xtelephone number
Xportion of the
Xdialing directory entry for the currently connected remote.
XIf no connection exists, the function returns null.
X
X.*s 3 "%time"
X
Xusage: %time
X
XThis function returns the current time in the form 'hh:mm'
Xin the local time zone (daylight time if it applies).
X
X.*s 3 "%times"
X
Xusage: %times
X
XThis function returns the current time in the form 'hh:mm:ss'
Xin the local time zone (daylight time if it applies).
X
X.*s 3 "%timez"
X
Xusage: %timez
X
XThis function returns the current time in the form 'hh:mm'
Xin the UTC (Z) time zone.
X
X.*s 3 "%timezs"
X
Xusage: %timezs
X
XThis function returns the current time in the form 'hh:mm:ss'
Xin the UTC (Z) time zone.
X
X.*s 3 "%tty"
X
Xusage: %tty
X
XThis function returns the console tty name in the form "/dev/ttynn".
X
SHAR_EOF
$TOUCH -am 0813151890 'doc/_p_sfunc.txt' &&
chmod 0644 doc/_p_sfunc.txt ||
echo 'restore of doc/_p_sfunc.txt failed'
Wc_c="`wc -c < 'doc/_p_sfunc.txt'`"
test 9865 -eq "$Wc_c" ||
	echo 'doc/_p_sfunc.txt: original size 9865, current size' "$Wc_c"
# ============= doc/_proc.txt ==============
echo 'x - extracting doc/_proc.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_proc.txt' &&
X.*s 1 "Procedure Language"
X
XSample procedures are shown in the companion document 'samplproc.man'.
X
X
X.so _p_param.txt
X
X.so _p_cmd.txt
X
X.so _p_ifunc.txt
X
X.so _p_sfunc.txt
X
SHAR_EOF
$TOUCH -am 0711174289 'doc/_proc.txt' &&
chmod 0644 doc/_proc.txt ||
echo 'restore of doc/_proc.txt failed'
Wc_c="`wc -c < 'doc/_proc.txt'`"
test 171 -eq "$Wc_c" ||
	echo 'doc/_proc.txt: original size 171, current size' "$Wc_c"
# ============= doc/_startup.txt ==============
echo 'x - extracting doc/_startup.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_startup.txt' &&
X.*s 1 "Starting the Program"
X
X.*s 2 "Simple Startup - Initial Setup Menu"
X
XECU may be started in a number of ways through use of
Xcommand line switches, but the easiest is to enter
X.DS I
Xecu
X.DE
Xby itself.
XIn this case, the screen is cleared
Xand the folowing screen will be presented.
X
X
X.DS L
X
X  .--[ ecu 1.96 Copyright 1986,1989, W. Tucker ]-----------------.
X  |                                                              |
X  |  Name/phone number to call: ___________________              |
X  |                                                              |
X  |                                                              |
X  |  tty: /dev/tty1a                                             |
X  |                                                              |
X  |  duplex: F  baud: 2400   parity:N  (data bits 8)             |
X  |  Add NL to transmitted CR: N                                 |
X  |  Add NL to received CR:    N                                 |
X  |                                                              |
X  |                                                              |
X  |   TAB:next ^B:prev END:proceed ^D:phone dir  ESC:quit ecu    |
X  `- logical phone directory entry, phone number or empty -------'
X
X
X.DE
X
X.*s 3 "Name/Phone Number Field"
X
XIf a dialing directory has been configured,
Xa literal phone number need not be entered.
XHowever, on your first invocation,  you'll very likely have
Xno directory.  Therefore, you have three options:
X
X.DS I
X1.  Enter a literal telephone number, (e.g. 18005551212).
X    Hyphens and open and close parentheses may also
X    be entered.
X
X2.  Press ENTER to skip the 'Name/phone' field and enter
X    ^D to enter the telephone directory to enter your
X    first directory entry.
X
X3.  Press END to enter interactive mode and use the Dial
X    interactive command to dial a literal telephone num-
X    ber or to enter the dialing directory.
X.DE
X
X.*s 3 "Other Fields"
X
XThe 'tty' field may be used to select an
Xoutgoing line
Xother than the default
X/dev/tty1a.
XNote:  only the last two characters of the tty name
Xneed be entered.  The remainder of the tty name
Xis assumed to be '/dev/tty'.
X
XThe 'duplex' field may be used to select a
Xduplex value other than the default 'F' (full).
X
XThe 'baud' field may be used to select a
Xbaud rate value other than the default 2400.
X
XThe 'parity' field may be used to select a
Xparity value other than the default 'N' (none).
X
X
XThe 'Add NL to transmitted CR' and 'Add NL to received CR'
Xfields are usually left defaulted to 'N' (no).  If you
Xwill be communicating with a terminal (with a human), you
Xwill usually need to set both of these fields to 'Y' as
Xwell as to select 'H'alf duplex.
X
X.*s 3 "Special Characters"
X
XSpecial keyboard characters while filling in the
Xstartup screen are:
X
X
X.DS I
X TAB    move to next field ... if nothing typed in
X        the field, do not disturb contents
X
X ^B     back up to previous field
X
X END    proceed with session, dialing remote if
X        logical directory entry name or literal
X        telephone number enetered
X
X ^D     enter phone directory
X
X ESC    quit ecu without any communications
X.DE
X
X.*s 2 "Command Line Arguments and Switches"
X
XECU can be started in a number of ways:
X
X.DS I
Xecu [-lxx] [-b<baud>] [-h] [-e|-o] [-t] <tel-number>
Xecu [-lxx] [-b<baud>] [-h] [-e|-o] [-t]
Xecu [-t] [-h] <logical>
Xecu [-lxx] [-b<baud>] [-h] [-e|-o] [-d] [-D] -p <proc> [<arg> ...]
X.DE
X
X.*s 3 "Non-Switch Arguments"
X
XOnly one type of non-switch argument may be used on the command line.
X<tel-number> or <logical> may appear when the -p switch is absent.
XOne or more <arg> arguments may appear when the -p switch is used.
X
X.*s 3 "<tel-number>"
X
XThis type of argument has a digit as its initial character and
Xrepresents an actual telephone number to be passed to a modem
Xdialer program or Dialers chat script.  The string may contain
Xnon-numeric characters if appropriate for a dialer program,
Xsuch as dialTBIT.  For example:
X.DS L
X    ecu -l/dev/tty2a -b 19200 -e 5551212UC
X.DE
Xuses tty2a (assumed to be connected to a Trailblazer modem) and
Xestablishes a 19200 baud, even parity PEP Compressed connection
Xafter dialing 5551212.
X
X.*s 3 "<logical>"
X
XThis type of argument has an alphabetic initial character and
Xcauses the dialing directory entry by that name to be dialed.
XThe line may be specified by '-l', but if the dialing directory
Xspecifies a line (tty field contaions other than 'Any'), the
Xdialing directory entry will override it.  The '-b', '-e' and '-o'
Xswitches are ignored; the values specified by the dialing directory
Xentry are used.  The '-t' and '-h' switches are valid and honored
Xif present.
X
X.*s 3 "<arg>"
X
XThis type of argument is passed to an initial procedure when
Xthe -p switch is present.
X
X.DS L
Xecu -p unixlogin user pwd ansi43
X.DE
Xexecutes unixlogin.ep with arguments 'user' 'pwd' 'ansi43'
X
XFor more detail, refer to the description of -p, -d and -D below.
X
X.*s 3 "-l"
X
XWhen ECU starts up, it normally chooses a line as described later
Xin the section titled "Choosing a Dialout Line".
XSpecifying the -l switch can suggest that the program
Xchoose a specific line.  The argument to the switch is the
Xlast two charcters of the ttyname; e.g., "-l1a".
X
XOn a system with HoneyDanBerr UUCP,
Xto access a device which does not appear in the Devices file,
Xit may be necessary to explicitly specify the device with -l.
X
X.*s 3 "-f"
XNormally, ECU starts up in the full duplex mode.
XIf half duplex is desired, the
X.B
X-f switch
X.R
Xis used.
X
X.*s 3 "-e, -o"
X
XNormally, ECU starts up with 8 data bits and no parity.
XIf even parity is desired, the
X.B
X-e switch
X.R
Xis specified.
XIf odd parity is desired, the
X.B
X-o switch
X.R
Xis specified.
X
XThese switches
X
X.*s 3 "-p <procname>"
X
XThe 
X.B
X-p switch
X.R
Xcauses ECU to execute the procedure <procname> ("<procname>.ep")
Ximmediately.  Such a procedure is termed the
X.B
Xinitial procedure.
X.R
XAll non-switch arguments after <procname> are passed as arguments
Xto the initial procedure (see the descriptions of the
Xinteger function
X.B %argc
Xand the string function
X.B %argv ).
X
X.*s 3 "-d"
X
XThe
X.B
X-d switch
X.R
Xinstructs ECU to "die" (terminate with error status) if
Xan initial procedure (-p) fails.  This switch ensures a batch
XECU execution will hang up any connection and terminate if
Xa procedure error occurs. See also -D below.
X
XAbsence of the
X.B -d
Xand
X.B -D
Xswitches
Xcauses ecu (upon any completion of the
Xinitial procedure) to enter the 1) interactive mode if a line
Xwas successfully attached by the procedure or 2) the setup menu
Xif no line was attached.
X
X.*s 3 "-D"
X
XThe
X.B
X-D switch
X.R
Xinstructs ECU to unconditionally terminate when an
Xinitial procedure finishes.
X
X.*s 3 "-t"
X
XThe
X.B
X-t switch
X.R
Xinstructs ECU to map incoming and outgoing carriage
Xreturns to carriage return/line feed pairs.
XThis is helpful if the remote connection will be to a
Xterminal with a human operator.  Use of the
X.B
X-h switch
X.R
Xis probably also necessary.
X
X.*s 3 "-A"
X
XNormally, ECU reads the terminal type (TERM environment
Xvariable) to determine whether or not
Xa terminal is "ANSI"-like or not.  -A forces ECU to treat the
Xterminal as an ANSI terminal, regardless of the contents
Xof the $TERM string.
X
X.*s 3 "-N"
X
XThis switch forces ECU to treat the terminal as a non-ANSI
Xterminal.  It has the opposite effect of -A.  You must have
Xa valid function key recognition entry for the $TERM type
Xif this switch is used.
X
X.*s 2 "Environment Variables"
X
XPrior to starting ECU, it is useful, but not necessary,
Xto establish two environment variables, ECUPROMPT and ECUHELP.
X
X.*s 3 "ECUPROMPT"
X
XThe ECUPROMPT environment variable determines the prompt printed
Xby ECU when the interactive command key ("HOME") is pressed.
XWhen you first run ECU, try setting it to your name, e. g.,
X.DS I
Xsetenv ECUPROMPT Ralph    if you use csh
X
XECUPROMPT=Ralph           if you use sh, ksh, etc.
Xexport ECUPROMPT
X.DE
XThen, when you see how it used, you may wish to
Xestablish a more permanent choice in your .login or .profile.
X
X.*s 3 "ECUHELP"
X
XOrdinarily, ECU looks for interactive command help information
Xin "/usr/lib/ecu/ecuhelp.data".
XThe ECUHELP environment may be set to the complete
Xpathname of the ecu help file if an alternate file
Xis to be used.
X
XThe help file is explained later in the section
Xtitled "Online Command Dictionary".
X
SHAR_EOF
$TOUCH -am 1204154690 'doc/_startup.txt' &&
chmod 0644 doc/_startup.txt ||
echo 'restore of doc/_startup.txt failed'
Wc_c="`wc -c < 'doc/_startup.txt'`"
test 8276 -eq "$Wc_c" ||
	echo 'doc/_startup.txt: original size 8276, current size' "$Wc_c"
# ============= doc/_tech.txt ==============
echo 'x - extracting doc/_tech.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_tech.txt' &&
X.*s 1 "Technical Notes"
X
XECU is written in Microsoft/SCO UNIX/XENIX System V C. 
XAs of late, development has been done with
Xthe ODT 1.0 Development System (actually 3.2.1d). Full use
Xis made of function prototyping for ECU functions and external
Xlibrary functions.  The source consists of about 50,000 lines of source
Xfiles (1,200,000 bytes) and 3000 lines of header files (90,000 bytes).
XThe output of "size" for a UNIX version (may be obsolete):
X
X.DS I
Xtext     data    bss     dec    
X179204 + 43244 + 14204 = 236652
X.DE
X
XNote ECU
X
X.*s 1 "Revision Numbers"
X.DS L
XECU revision numbers are defined as follows:
X
X     pppp#.##-#86x
X      ^  ^ ^  ^  ^
X      |  | |  |  `----- 's' if XENIX select(S) in use, 'n' if not,
X      |  | |  |         'u' for UNIX 386 system (always uses select)
X      |  | |  `-------- '2' for 286, '3' for 386
X      |  | `----------- patch level
X      |  `------------- major revision
X      `---------------- package ('unet' for this release)
X
X.DE
SHAR_EOF
$TOUCH -am 1218183590 'doc/_tech.txt' &&
chmod 0644 doc/_tech.txt ||
echo 'restore of doc/_tech.txt failed'
Wc_c="`wc -c < 'doc/_tech.txt'`"
test 973 -eq "$Wc_c" ||
	echo 'doc/_tech.txt: original size 973, current size' "$Wc_c"
# ============= doc/_top.txt ==============
echo 'x - extracting doc/_top.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/_top.txt' &&
X
X.de *s
X.H "\\$1" "\\$2" \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
X.br
X..
X.po 4
X.ll 7.2i
X.ls 1
X.nh
X.tp
X.sp 2i
X.ft B
X.ce 10
XECU 3.00
X
X(Extended Call Utility)
X.ce 0
X.sp 1i
X.ce 100
XPersonal Communications Package
Xfor XENIX System V
X.ce 0
X.ft P
X.sp 2i
X.lp
X.ce 1
XWarren H. Tucker, III <wht@n4hgf.Mt-Park.GA.US>
X.sp 1i
X.ce 100
XTechnical Description
XRevision 3.00
X\n(mo/\n(dy/\n(yr
X.ce 0
X.ls 1
X.PH "'ECU Technical Description''%'"
X.PF "'Public Domain by wht@n4hgf''\n(mo/\n(dy/\n(yr'"
X.nr si 2n
X.nr Cl 9
X.nr Ej 1
X.nr U 1
X.SA 0
X.ul
X.bp 1
X
SHAR_EOF
$TOUCH -am 1218190990 'doc/_top.txt' &&
chmod 0644 doc/_top.txt ||
echo 'restore of doc/_top.txt failed'
Wc_c="`wc -c < 'doc/_top.txt'`"
test 519 -eq "$Wc_c" ||
	echo 'doc/_top.txt: original size 519, current size' "$Wc_c"
# ============= doc/ecu.txt ==============
echo 'x - extracting doc/ecu.txt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/ecu.txt' &&
X.so _top.txt
X
X.so _intro.txt
X
X.so _basic.txt
X
X.so _features.txt
X
X.so _startup.txt
X
X.so _icmd.txt
X
X.so _proc.txt
X
X.so _hdb.txt
X
X.so _exit.txt
X
X.so _tech.txt
X
X.so _end.txt
SHAR_EOF
$TOUCH -am 1203143290 'doc/ecu.txt' &&
chmod 0644 doc/ecu.txt ||
echo 'restore of doc/ecu.txt failed'
Wc_c="`wc -c < 'doc/ecu.txt'`"
test 170 -eq "$Wc_c" ||
	echo 'doc/ecu.txt: original size 170, current size' "$Wc_c"
# ============= doc/runoff ==============
echo 'x - extracting doc/runoff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'doc/runoff' &&
X#!/bin/csh
Xunset noclobber
Xecho 'nroff -mm ecu.txt | col > ecu.man'
Xnroff -mm ecu.txt |& col > ecu.man
X
SHAR_EOF
$TOUCH -am 0420005190 'doc/runoff' &&
chmod 0755 doc/runoff ||
echo 'restore of doc/runoff failed'
Wc_c="`wc -c < 'doc/runoff'`"
test 104 -eq "$Wc_c" ||
	echo 'doc/runoff: original size 104, current size' "$Wc_c"
# ============= models/bsd_uname.ep ==============
if test ! -d 'models'; then
    echo 'x - creating directory models'
    mkdir 'models'
fi
echo 'x - extracting models/bsd_uname.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/bsd_uname.ep' &&
X#  CHK=0xFD46
X#--------------------------------------------------------------
X# bsd_uname.ep - get remote username from bsd system
X# return: $s0 = username
X#         $i0 = 1 if success, else 0
X#--------------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-28-1989-19:36-wht-use named variables
X#:06-25-1989-13:56-wht-new do command syntax
X#:06-25-1989-12:33-wht-new if/while syntax
X#:06-22-1989-13:30-wht-creation
X
X	set $s0='whoami'	# send command
X	do 'oneline'		# get $s0=username
X	ifi $i0 == 0 		# we bombed?
X	{
X		set $i0=%colors; color red
X		echo 'bsd_uname: get user name failed'
X		icolor $i0
X		$i0 = 0
X	}
X
SHAR_EOF
$TOUCH -am 0507232990 'models/bsd_uname.ep' &&
chmod 0644 models/bsd_uname.ep ||
echo 'restore of models/bsd_uname.ep failed'
Wc_c="`wc -c < 'models/bsd_uname.ep'`"
test 673 -eq "$Wc_c" ||
	echo 'models/bsd_uname.ep: original size 673, current size' "$Wc_c"
# ============= models/colors ==============
echo 'x - extracting models/colors (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/colors' &&
X#colors - ecu color file
Xnormal lt_cyan black
Xreverse red white
Xnotify black gray
Xsuccess lt_green black
Xalert yellow black
Xerror red black
SHAR_EOF
$TOUCH -am 1015041989 'models/colors' &&
chmod 0644 models/colors ||
echo 'restore of models/colors failed'
Wc_c="`wc -c < 'models/colors'`"
test 140 -eq "$Wc_c" ||
	echo 'models/colors: original size 140, current size' "$Wc_c"
# ============= models/dir ==============
echo 'x - extracting models/dir (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/dir' &&
X/tmp
X/usr/tmp
SHAR_EOF
$TOUCH -am 1103163889 'models/dir' &&
chmod 0644 models/dir ||
echo 'restore of models/dir failed'
Wc_c="`wc -c < 'models/dir'`"
test 14 -eq "$Wc_c" ||
	echo 'models/dir: original size 14, current size' "$Wc_c"
# ============= models/f.ep ==============
echo 'x - extracting models/f.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/f.ep' &&
X#  CHK=0x1C17
X#+------------------------------------------------------
X# f.eq - colorful finger on remote BSD system
X#-------------------------------------------------------
X#+:EDITS:*/
X#:07-11-1989-16:55-wht-get cmd became lgets
X#:06-30-1989-18:53-wht-creation
X
X	mkvar $icolor; $icolor = %colors
X	mkvar $itimeout; $itimeout = 50
X	send %argv(0)
X	lookfor '\n' 40
X	$s0 = ''
X	whilei 1==1
X	{
X		lgets $s00 $itimeout 5 '\n'
X		ifi $i0 == 0 continue
X		ifi %instr($s0,'% ') >= 0 break # prompt ends it
X		$itimeout = 20
X		color cyan
X		ifi %instr($s0,'Login') == 0 color gray
X		ifi %instr($s0,' i29 ') > 0 color green
X		ifi %instr($s0,' i13 ') > 0 color red
X		ifi %instr($s0,'cma') == 0 color yellow
X		ifi %instr($s0,'gfp') == 0 color lt_blue
X		ifi %instr($s0,'jts') == 0 color lt_blue
X		echo $s0
X	}
X	icolor $icolor
X	send ''
X
SHAR_EOF
$TOUCH -am 0507232990 'models/f.ep' &&
chmod 0640 models/f.ep ||
echo 'restore of models/f.ep failed'
Wc_c="`wc -c < 'models/f.ep'`"
test 815 -eq "$Wc_c" ||
	echo 'models/f.ep: original size 815, current size' "$Wc_c"
# ============= models/file_test.ep ==============
echo 'x - extracting models/file_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/file_test.ep' &&
X#  CHK=0xA2AF
X#------------------------------------------------------------
X#  ftst.ep - test ecu procedure file functions
X#------------------------------------------------------------
X
X ptrace off         # turn off trace mode
X fdel 'ftst.log'    # kill any previous file
X plog 'ftst.log'    # turn on logging
X
X echo ''
X echo 'ftst '+%date+' '+%time
X echo ''
X
X ptrace on                  # turn on trace mode
X
X set $s10 = '/tmp/ftst.tmp' # temp file name
X fdel $s10                  # test proc trace warning
X fopen -w 0 $s10            # open file 0 for write
X set i0=%ftell(0)           # should produce 0
X fputs 0 'abcdefghijk'      # put a line in the file
X set i0=%ftell(0)           # should produce 12
X fclose 0 n                 # close the file
X
X fopen -r 0 $s10    # open again for reading
X fgets 0 $s0        # should produce 'abcdefghijk'
X fseek 0 0          # rewind to read again
X fgets 0 $s0        # should produce 'abcdefghijk'
X fgets 0 $s0        # should produce null string
X set $i0=%fmode(0)  # test file mode function
X fclose 0           # close the file
X
X fchmod 'rw-rw-r-x' $s10 # set mode using string
X set $i0=%fmode($s10)
X
X fchmod 0777 $s10        # set mode using constant
X set $i0=%fmode($s10)
X
X ptrace off              # show file attributes
X echo ''
X echo -n $s10+' has '+%itos(%fsize($s10),06d)
X echo    ' (0x'+%itos(%fsize($s10),x  )+') bytes'
X echo 'accessed '+%edate(%fatime($s10))
X echo 'modified '+%edate(%fmtime($s10))
X echo ''
X ptrace on
X
X # demonstrate "is directory", "is character",
X # "is regular file" functions
X set i0=%isdir($s10),i1=%ischr($s10),i2=%isreg($s10)
X
X fdel $s10 # should say 'deleted'
X ptrace off
X plog off
SHAR_EOF
$TOUCH -am 0507232990 'models/file_test.ep' &&
chmod 0644 models/file_test.ep ||
echo 'restore of models/file_test.ep failed'
Wc_c="`wc -c < 'models/file_test.ep'`"
test 1667 -eq "$Wc_c" ||
	echo 'models/file_test.ep: original size 1667, current size' "$Wc_c"
# ============= models/frame_test.ep ==============
echo 'x - extracting models/frame_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/frame_test.ep' &&
X#  CHK=0xAB0B
X
X	set $i0 = 10
XLABEL
X	ifi $i0 > 0
X	{
X		set $i0,$i0=$i0-1
X		ifi $i0 = 5
X		{
X			echo 'nesting works!'
X		}
X		else ifi $i0 == 4
X		{
X			echo 'else works!'
X		}
X		goto LABEL
X	}
X
X	set $s0 = ''
X	whiles $s0 != 'aaaaa'
X	{
X		set $s0=$s0+'a'
X		ifs $s0 == 'aaaa' break
X		else echo '$s0=\''+$s0+'\''
X	}
X
X	echo 'done!'
SHAR_EOF
$TOUCH -am 0507232990 'models/frame_test.ep' &&
chmod 0644 models/frame_test.ep ||
echo 'restore of models/frame_test.ep failed'
Wc_c="`wc -c < 'models/frame_test.ep'`"
test 317 -eq "$Wc_c" ||
	echo 'models/frame_test.ep: original size 317, current size' "$Wc_c"
# ============= models/gosub.ep ==============
echo 'x - extracting models/gosub.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/gosub.ep' &&
X#---------------------
X# gosub.ep
X#---------------------
X
X	echo 'main'; gosub SUB; echo 'back to main'
X	return
X
XSUB
X	echo 'sub'
X	gosub SUB2
X	echo 'back to sub'
X	return
X
X
XSUB2
X	echo 'sub2'
X	return
X
X
SHAR_EOF
$TOUCH -am 0805144090 'models/gosub.ep' &&
chmod 0644 models/gosub.ep ||
echo 'restore of models/gosub.ep failed'
Wc_c="`wc -c < 'models/gosub.ep'`"
test 198 -eq "$Wc_c" ||
	echo 'models/gosub.ep: original size 198, current size' "$Wc_c"
# ============= models/goto_test.ep ==============
echo 'x - extracting models/goto_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/goto_test.ep' &&
X#  CHK=0xE30F
X# goto_test.ep
X#+:EDITS:*/
X#:06-07-1989-22:31-wht-creation
X	echo '... TRY1 goto test'; goto TRY1
X	echo '... TRY1 goto failed'
X	return
X
XBACK1	echo '... gotob succeeded'
X	gotob COMP
X
XTRY1	echo '... TRY1 goto succeeded'
X	gotob BACK1
X
XCOMP	echo '... COMPuted goto test'; set $s0='COMP'+'UTED',$s0
X	goto $s0
X	echo '... COMP failed'
X	return
X
XCOMPUTED
X	echo '... computed goto worked'
X	echo '... test complete'
X	return
X
X# vi:set tabstop=8:
SHAR_EOF
$TOUCH -am 0507232990 'models/goto_test.ep' &&
chmod 0644 models/goto_test.ep ||
echo 'restore of models/goto_test.ep failed'
Wc_c="`wc -c < 'models/goto_test.ep'`"
test 447 -eq "$Wc_c" ||
	echo 'models/goto_test.ep: original size 447, current size' "$Wc_c"
# ============= models/if_test.ep ==============
echo 'x - extracting models/if_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/if_test.ep' &&
X
X	ifz 0
X		echo 'ifz works'
X	else
X		echo 'ifz broken'
X
X	ifnz 1
X		echo 'ifnz works'
X	else
X		echo 'ifnz broken'
X
X	iflt -5
X		echo 'iflt works'
X	else
X		echo 'iflt broken'
X
X	ifgt 50
X		echo 'ifgt works'
X	else
X		echo 'ifgt broken'
X
X
X	ifz 34
X		echo 'bad news 1'
X	else ifgt -5
X		echo 'bad news 2'
X	else ifge -5
X		echo 'bad news 3'
X	else iflt 5
X		echo 'bad news 4'
X	else ifle 5
X		echo 'bad news 5'
X	else
X		echo 'compound if works'
SHAR_EOF
$TOUCH -am 0813182190 'models/if_test.ep' &&
chmod 0644 models/if_test.ep ||
echo 'restore of models/if_test.ep failed'
Wc_c="`wc -c < 'models/if_test.ep'`"
test 420 -eq "$Wc_c" ||
	echo 'models/if_test.ep: original size 420, current size' "$Wc_c"
# ============= models/keys ==============
echo 'x - extracting models/keys (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/keys' &&
Xstratus
X	F1:F1:esc O q
X	F2:F2:esc O r
X	F3:F3:esc O s
X	F4:F4:esc O t
X	F5:F5:esc O u
X	F6:F6:esc O v
X	F7:F7:esc O w
X	F8:status:dc4
X	F9:no status:nl
X	F10:redisp:esc O y
X	F11:redisp:syn
X	PGDN:cancel:esc O Q
X	END:enter:esc O M
X	PGUP:dispform:esc O R
X	CUU:^:dle
X	CUD:v:so
X	CUL:<:stx
X	CUR:>:ack
X
Xremecu
X	F1:Home:0xC8
X	F2:End:0xC6
SHAR_EOF
$TOUCH -am 1103163889 'models/keys' &&
chmod 0644 models/keys ||
echo 'restore of models/keys failed'
Wc_c="`wc -c < 'models/keys'`"
test 322 -eq "$Wc_c" ||
	echo 'models/keys: original size 322, current size' "$Wc_c"
# ============= models/lookfortest.ep ==============
echo 'x - extracting models/lookfortest.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/lookfortest.ep' &&
X#  CHK=0xFA5C
X# lookfor_test.ep (needs a modem already attached)
X
X	send 'ate0q1'
X	nap 20
X	flush
X
X	send 'at'
X
X	lookfor 'OK'
X	ifi $i0 == 1 echo '... got false success'; return
X	ifi $i0 <> 0 echo '... got illogical result';set $i0;return
X	echo '... got good result for failure to read'
X
X	send 'ate1q0'
X
X	lookfor -e 'OK'+%chr(0x0D)+%chr(0x0A) 20
X	ifi $i0 == 0 echo '... got false failure'; return
X	ifi $i0 <> 1 echo '... got illogical result';set $i0;return
X	echo '... got good result for read'
X
X
X
X# vi: set tabstop=8:
SHAR_EOF
$TOUCH -am 0507232990 'models/lookfortest.ep' &&
chmod 0644 models/lookfortest.ep ||
echo 'restore of models/lookfortest.ep failed'
Wc_c="`wc -c < 'models/lookfortest.ep'`"
test 515 -eq "$Wc_c" ||
	echo 'models/lookfortest.ep: original size 515, current size' "$Wc_c"
# ============= models/mhack_test.ep ==============
echo 'x - extracting models/mhack_test.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/mhack_test.ep' &&
X#  CHK=0xEC1B
X#---------------------------------------------------------------------------
X#  mhack_test.ep - test %mhack while showing entertaining colors
X#  also useful to get a feeling for how fast the procedure language can be
X#---------------------------------------------------------------------------
X#+:EDITS:
X#:03-16-1990-05:25-wht@n4hgf-requires ecu x2.64 or later
X
X	echo 'SIGINT to quit\n'
X	$i20 = %colors
X	$i21 = %colors & 0xFFFFF0FF
X	whilei 1==1
X	{
X		$i0 = %mhack
X		$i1 = $i0 & 0xF00
X		icolor $i21 | $i1
X		echo -n %itos($i0,8d)+%chr(0x0d)
X	}
X	echo ''
X	icolor $i20
X
SHAR_EOF
$TOUCH -am 0507232990 'models/mhack_test.ep' &&
chmod 0644 models/mhack_test.ep ||
echo 'restore of models/mhack_test.ep failed'
Wc_c="`wc -c < 'models/mhack_test.ep'`"
test 578 -eq "$Wc_c" ||
	echo 'models/mhack_test.ep: original size 578, current size' "$Wc_c"
# ============= models/mkdir.ep ==============
echo 'x - extracting models/mkdir.ep (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'models/mkdir.ep' &&
X#  CHK=0x91D9
X system 'mkdir '+%argv(1)
SHAR_EOF
$TOUCH -am 0507232990 'models/mkdir.ep' &&
chmod 0644 models/mkdir.ep ||
echo 'restore of models/mkdir.ep failed'
Wc_c="`wc -c < 'models/mkdir.ep'`"
test 40 -eq "$Wc_c" ||
	echo 'models/mkdir.ep: original size 40, current size' "$Wc_c"
true || echo 'restore of models/nonansikeys failed'
echo End of part 34, continue with part 35
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.