📄 xc.nro
字号:
bind_function 26 "quitchr"This binds Control-Z to quit the XC program..TP.I bind_scriptSyntax: bind_script \fIcode\fR "scriptname"Bind the character identified by the number specified by \fIcode\fR to executethe script named by "scriptname".Upon termination of the script, the program will resume terminal mode, unlessthe "quit" script function was executed.Examples: bind_script 18 "/usr/lib/xc/.rz"This binds Control-R to execute the script /usr/lib/xc/.rz. The .rz scriptsupplied with the source code contains: tty "on" echo -n "What files are to be received? " read FILES transmit "sz -y " transmit FILES transmit "^M" echo "Starting ZMODEM Receive (rz -y)" pipe "rz -y"Pressing \fBXCAPE\fR \fB^R\fR will ask for some file name(s), and start an.B szcommand on the remote system, and an.B rzon the local system to receive the file(s). bind_script 19 "/usr/lib/xc/.sz"This binds Control-S to execute the script /usr/lib/xc/.sz. The .sz scriptsupplied with the source code contains: tty "on" echo -n "What files are to be sent? " read FILES echo "Starting ZMODEM send (sz -y " FILES ")" pipe "sz -y " FILESPressing \fBXCAPE\fR \fB^S\fR will ask for some file name(s), and then launch.B szon the current system..B Szwill itself start an.B rzprocess on the remote system..TP.I bind_stringSyntax: bind_string \fIcode\fR "string"Bind the character identified by the number specified by \fIcode\fR to emit thestring specified by "string".The string is sent to the modem untranslated; eg, it is not examined forembedded terminal mode escapes.Example: bind_string 49 "AAATZ^M"This binds "1" to send the sequence to reset the modem..TP.I breakSyntax: breakExits from the immediately enclosing 'while' loop. Identical to the C language\&'break', and to the Bourne shell 'break' except that the.B xcscript language 'break' does not take a numeric argument. Don't confuse thiswith the script keyword 'xmitbrk', which sends a BREAK signal to the modem port..TP.I callSyntax: call "scriptname"Suspends execution of the current script, and attempts to load and run thespecified scriptname. The scriptname must be a quoted literal string. There isno.B xcanalogue of the Bourne shell "exec" command; all subscripts in.B xcare treated as sub-routines. All variables are global across subscripts, so ifa subscript changes the value of a variable, then that change will remain ineffect after return to the parent script. Shell environment variables cannot bechanged by any.B xcscript..TP.I captureSyntax: capture "on" capture "off"Turns the file-capture function on or off. Note that the arguments must bequoted literal strings. Note also that when the script exits into terminalmode, the file-capture function is turned off. If you have 'set auto "on"',then you will begin capturing immediately upon entering, or returning to,terminal mode. If not, then you must manually type "\fBXCAPE\fR \fBY\fR" tostart capturing when entering terminal mode..TP.I continueSyntax: continueResumes execution at the top of the immediately enclosing 'while' loop.Identical to the C language 'continue' instruction, and to the Bourne shell\&'continue' command except that no numeric argument is accepted..TP.I debugSyntax: debug "on" debug "off"If the 'debug' option is on, then.B xcwill make many parenthetical comments about what it's doing while it runs thescript. These comments can sometimes be helpful in debugging script logic. Notethat the argument must be a quoted literal string.While debugging a script containing a password, turn this option off, then onagain, to reduce the excitement-level of any colleagues collected circa yourscreen..TP.I decrSyntax: decr <numeric-variable>Decrements the value of the specified numeric user variable by 1. Useful incontrolling loop execution. If the specified variable isn't numeric, or doesn'texist, a syntax error results..TP.I dialSyntax: dial "number-string"Dials the specified number, using modem-command strings defined in xc.h.The number should not contain spaces; dashes are acceptable..TP.I echoSyntax: echo "string" <variable> ... echo -n "string" <variable> ...This command sends its arguments to the user's terminal. The number ofarguments is optional, except that the total result may not exceed 80characters. Variables and back-quoted shell commands are expanded as necessary.If the "-n" switch is present, then no carriage-return/newline sequence isappended to the output.Examples: echo "The time and date are now " `date` echo "My terminal type is " $TERM echo "My terminal type is " $TERM " today."Note that whitespace isn't echoed unless it's part of a quoted literal string..TP.I exitSyntax: exitTerminates execution of the current script. If a script reaches its end, itexits automatically, so 'exit' is useful mainly to terminate a scriptprematurely..TP.I falseSyntax: falseSame as the Unix 'false' command. Does nothing, but returns a FALSE statusvalue. Useful within conditional expressions.Example: if waitfor "CONNECT" 30 eq false then quit endifNote that above example could be rewritten using the negating modifier "!": if ! waitfor "CONNECT" 30 then quit endifand note too that the "!" must be separated from its argument by whitespace..TP.I fileSyntax: file <script-command>The standard output of the specified script command is sent to the currentcapture file. If the "capture" option is not set, then an error message isdisplayed, but script execution continues.Examples: file echo "--------- CUT HERE ----------"Sends the output of the 'echo' command to the current capture file, providedthat the "capture" option is now "on". file echo `date`Sends a timestamp to the current capture file, provided that the "capture"option is now "on". The same thing could have been done with file shell "date".TP.I hangupSyntax: hangupTells the modem to go on-hook..TP.I if\ \ Syntax: if <list1>; then <list2>; [ else <list3>; ] endifIf <list1> evaluates as TRUE, performs <list2>; otherwise, if <list3> isspecified, performs <list3>; then resumes execution immediately following\&'endif'. To accommodate those whose minds wander while writing scripts, 'fi'is an acceptable synonym for 'endif'.Each list may consist of any number of script commands separated by semicolonsor newlines. The value of <list1> is determined by inclusively OR'ing the valueof each directive in the list, so that if any of the directives in <list1>evaluates as TRUE, then so will <list1>. <list1> is performed in its entiretyregardless of the value of any of its component commands.The keywords 'then', 'else', and 'endif' (or 'fi') must be immediately precededby command separators, either a semicolon or a newline, just as is the case inthe Bourne shell.For conditional evaluation in 'if' and 'while' constructions, the followingcomparators are available in addition to the script directives mentionedelsewhere: <varname1> eq "string" <varname1> eq <number> <varname1> eq <varname2> <varname1> "string"evaluates as TRUE if the value of user variable <varname1> is the same as thatof a specified string or numeric constant or of a specified second variablename. If the variable name <varname1> is not followed by anything else, thenthe expression evaluates as TRUE if the variable is numeric and has a non-zerovalue, or if the variable is a string variable and has a non-zero length;otherwise, the expression evaluates as FALSE. Comparing a string variable to anumeric variable, or vice-versa, causes a syntax error.If a conditional expression consists only of a quoted literal string, theexpression evaluates as TRUE if the string's length is non-zero, and otherwiseevaluates to FALSE. Because environment variables and back-quoted shellcommands are treated as if their output/value were quoted literal strings, thisallows direct testing of a shell command or of an environment for non-zerolength. Nonexistent environment variables are treated as if they exist with thevalue "" (a string of zero length). <varname1> neq "string" <varname1> neq <number> <varname1> neq <varname2>evaluates as TRUE if the value of user variable <varname1> is not equal to thatof a specified string or numeric constant or of a specified second variablename. Comparing a string variable to a numeric variable, or vice-versa, causesa syntax error. <varname1> lessthan "string" <varname1> lessthan <number> <varname1> lessthan <varname2>evaluates as TRUE if the value of user variable <varname1> is less than that ofa specified string or numeric constant or of a specified second variable name.String variables are compared lexically according to ASCII value. <varname1> morethan "string" <varname1> morethan <number> <varname1> morethan <varname2>operates identically to 'lessthan', except in reverse.The value of any conditional expression may be negated by preceding it with anexclamation point followed by a space or tab.Examples: if counter eq 0; then break; endif; if var1 eq var2; then echo "identical"; endif if counter morethan 20; then break; endif; if counter lessthan 0; then break; endif; if ! counter; then echo "counter is " counter; endifTo perform a list if any of a set of conditions exist: if counter morethan 5; counter eq brkvalue; # a second comparator then break; endif;i.e., perform the 'break' directive if the value of numeric uservariable 'counter' is greater than the numeric constant 5, or if the valueof 'counter' is equal to that of the user numeric variable 'brkvalue'..TP.I incrSyntax: incr <numeric-variable>Increments the value of the specified numeric user variable by 1. Theopposite of 'decr'..TP.I linkedSyntax: linked\&'linked' is a pseudo-function that evaluates as TRUE if the current script hasbeen invoked from the dialing directory, and as FALSE otherwise.Example: if ! linked; then dial "5551212" endif.TP.I pauseSyntax: pause <number>Suspends execution for the specified <number> of SECONDS. Identical to Unix"sleep.".TP.I pipeSyntax: pipe "<shell-command>"The standard input and standard output of the specified shell command areconnected to the modem port, and the command is executed. This is theequivalent of the command mode "$" command.Examples: pipe "echo \\"\\177\\""sends a DELETE character to the modem. pipe "rz"performs a file receive via ZMODEM, assuming that Chuck Forsberg's 'rz/sz'programs reside on your system..TP.I portnameSyntax: portnameThis isn't a command, but a synonym for the current modem terminal device,treated as if it were a quoted string. Useful if modems of differing types areattached to different terminal lines and need different dialing orinitialization sequences. To compare the value of 'portname' to some otherstring, you must first assign a user variable equal to 'portname'.Examples: assign myport eq portname if myport eq "/dev/tty01" then transmit "AT&E0^M" endif.TP.I quitSyntax: quitExits the script and terminates.B xcentirely. Any LCKfile will be removed if possible and theuser's terminal will be restored to the state it was in when.B xcwas invoked..TP.I readSyntax: read <variable-name>Takes a string from the user's keyboard and places it into the specified uservariable. Any previous value of the specified variable is discarded..TP.I redialSyntax: redialRedials the number most recently dialed with the 'dial' command..TP.I seenSyntax: seen "string" <number>Evaluates as TRUE if "string" has occurred within the last <number> charactersreceived during the most recent 'waitfor' command. Only up to 2048 charactersare remembered at any one time during 'waitfor' processing. If no <number> isspecified, then all the characters received during the most recent 'waitfor'command are examined, up to a maximum of 2048. The 'seen' buffer is reset atthe beginning of each 'waitfor' command. This is useful to tell which ofseveral strings has been received.Example: if waitfor "string1" 20 then echo "Received 'string1'." else if seen "string2" then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -