proc.txt
来自「一个通讯程序源码」· 文本 代码 · 共 292 行
TXT
292 行
.de *s.H "\\$1" "\\$2" \\$3 \\$4 \\$5 \\$6 \\$7 \\$8.br...po 4.ll 7.2i.ls 1.nh.tp.sp 2i.ft B.ce 10ECU(Extended Call Utility).ce 0.sp 1i.ce 100Research and EngineeringAsynchronous Communications Packagefor SCO UNIX 3.2 and XENIX System V,ISC 386/ix 2.2 (or later),SunOS 4.1, ISC System V Release 4and ESIX System V Release 4.ce 0.ft P.sp 2i.lp.ce 1Warren H. Tucker, III <wht@n4hgf.Mt-Park.GA.US>.sp 1i.ce 100Procedure LanguageRevision 3.24\n(mo/\n(dy/\n(yr.ce 0.sp 1i.ls 1NOTE: Many sections of the manual are likely to be obsolete at any giventime until the writer get lots of free time. Much of it was written whenthe program was supported only on SCO XENIX and UNIX. .PH "'ECU Procedure Language''%'".PF "'Public Domain by wht@n4hgf''\n(mo/\n(dy/\n(yr'".nr si 2n.nr Cl 9.nr Ej 1.nr U 1.SA 0.ul.bp 2.*s 1 IntroductionProcedures are "programs" or "scripts" written in an addled butadequate language which ECU executes upon demand.The documentation refers to procedures as files on the diskor as in-memory copies under execution.An "initial procedure" may be executed when ECU starts up (seethe description of the -p command line switch). Certain specialprocedures are executed automatically as described below in thesection "Special Procedures."The procedures themselves are source files consisting ofthe procedure "name" with an extension of ".ep".When executing a procedure by name,.DS Ido name interactive-or-do 'name' from inside a procedure.DEis sufficient if the procedure is in the current directory,the user's ~/.ecu directory or in the ECU librarysubdirectory "ep" (normally /usr/local/lib/ecu/ep).Procedure filesare searched for in the above order, so you may havea system default in the lib directory, a user defaultin the ~/.ecu directory and a specific version in the currentdirectory all by the same name.You may execute a procedure by specifying it's full pathname(minus the .ep extension). For example:.DS Ido /tmp/doit interactive invocation of /tmp/doit.ep-or-do '/tmp/doit' from inside a procedure.DEMany example procedures, some quite useful, some not so,are found in the models subdirectory of the release.There are also many fragmentsused as examples throughout the following sections..*s 1 "Line Syntax (Labels, Commands and Comments)"Lines in a procedure consist of an optional label, followed by optional commands andarguments. Anything on a line after an octothorpe (#) outsideof quote marks is ignored (read "# is the comment character")..DS LExample:----------------------------------------------------------------------# example procedure echo 'Hello. Please tell me your name.' $s0 = %cgets # read string from console into string variable $s0 ifs $s0 == 'foo' goto label echo 'Hello there, '+$s0 returnlabel echo 'You must be kidding.'----------------------------------------------------------------------.DELabels must begin in column one.A label may appear on a line by itself or with a commentappended. A common mistake I make (from writing too much C) isto append a colon to a label declaration; this does not work unlessyou also "goto label:". Labels are not allowed inside braces(inside of compound statements); you may get away with it sometimesbecause the procedure language processor is written for speed, notpolitical correctness.Commands must have white space before them andwhite space before each argument..so _p_param.txt.so _p_ifunc.txt.so _p_sfunc.txt.so _p_cmd.txt.*s 1 "Special Procedures"ECU provides for special "hook" procedures to be executedat certain times. Their use is encouraged, but you musttake precautions not to excecute any unreasoable commandsin them, for the are rather "raw" hooks and it is easily possibleto confuse ECU by performing illogical operations in them. Judicious use can, however, be quite productive.They are searched for in the same manneras any other procedure, so you can have acustomised version of them in a working directory and a defaultin your ~/.ecu subdirectory. No error is reported if they are not found..*s 2 "_rc.ep"Afer ECU is initialized, but before it presents the setupscreen or executes a -p initial procedure,procedure '_rc' is executed with no arguments.(It is named in the tradition of /etc/rc, .mailrc, etc..)This procedure can be used to customize the ecu environmentprior to beginning the usual operation. This is not a placeto do any dialing or long-lived operations, nor is it possible tobypass the setup screen: for this, use the -p initial procedure.The %getenv() function may be useful in here (Am I running on anxterm? Do I want to change the prompt string fromthe default environment variable $ECUPROMPT?).Procedure commands likely to be of interest here:.DS I autorz* baud color dcdwatch* duplex prompt rtscts* setline.DECommands marked with an asterisk affect the initial (default)values presented on the setup screen.If _rc.ep returns a non-zero status or fails (due to syntax orother error), ecu terminates immediately..*s 2 "_connect.ep"This procedure is executed after every connection successafter the CONNECT message ("result code") is printed.It is passed one argument, the "result code" stringgenerated by the dialer function (e.g., "CONNECT 19200").You may use %rname and other functions and features to customizethis function based on the particular system just reached. Notethat integer variable $i0 and string variable $s0 set zero priorto executing the function. This function may modify the behaviorof coorperating dialer functions by setting the value of numberedstring or integer variables. In particular, the dialer functionwill inherit the values of $i0 and $s0 when this special functionterminates..BBe careful of what you do in here since MANY ecu procedure commandsaffect $i0 and $s0 as a side effect of their operation..REven if you know what you do in _connect.ep does not modify $i0or $s0, use of the preservation technique shown in the examplebelow may save you headaches if you add to the function in thefuture (long after you have forgotten this pedantic admonition).If this procedure fails (abnormal procedure terminationor non-zero return code), ECU hangs up on the line and proceedsas if the connection failed..DS LExample:#+------------------------------------------------------------------# _connect.ep - post-CONNECT special "hook" procedure#-------------------------------------------------------------------#+:EDITS:*/#:09-10-1992-13:58-wht@n4hgf-ECU release 3.20#:08-22-1992-15:38-wht@n4hgf-ECU release 3.20 BETA#:07-13-1991-14:47-wht@n4hgf-creation $iv0_save = $i0 # it is a VERY good idea to save the dialer $sv0_save = $s0 # function return status # since gobs of functions and commands modify $i0 # and/or $s0 as a side effect of their operation $s30 = '_connect '+%rname+' ('+%argv(1)+')' echo $s30 # this still will also live to be visible by # the dialer function ifi %baud > 2400 { xon off # turn XON/XOFF off first, then ... rtscts on # turn on RTS/CTS } else { rtscts off # turn off RTS/CTS, then ... xon on # turn XON/XOFF on } $i0 = $iv0_save # restore dialer return status $s0 = $sv0_save.DE.*s 2 "_connfail.ep"This procedure is executed after every connection failure afterthe failure message ("result code") is printed. It is passed twoarguments, the logical system name (the dial directoryentry name or the phone number)and the "result code" string generated by the dialerfunction (e.g., "BUSY"). The function is called after $i0 hasbeen set to 1 and $s0 has been set to the result code. Thisfunction may modify the behavior of coorperating dialer functionsby setting the value of numbered string or integer variables. Inparticular, the dialer function will inherit the values of $i0and $s0 when this special function terminates..BBe careful of what you do in here since MANY ecu procedure commandsaffect $i0 and/or $s0 as a side effect of their operation..RSee _connect.ep above for further screams and moans.]If you get very involved with using this procedure, you'll sooneror later run into some undocumented $so values. You'll have totake a look at ecuDCE.c and hdbintf.cfor an authoritative reference, but perhapsyou can get along by knowing that result codes with an exclamation pointas their first character are generated by ECU.ECU ignores any failure (abnormal procedure terminationor non-zero return code) resulting from the execution of this procedure..*s 2 "_hangup.ep"This procedure is executed after every connection termination.It is passed one argument, a string representationof the number of seconds you were connected.You may use %rname and other functions and featuresto customize this function based on the particular systemjust reached. ECU ignores any errorreturned by the procedure.ECU ignores any failure (abnormal procedure terminationor non-zero return code) resulting from the execution of this procedure..br.nr si 0n.af % i.ls 1.TC 1 1 3
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?