From decwrl!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!uunet!allbery Wed May 16 10:14:22 PDT 1990 Article 1564 of comp.sources.misc: Path: decwrl!elroy.jpl.nasa.gov!sdd.hp.com!cs.utexas.edu!uunet!allbery From: wht%n4hgf@gatech.edu (Warren Tucker) Newsgroups: comp.sources.misc Subject: v12i084: ECU 2.80 manual part 02/03 Message-ID: <88387@uunet.UU.NET> Date: 12 May 90 02:07:00 GMT Sender: allbery@uunet.UU.NET Lines: 2224 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Posting-number: Volume 12, Issue 84 Submitted-by: wht%n4hgf@gatech.edu (Warren Tucker) Archive-name: ecuman2.80/part02 ---- Cut Here and unpack ---- #!/bin/sh # this is ecuman280.02 (part 2 of ecuman280) # do not concatenate these parts, unpack them in order with /bin/sh # file doc/ecu.man continued # if touch 2>&1 | fgrep '[-amc]' > /dev/null then TOUCH=touch else TOUCH=true fi if test ! -r @shar_seq_.tmp; then echo "Please unpack part 1 first!" exit 1 fi (read Scheck if test "$Scheck" != 2; then echo "Please unpack part $Scheck next!" exit 1 else exit 0 fi ) < @shar_seq_.tmp || exit 1 echo "x - Continuing file doc/ecu.man" sed 's/^X//' << 'SHAR_EOF' >> doc/ecu.man && X X X X 5.41 SZ : send via ZMODEM/CRC32 X X usage: sz [] X X X This command invokes ecusz to send file(s) to the remote system using X ZMODEM/CRC32. X X You are prompted to enter filename(s) to send, which may consist of one X or more wildcard specifications. File transfer progress is presented on X a visual display. To abort the transfer, press your interrupt key X (usually DEL unless reset with stty(C)). X X Note: if you specify sending only newer files and the remote receiver X does not support the feature, it may skip (reject) all your files. X Retry the transfer specifying 'N' to 'Transfer only newer files'. X X X X X X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 30 X X X X | | X | File(s) to send: | X | ckermit-5a-130 | X | | X | Binary: Y (no NL-CR/LF translation) | X | Overwrite destination files: Y | X | Send full pathames: N | X | Transfer only newer files: N | X | | X | TAB:next ^B:prev END:perform transfer ESC:abort | X `-- enter file(s) to send ---------------------------------------' X `-- Y: no conversion, N: NLs converted to CR/LF -----------------' X `-- Y: overwrite, N: protect destination files ------------------' X `-- Y: full pathnames, N: strip directory portion from names ----' X `-- Y: send only if source newer than destination, N send all ---' X X X X 5.42 TIme : time of day X X usage: time X X X This command displays the local date and time as well as the current X UTC. X X X 5.43 TTy : console tty name X X usage: tty X X X This command displays the current console tty name. X X X X 5.44 XA : hex to ascii char X X usage: xa [] X X X is a hexadecimal value between 0 and FF; the parity (sign) bit X is stripped and the equivalent ASCII character value is displayed. X X If no argument is supplied, a table of control characters is printed X containing decimal, octal, hex, ASCII identifiers and two-character X control character identifier. X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 31 X X X X 5.45 ! : execute shell X X usage: ! X ! X X X The '!' command is a shell escape. The environment variable SHELL is X read to determine what shell program to execute (e.g., /bin/sh, etc). X If '!' is entered by itself, an interactive shell is started; press ^D X to exit back to ECU. If is supplied, it is executed by the X shell with an immediate return to ECU. X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 32 X X X X 6. Procedure Language X X X Sample procedures are shown in the companion document 'samplproc.man'. X X X X 6.1 Arguments X X X There are five types of arguments to procedure commands: X X Switch X Alphabetic Token X Integer X String X Relational Operators X X This section describes the syntax and construction of each type in turn. X There are separate groups of valid of relational operators for integers X and strings; thus, they are described under the appropriate sections. X X X 6.1.1 Switches X X Switch arguments begin with a hyphen (minus, '-'). The switch argument X must be the first argument after the command. Only one switch argument X is allowed on the command line. If switches '-a', '-b' and '-c', are X available and '-a' and '-b' are desired, '-ab' or '-ba' is entered. X X X 6.1.2 Alphabetic Tokens X X Alphabetic tokens, for lack of a better term, are non-integer, non- X quoted terms used as arguments for certain commands, such as: X X plog off X X Such argument types are fairly simple to understand and use; they are X described here for completeness. X X X 6.1.3 Integers X X Integer values are 32-bit quantities ranging between -2147483647 and X 2147483647. X X In one case, an integer is used to store a 32-bit color mask as X described by the color command and the %colors integer function. X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 33 X X X X 6.1.3.1 Constants X X Integer constants are numeric strings, optionally with an initial minus X sign, the absolue value of which must be less than 2147483648. X X X 6.1.3.2 Variables X X There are 50 numbered, permanent integer variables referenced by the X terms '$i0' through '$i49'. When ECU is started, the value of each X variable is zero. Variables retain their value until changed, even X between procedure executions. The integer variable number may be X expressed as an expression by enclosing an integer expression in X brackets. For instance: X X $i[4+5] refers to $i9 X X $i2=5 X $i[20+$i2] refers to $i25 X X X Integer variables may be created for use as "local" variables or to X promote code readability. Refer to the mkvar command. X X X 6.1.3.3 Functions X X ECU has many built-in functions which return the value of ecu- or X system-related information. A list of the functions appears in a later X section. X X X 6.1.3.4 Expressions X X In almost any place an integer argument is allowed, an expression may be X supplied. Expressions are composed of two or more integer constants or X variables separated by operators from the group: X X + addition X - subtraction X * multiplication X / division X | OR X @ MOD X ^ XOR X & AND X X Evaluation of expressions is left-to-right. Parentheses are not X allowed. X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 34 X X X X 6.1.3.5 Relational Operators X X Integer relational operators are chosen from the following group: X 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 X X X 6.1.4 Strings X X Strings are classic concatenations of zero or more eight-bit characters. X In general, the maximum size of a string used by ECU is 256 characters. X X X 6.1.4.1 Constants X X String constants are formed by placing alphanumeric characters between X single quote characters (apostrophes). The backslash ('\') character is X used to "escape" certains characters: X X '\' one backslash X '0 newline X '' tab X ''' apostrophe X X X X 6.1.4.2 Variables X X There are 50 numbered, permanent string variables referenced by the X terms '$s0' through '$s49', each possessing a maximum length of 256 X characters When ECU is started, the value of each variable is null (zero X length). Variables retain their value until changed, even between X procedure executions. The string variable number may be expressed as an X expression by enclosing an string expression in brackets. For instance: X X $s[4+5] refers to $s9 X X $s2=5 X $s[20+$s2] refers to $s25 X X X String variables may be created for use as "local" variables or to X promote code readability. Refer to the mkvar command. X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 35 X X X X 6.1.4.3 Functions X X ECU has many built-in functions which return the value of ecu- or X system-related information. A list of the functions appears in a later X section. X X X 6.1.4.4 Expressions X X String expressions are formed by the concatenation of string constants, X variables and function return values using the '+' operator: X X Example: X 'The quick brown fox jumped over the '+$s0'+' dog at '+%time X X X X 6.1.4.5 Relational Operators X X String relational operators are chosen from the following group: X X = "is equal to" X == "is equal to" X != "is not equal to" X <> "is not equal to" X X X X X 6.2 Commands X X X X 6.2.1 baud X X usage: baud X X This command sets the baud rate for the attached line. The integer X argument must be one of 110, 300, 600, 1200, 2400, 4800, X 9600, 19200 and 38400. X X Example: X baud 9600 X set $i0=2400; baud $i0 X X X X 6.2.2 break X X usage: break X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 36 X X X X This command is used inside a whilei or whiles compound statement to X exit the loop. X X Example: X X whilei 1=1 #forever unless break command executed X { X echo -n 'Answer yes or no: ' X set $s0=%cgets # get answer X ifi %instr($s0,'y') == 0 set $i0 = 1; break X ifi %instr($s0,'n') == 0 set $i0 = 0; break X # got neither 'y' nor 'n' ... keep trying X } X # now $i0 = 1 if yes, 0 if no X X X NOTE: further examples of break usage may be found in the example for X the else command. X X X 6.2.3 cd X X usage: cd X X This command changes ECU's current working directory. The string X argument may contain any directory pathname X specification legal to be submitted to the shell csh. Wild card X characters may be used, provided the expansion produces only one X pathname. X X X Example: X X cd '~user/bin' X cd %envvar('HOME')+'/bin' X X X X 6.2.4 clrx X X usage: clrx X X This command clears the attached line's transmitter XOFF state. X Issuing the command is the equivalent to receiving an XON from the X remote system. X X X 6.2.5 cls X X usage: cls X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 37 X X X X This command clears the screen. X X X 6.2.6 color X X X usage: color [] X usage: color -r [] X X X This command changes the current normal or reverse video colors in a X manner similar to the setcolor(C) command. It has no effect on systems X using a monochrome monitor. If the second (background) color is X omitted, it is assumed to be black. X X The command also forces normal video mode. Refer to the vidnorm and X vidrev commands. Refer also to the vidcolor command. X X X Color names X blue magenta brown black X lt_blue lt_magenta yellow gray X cyan white green red X lt_cyan hi_white lt_green lt_red X X Example: X X color lt_green # normal video light green on black X color -r red white # reverse video red on white X X X X 6.2.7 continue X X usage: continue X X This command is used inside a whilei or whiles compound statement to X skip the remainder of any commands in the loop and continue execution at X the first command in the loop. X X X X X X X X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 38 X X X X Example: X X send '' # send ENTER to get prompt X whilei 1=1 # forever unless break command executed X { X lookfor -e 'login: ' # look for login prompt X ifi $i0 == 0 # if we dont get prompt ... X { X send '' # send ENTER again X continue # and look for login prompt X } X send $s_name # send username X lookfor -e 'Password:' X send $s_password X get -e 0 50 # wait 10 seconds for response X X # if incorrect not found in response, ... X if %instr($s0,'incorrect') < 0 # ... must have won X break X X # garbled line?: system will send another 'login: ' X } X X X X NOTE: further examples of continue usage may be found in the example for X the else command. X X X 6.2.8 cursor X X usage: cursor [] X X This command places the cursor at a specified position on the video X screen. The top left of the scrren is row 0, column 0. If is not X specified, it is assumed 0 (left margin). X X Example: X X cls X $i0 = 5 X whilei $i5 < 12 X { X cursor $i5 X echo 'This is line '+%itos($i5,2d)+' of the display' X } X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 39 X X X X 6.2.9 delline X X usage: delline X X This command deletes the current line from the video display. X X X 6.2.10 dial X X usage: dial X X This command causes an outgoing call to be placed. The string argument X can take one of two forms: a numeric telephone number or an X alphanumeric "logical" number or system name. X X A numeric phone number ('1(800)555-1212' or '2345678') must begin with a X digit and must consist entirely of digits, parentheses or hyphens. If a X telephone number is supplied, the phone number is dialed; you must first X have set the desired baud rate and parity using the 'baud' and 'parity' X commands. X X If a logical name is entered, the phone directory (managed by the X interactive dial command) is searched; if the entry is found, the baud X rate and parity is automatically set from values in the directory entry; X then, the number in the directory entry is dialed. X X When the dial command returns, integer variable $i0 is set to a status X code and string variable $s0 has a text message (the modem verbal result X code if the ecu dialer is used, a representation of the return status X code if a uucp dialer is used [see below]). X X Dial Command $i0 Status Codes X X 0 successful connect X 1 failed to connect (call progress) X 2 dial interrupted by signal X 3 modem error (non responsive or commands rejected) X X X X X X X X X X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 40 X X X X Dial Command $s0 Status Messages (uucp dialer) X X CONNECT #### #### = baud rate X BUSY only some modems X NO ANSWER only some modems X NO CARRIER most generic "fail to connect" X NO DIAL TONE only some modems X !Connect bad baud rate modem reported different rate X !Interrupted call interrupted by signal X !Invalid arguments ecu error X !Invalid phone number too long or bad characters X !Ioctl error should not be reported here X !Line in use should not be reported here X !Line open error should not be reported here X !Modem Error modem did not respond X X Note: if the ecu dialer is used, the actual modem result code X is returned in $s0 or one of the following two strings: X X !Interrupted call interrupted by signal X !Modem Error modem did not respond X X X X 6.2.11 do X X usage: do [ ...] X X This command executes a procedure whose name appears as the command's X first (string) argument. One or more arguments (up to 19) may be passed X to the called procedure; an argument may consist of any valid string X expression, provided, that, when expanded, the argument does not exceed X 256 characters in length. X X The called procedure may read its arguments using the %argv string X function. %argv(0) is the name of the procedure. The quantity of X arguments may be obtained using the %argc integer function. X X X Example: X X do 'proc' %rname %date+' '+%time %argv(0) X X Note: in this example, the called procedure is passed the name X of the calling procedure as the last argument. X X X X 6.2.12 duplex X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 41 X X X X usage: duplex full | half X duplex 'full' | 'half' X X X This command specifies whether or not ecu is to locally echo characters X typed by you at the keyboard. The overwhelming majority of remote X systems provide the echo function, in which case full duplex must be X used. For the rare occasions when the remote system does not echo your X keyboard input, setting half duplex will allow you to see what you are X typing. X X When communicating with another terminal in a "teletype conversation", X setting half duplex is generally required. In such cases, use of the X interactive nl, nlin and nlout commands may also be required. X X Example: X X duplex full X $s0 = 'full'; duplex $s0 X X X X X 6.2.13 echo X X usage: echo [-n] X X This command prints the contents of the string argument on the X screen. If the -n switch is not present, a newline follows the output X of . X X Example: X X echo 'Procedure '+%argv(0)+' executing at '+%time X echo -n 'Enter your first name: '; $s0 = %cgets X X X X 6.2.14 eeol X X usage: eeol X X This command erases the video display to the end of the line. X X X 6.2.15 else X X X This statement may follow an ifi or ifs command to specify one or more X statements to be executed if the if-type command condition is false. X Else commands may be chained together in the traditional structured X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 42 X X X X usage: else X X else X X X else X { X any kind and number of statements X } X X else X X else X { X any kind and number of statements X } X X X language manner. X X For the purposes of describing this command, is any single X or compound statement NOT containing a whilei or whiles command. If you X wish to have a while-type command executed as part of an else condition, X the while must occur within braces ("{}"). X X is an ifi or ifs command followed by an (see the X description of the ifi or ifs commands below). X X X X X X X X X X X X X X X X X X X X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 43 X X X X Example: X X #+------------------------------------------------------ X # finger.ep - procedure to send 'finger' to remote X # BSD Unix system; print resulting lines in different X # colors: uucp logins green, root red, others cyan X #------------------------------------------------------- X X mkvar $icolor; $icolor = %colors X mkvar $itimeout X $itimeout = 50 # timeout for first line 5 secs X send 'ps -aux' # send command, but do not echo X lookfor '0 40 # swallow command X whilei 1==1 # forever, or until break X { X lgets 0 $itimeout 1 '0 #get a line X ifi $i0 = 0 break #if no chaacters read X $itimeout = 10 #wait 1 sec for later lines X X ifi %instr($s0,'% ') >= 0 # if csh prompt seen X break # exit while loop X else ifi %instr($s0,'Login') >= 0 X color gray X else ifi %instr($s0,'root') >= 0 X color red X else ifi %instr($s0,'uucp') >= 0 X color green X else color cyan X echo $s0 X } X icolor $icolor #restore entry colors X send '' #force a new prompt from remote X X X X X 6.2.16 exit X X usage: exit [] X X This command causes an abrupt termination of the ecu program. Any X existing connection with a remote system is terminated immediately. If X no integer argument is found, ecu exits with a program exit X status of 0. If is found and the value is zero, then ecu exits X with a program exit status of 0. If non-zero,its value must be X in the range of 1 to 31, and ecu exits with a program exit status of 192 X plus . This feature allows batch executions of ecu by shell X script and ECU procedure to detect ECU execution status. X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 44 X X X X 6.2.17 expresp X X usage: expresp [-v[v...]] [] X X This command emulates the uuchat function as described in the SCO HDB X UUCP documentation and in the /usr/lib/uucp/Dialers file. X X -v causes the expect-respond conversation between ECU and the remote X system to be displayed on the screen. This switch is automatically X enabled if procdedure tracing is enabled. X X multiple v's (e.g., -vv, -vvv) up to 3 'v's produce more verbose debug X output. -vv causes each base level expect and respond string to be X displayed. -vvv causes a hexadecimal dump of each interpreted expect X string to be displayed. X X is as defined in /usr/lib/ecu/Dialers. X X Meaning of some of the escape characters: X - pause (approximately 1/4-1/2 second delay) X X - delay (2 seconds) X D - phone number/token X T - phone number with Dialcodes and character translation X N - null byte X K - insert a BREAK X E - turn on echo checking (for slow devices) X \--carriagefreturnchecking X - send new-line X n - send octal number X Speed - Hayes-specific speed-adaptive connect handler X X X specifies an optional timeout in milliseconds for X waiting on expect strings; it defaults to 10,000 milliseconds (10 X seconds). The resolution for timeouts is limited to the basic tick time X of your system (HZ, 10 msec for UNIX/386, 20 msec for XENIX/386 and X XENIX/286). The timeout for 'Speed' expects is fixed at 90 seconds. X X X 6.2.18 fchmod X X usage: fchmod X X This command sets the mode of to . The argument X takes one of two forms, a nine-character mode string (e.g., 'rwxr-xr-x') X or an integer value (0755). The argument is either a string X value forming a filename or an integer file number representing a file X opened with the fopen command. X X The command sets $i0 = 0 if successful, else to the errno from the X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 45 X X X X associated system call (refer to the %errstr string function and/or X /usr/include/sys/errno.h). X X X Example: X X fopen 1 '/tmp/123'; fchmod 'rwxrwxrwx' 1 X fchmod 'rwxrwxrwx' '/tmp/123' X fopen 1 '/tmp/123'; fchmod 0777 1 X $i0 = 0777; fchmod $i0 '/tmp/123' X X All of the above example result in the same result. X X X X 6.2.19 fclose X X usage: fclose X X This command closes . The argument is an integer file X number representing a file opened with the fopen command. X X The command is ignored if is not open. No integer variable is X modified by fclose. X X X Example: X X fclose 1 X X X X 6.2.20 fdel X X usage: fdel X X This command removes a file. X X The command sets $i0 = 0 if successful, else to the errno from the X associated system call (refer to the %errstr string function and/or X /usr/include/sys/errno.h). X X X Example: X X fdel '/tmp/123' X X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 46 X X X X 6.2.21 fgetc X X usage: fgetc X X This command reads a character from . The argument is an X integer file number representing a file opened with the fopen command. X X The argument is either a string variable or an integer X variable. If the file has reached end of file: an integer variable X receives -1; a string variable is returned null. Otherwise, the X character's numeric value (0-255) is placed in an integer variable or a X string variable is returned with a length of one with the file character X as its only character. X X X Example: X X fgetc 1 $s0 X fgetc 1 $i_input X X X X 6.2.22 fgets X X usage: fgets X X This command reads a character from . The argument is an X integer file number representing a file opened with the fopen command. X X The argument is a string variable. If the file has reached end X of file, is returned null and integer variable $i0 is set to 1. X Otherwise, the receives input from the file minus the trailing X newline and $i0 is returned zero. X X X Example: X X fgets 1 $s0 X X X X 6.2.23 fkey X X usage: fkey X X This command selects a function key definition from the ~/.ecu/keys X file. X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 47 X X X X 6.2.24 flush X X usage: flush X X This command causes any characters received by the system from the line, X but not yet read by the procedure to be "forgotten" or flushed. X X X 6.2.25 fopen X usage: fopen [-switches] X X This command opens a file named by the string argument and X associates it with the user-chosen file number (which must be X an integer value between 0 and 4, inclusive). X X The argument switches govern how a file is opened and must be chosen X from this list: X X -r The file is opened read-only; if it does not exist, an X error occurs. X X -r+ The file is opened for reading and writing; if it does X not exist, an error occurs. X X -w The file is opened for writing (any previous contents of X the file are lost); if it does not exist, it is created. X X -w+ The file is opened for reading and writing (any previous X contents of the file are lost); if it does not exist, it X is created. X X -a The file is opened for appending (writes to the file are X added to the previous file contents); if it does not X exist, it is created. All writes are appended to the X file (the fseek command has no effect). X X The switches parameter may be omitted; in such cases, the file is opened X as though '-r' had been supplied. However, if procedure tracing is X enabled (see the description of the interactive and procedure command X ptrace), a warning message will be issued. X X The command sets $i0 = 0 if successful, else to the errno from the X associated system call (refer to the %errstr string function and/or X /usr/include/sys/errno.h). X X Example: X X fopen 0 -r '/etc/passwd' X fopen 1 -w+ '/tmp/123' X fopen 2 -a 'tranact.log' X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 48 X X X X 6.2.26 fputc X X usage: fputc X X This command writes character into . The argument X is an integer file number representing a file opened with the fopen X command. Argument is a integer value of which the lower eight X bits are used or a string value of which the first character is used. X X If a write error occurs, procedure execution is terminated. X X Example: X X $s0='abc'; fputc 1 $s0 writes 'a' X $i0=0x30 ; fputc 1 $i0 writes '0' X X X X 6.2.27 fputs X X usage: fputs [-n] X X This command writes the string into . The argument X is an integer file number representing a file opened with the fopen X command. X X If the switch '-n' is omitted, a newline is appended after in the X file; if present, no newline is written. X X If a write error occurs, procedure execution is terminated. X X Example: X X $s0='abc'; fputc 1 $s0 writes 'a' X X X X 6.2.28 fseek X X usage: fseek X X This command sets the file position of to is open for append ('-a'), then the fseek command will X have no effect. X X X X X X X X Public Domain by wht@n4hgf 5/7/90 X X X X X X X X ECU Technical Description 49 X X X X 6.2.29 getf X X X usage: getf -x X X where: -x == X -b byte X -w word (little-endian) X -W word (big-endian) X -l 32-bits (little-endian) X -L 32-bits (big-endian) X X X X 6.2.30 goto X X usage: goto