home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume32 / ecuman / part03 < prev    next >
Encoding:
Text File  |  1992-09-15  |  57.0 KB  |  2,585 lines

  1. Newsgroups: comp.sources.misc
  2. From: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  3. Subject:  v32i079:  ecuman - Manual for ECU comm package rev 3.20, Part03/05
  4. Message-ID: <1992Sep15.165709.7572@sparky.imd.sterling.com>
  5. X-Md4-Signature: 217c08967b574e4a5b2428c3afe30db1
  6. Date: Tue, 15 Sep 1992 16:57:09 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: wht@n4hgf.Mt-Park.GA.US (Warren Tucker)
  10. Posting-number: Volume 32, Issue 79
  11. Archive-name: ecuman/part03
  12. Environment: SCO,XENIX,ISC,SUNOS,SYSVR4,HDB,Curses
  13. Supersedes: ecuman: Volume 21, Issue 90-93
  14.  
  15. ---- Cut Here and feed the following to sh ----
  16. #!/bin/sh
  17. # this is ecuman320.03 (part 3 of ecuman320)
  18. # do not concatenate these parts, unpack them in order with /bin/sh
  19. # file doc/ecu.man continued
  20. #
  21. if test ! -r _shar_seq_.tmp; then
  22.     echo 'Please unpack part 1 first!'
  23.     exit 1
  24. fi
  25. (read Scheck
  26.  if test "$Scheck" != 3; then
  27.     echo Please unpack part "$Scheck" next!
  28.     exit 1
  29.  else
  30.     exit 0
  31.  fi
  32. ) < _shar_seq_.tmp || exit 1
  33. if test ! -f _shar_wnt_.tmp; then
  34.     echo 'x - still skipping doc/ecu.man'
  35. else
  36. echo 'x - continuing file doc/ecu.man'
  37. sed 's/^X//' << 'SHAR_EOF' >> 'doc/ecu.man' &&
  38. X    attempt fails.
  39. X
  40. X    If "Any" is    found in the dialing directory entry tty field,    then ECU
  41. X    finds an available Devices line which matches the baud rate    specified in
  42. X    the    entry.
  43. X
  44. X    Other special tty field entries allow regular expression or    literal
  45. X    matching of    Devices    types.    See the    description of the  dialing
  46. X    directory for more details.
  47. X
  48. X    A line is selected only if its class begins    with the three characters
  49. X    "ACU."  UUCP will only select a line whose Devices entry class matches
  50. X    the    active Systems entry class (usually "ACU"), so usually you may make
  51. X    a modem accessible to ECU, but not to UUCP,    by setting it's    class to
  52. X    ACUECU.
  53. X
  54. X    On systems employing ecuungetty, if    a line being considered    for
  55. X    selectionis    found to be a line enabled for login, but currently idle,
  56. X    the    ecuungetty interface, described    below, is used to acquire the line
  57. X    for    outgoing use.
  58. X
  59. X    The    DCD watcher (see the interactive and procedure commands    dcdwatch)
  60. X    depends upon the tty driver    to return zero on a read when DCD is low
  61. X    when the termio flag CLOCAL    is reset.  The tty driver must ignore DCD if
  62. X    CLOCAL is set.  If your system offers a "modem" and    "direct" choice    (by
  63. X    choice of filename), you probably need to use the "modem" choice for
  64. X    this to work properly.  However, the choice    depends    upon the needs of
  65. X    the    underlying driver you are using.  For instance,    if you are using FAS
  66. X    in a shared    modem application, your    getty should use the "modem" choice
  67. X    and    ECU should use the "direct" choice.  Some experimentation may be
  68. X    required.
  69. X
  70. X    One    of the symptoms    of an incorrect    line choice is ECU hangs, line
  71. X    errors such    as EIO and EBUSY.  These problems may be caused    by other
  72. X    problems, but incorrect line choice    is the most frequent cause.
  73. X
  74. X
  75. X
  76. X    6.3     SCO Tty Naming
  77. X
  78. X
  79. X    On SCO, TTY    devices    must be    named in the style of:
  80. X
  81. X     /dev/tty#N
  82. X         ^^
  83. X         ||
  84. X         |`------ uppercase letter for modem control
  85. X         |      lowercase for    non-modem control
  86. X         `--------digit    (1-4)
  87. X
  88. X
  89. X
  90. X
  91. X    Public Domain by wht@n4hgf                  9/7/92
  92. X
  93. X
  94. X
  95. X
  96. X
  97. X
  98. X
  99. X    ECU    Technical Description                      60
  100. X
  101. X
  102. X
  103. X    If you are using FAS or other third-party driver, you may use ECU with
  104. X    ports not normally named in    the /dev/tty#N style in    one of two ways
  105. X    under UNIX and one way under XENIX:
  106. X
  107. X
  108. X     1.  Under XENIX or UNIX, create a link    to the port
  109. X         with a compatible name:
  110. X
  111. X           ln /dev/ttyF00 /dev/tty1a
  112. X           ln /dev/ttyFM00 /dev/tty1A
  113. X
  114. X     2.  Under UNIX, add additional    lines to the
  115. X         /etc/conf/node.d file and rebuild the kernel
  116. X         environment (this is the recommended approach
  117. X         for UNIX):
  118. X
  119. X     fas ttyF00  c     48
  120. X     fas tty1a   c     48
  121. X     fas ttyF01  c     49
  122. X     fas tty1b   c     49
  123. X     fas ttyFM00 c     208
  124. X     fas tty1A   c     208
  125. X     fas ttyFM01 c     209
  126. X     fas tty1B   c     209
  127. X
  128. X
  129. X    Note the device numbers are    examples only.    Consult    the driver
  130. X    documentation for proper choices.
  131. X
  132. X    If you cannot live within this restriction,    search for the #define
  133. X    SCO_TTY_NAMING in ecu.h (that depends on SCO's M_SYSV) and disable it.
  134. X
  135. X
  136. X    6.4     Ecuungetty (Getty Interface)
  137. X
  138. X
  139. X    This section applies to the    SCO version of the program.  It    may also
  140. X    apply to others in part.  Specifically, as of this writing,    this section
  141. X    does not apply to the SunOS    version    due to the differences in utmp
  142. X    arrangement.  In some versions, the    mechanism may execute and do no
  143. X    harm, yet essentially be a no-op.
  144. X
  145. X    When an idle dialin    (enabled) line is chosen for dialout, ECU makes    use
  146. X    of ecuungetty (in the ecu library directory, normally
  147. X    /usr/local/lib/ecu)    to signal the line's getty to release the line (via
  148. X    SIGUSR1).  Ecuungetty is again employed to signal the getty    to reacquire
  149. X    the    line when outgoing communication is complete (via SIGUSR2).
  150. X
  151. X    Ecuungetty is a privileged program,    which must be owned by root and    have
  152. X    the    setuid-on-execute bit set.  An encrypted id is passed by ecu to
  153. X    ecuungetty to validate requests and    to prevent abuse of ecuungetty by
  154. X
  155. X
  156. X
  157. X    Public Domain by wht@n4hgf                  9/7/92
  158. X
  159. X
  160. X
  161. X
  162. X
  163. X
  164. X
  165. X    ECU    Technical Description                      61
  166. X
  167. X
  168. X
  169. X    crackers, malcontents and other twentieth-century phenomena.
  170. X
  171. X
  172. X    6.5     SCO Dialer Programs
  173. X
  174. X
  175. X    The    concept    of a dialer program (an    executable binary as opposed to    a
  176. X    Dialers entry) is an SCO enhancement and is    unlikely to be of benefit to
  177. X    users of other versions (too bad!).     ECU will support dialer programs
  178. X    under any version, but other users of the Devices file (read "your
  179. X    vendor-supplied uucico") will most likely barf on non-SCO systems.
  180. X
  181. X    If the Devices file    can be found in    /usr/lib/uucp, and a valid entry for
  182. X    the    attached line can be found, ECU    will use the Dialers script or
  183. X    dialer program specified in    the Devices entry.
  184. X
  185. X
  186. X    6.6     Gendial Dialer    Package
  187. X
  188. X
  189. X    Sample SCO-style modem dialer program sources may be found in the
  190. X    gendial/ subdirectory of the distribution.    Some of    them, particularly
  191. X    dialgHA24 and dialgT2500, are very robust and succeed where    other
  192. X    programs may fail.    They retry modem initialization    and reset/hangup
  193. X    commands .
  194. X
  195. X    The    code is    divided    into one general module    and several modem- and DCE-
  196. X    specific modules.  A program is built by combining the gendial.o with
  197. X    the    appropriate dceFOO.o module to produce a dialgFOO executable.
  198. X
  199. X    To write a dialer for a modem not already in the gendial package, copy
  200. X    template.c to dceMYMODEM.c and edit    it to contain the necessary variable
  201. X    assignments    and initialization, dialing and    hangup code.  The existing
  202. X    dce*.c modules provide examples.  Edit the gendial/Make.src    file to    add
  203. X    rule lines for your    program.  (Do not modify Makefile alone    since a
  204. X    "Configure"    will overwrite Makefile.)
  205. X
  206. X
  207. X    dialgMYMODEM: gendial.o dceMYMODEM.o
  208. X    $(CC) $(LDFLAGS) gendial.o dceMYMODEM.o    $(LIBS)    -o $@
  209. X
  210. X
  211. X    To be "correct," you should    run the    Configure procedure in the main    ecu
  212. X    directory to make a    new Makefile, but this has the unfortunate side
  213. X    effect of rebuilding all of    the Makefiles which are    built from Make.src
  214. X    files.  If this happens, the next make will    rebuild    all of the objects.
  215. X
  216. X    In this case, it is    "OK" to    cheat and copy the new Make.src    lines to
  217. X    Makefile.  A later Configure will not cause    loss of    the new    lines.
  218. X
  219. X
  220. X
  221. X
  222. X
  223. X    Public Domain by wht@n4hgf                  9/7/92
  224. X
  225. X
  226. X
  227. X
  228. X
  229. X
  230. X
  231. X    ECU    Technical Description                      62
  232. X
  233. X
  234. X
  235. X    7.    Exit Codes
  236. X
  237. X
  238. X    When ECU exits (terminates execution), it uses a code from the following
  239. X    table:
  240. X
  241. X    OK             0    no error
  242. X    SIG1         1    SIGHUP (signal 1)
  243. X    SIGN         64   signal 64    - see below
  244. X    LINE_READ_ERROR     129  could not    read from attached line
  245. X    XMTR_WRITE_ERROR     130  could not    write to attached line
  246. X    XMTR_LOGIC_ERROR     131  software logic error
  247. X    BSD4_IOCTL         132  not currently used
  248. X    SHM_ABL         133  not currently used
  249. X    SHM_RTL         134  not currently used
  250. X    NO_FORK_FOR_RCVR     135  could not    fork receiver process
  251. X    TTYIN_READ_ERROR     136  could not    read from console
  252. X    LINE_OPEN_ERROR     137  could not    attach (open) requested    line
  253. X    PWENT_ERROR         138  error in /etc/passwd processing
  254. X    USAGE         139  command line syntax error
  255. X    CONFIG_ERROR     140  missing or erroroenous configuration file
  256. X    CURSES_ERROR     141  error in curses use
  257. X    RCVR_FATAL_ERROR     142  receiver died unexpectedly
  258. X    MALLOC         143  critical memory allocation failure
  259. X    LOGIC_ERROR         144  internal logic error
  260. X    GEOMETRY         145  unsupported screen geometry
  261. X    INIT_PROC_ERROR     192  initial procedure    terminated in error
  262. X    USER1         193  exit procedure command called with 1
  263. X    USERN         223  exit procedure command called with 31
  264. X
  265. X
  266. X    The    logical    names 'SIG1' and 'SIGN'    refer to a range of error codes
  267. X    signifying ecu termination due to a    signal.     A larger range    (64) is
  268. X    reserved than is necessary to handle reasonable expansion of SIG values
  269. X    in the OS. Not all signals will be reported    in this    manner.    ECU will
  270. X    never report status    9 (signal 9, SIGKILL), for instance.
  271. X
  272. X    The    logical    names 'USER1' and 'USERN' refer    to a range of error exits
  273. X    codes reserved for use by the 'exit' procedure command.  See the
  274. X    description    of this    command    for more information.
  275. X
  276. X    For    ecu friend code, formal    C #define identifiers for exit codes may be
  277. X    found in termecu.h and consist of the above    logical    names prefixed with
  278. X    'TERMECU_'.
  279. X
  280. X
  281. X
  282. X
  283. X
  284. X
  285. X
  286. X
  287. X
  288. X
  289. X    Public Domain by wht@n4hgf                  9/7/92
  290. X
  291. X
  292. X
  293. X
  294. X
  295. X
  296. X
  297. X
  298. X
  299. X
  300. X
  301. X                    CONTENTS
  302. X
  303. X
  304. X    1.    Introduction........................................   2
  305. X
  306. X    2.    Basic Organization..................................   3
  307. X    2.1   Transmitter Process (XMTR)....................   3
  308. X          2.1.1   Keyboard Interface....................   3
  309. X          2.1.2   ECU Command Assembly..................   3
  310. X          2.1.3   Function Key Mapping..................   4
  311. X          2.1.4   Auxiliary    Operation Control...........   4
  312. X    2.2   Receiver Process (RCVR).......................   5
  313. X          2.2.1   ANSI Filter...........................   5
  314. X          2.2.2   Session Logging.......................   5
  315. X
  316. X    3.    Features............................................   6
  317. X    3.1   Supported    Terminals...........................   6
  318. X    3.2   Host Video Control Sequences..................   7
  319. X          3.2.1   All Local    Consoles (Terminals)........   7
  320. X          3.2.2   Multiscreen Local    Terminals...........   8
  321. X          3.2.3   Character    Mapping.....................   9
  322. X    3.3   Function Key Mapping (Recognition)............  10
  323. X    3.4   Function Key Actions..........................  13
  324. X          3.4.1   Standard Function    Keys................  13
  325. X          3.4.2   SCO ALT-[a-z] Function Keys...........  15
  326. X    3.5   Line Editing..................................  16
  327. X    3.6   Screen Dump...................................  17
  328. X          3.6.1   Multiscreen and Non-Multiscreen.......  17
  329. X          3.6.2   Multiscreen Bug.......................  17
  330. X    3.7   Interactive Command History...................  18
  331. X    3.8   Dialing Directory.............................  18
  332. X    3.9   Online Interactive Command Help...............  20
  333. X    3.10  Multiscreen Event    Alarm.......................  20
  334. X    3.11  Built-in Modem Dialer.........................  21
  335. X    3.12  File Transfer.................................  22
  336. X    3.13  Automatic    ZMODEM Receive......................  23
  337. X    3.14  Procedures (Scripts)..........................  23
  338. X          3.14.1  Initial (Startup)    Procedure...........  23
  339. X          3.14.2  Dialing Procedure.....................  23
  340. X          3.14.3  Other Special Procedures..............  24
  341. X    3.15  DCD (Carrier) Watcher.........................  24
  342. X    3.16  Home Directory Files..........................  24
  343. X    3.17  Lock Files....................................  25
  344. X    3.18  Dial-In/Dial-Out Line Support.................  25
  345. X    3.19  Tools.........................................  25
  346. X    3.20  Shared Memory 'Friend' Interface..............  26
  347. X
  348. X    4.    Starting the Program................................  27
  349. X    4.1   Simple Startup - Initial Setup Menu...........  27
  350. X          4.1.1   Destination...........................  27
  351. X          4.1.2   Other Fields..........................  28
  352. X
  353. X
  354. X
  355. X                   - i -
  356. X
  357. X
  358. X
  359. X
  360. X
  361. X
  362. X
  363. X
  364. X
  365. X
  366. X
  367. X          4.1.3   Keyboard Functions....................  28
  368. X    4.2   Command Line Switches and    Arguments...........  29
  369. X          4.2.1   Usage Summary.........................  30
  370. X          4.2.2   Switches..............................  30
  371. X              4.2.2.1    -b <baud>  31
  372. X              4.2.2.2    -d  31
  373. X              4.2.2.3    -e, -o,    -n  31
  374. X              4.2.2.4    -h  31
  375. X              4.2.2.5    -l ttyspec  31
  376. X              4.2.2.6    -p <proc>  32
  377. X              4.2.2.7    -t  32
  378. X              4.2.2.8    -D  32
  379. X              4.2.2.9    -F name     32
  380. X              4.2.2.10    -P phonedir  33
  381. X              4.2.2.11    -T level  33
  382. X          4.2.3   Non-Switch Arguments..................  33
  383. X              4.2.3.1    <tel-number>  33
  384. X              4.2.3.2    <logical>  33
  385. X              4.2.3.3    <arg>  34
  386. X    4.3   Environment Variables.........................  34
  387. X          4.3.1   ECUPROMPT.............................  34
  388. X          4.3.2   ECUHELP...............................  34
  389. X          4.3.3   ECUFUNCKEY............................  34
  390. X
  391. X    5.    Interactive Mode Commands...........................  35
  392. X    5.1   AUTORZ : Automatic ZMODEM    Receive.............  35
  393. X    5.2   AX : ascii char to hex/oct/dec................  35
  394. X    5.3   BAud : set/display line baud rate.............  35
  395. X    5.4   BN : all console event alarm..................  36
  396. X    5.5   BReak : send break to remote..................  36
  397. X    5.6   CD : change current directory.................  36
  398. X    5.7   DA : decimal to ascii char....................  37
  399. X    5.8   DCDwatch......................................  37
  400. X    5.9   Dial : dial remote destination................  38
  401. X          5.9.1   Alternate    Dialing    Directory...........  38
  402. X          5.9.2   Multi-Number Redial Cycle.............  39
  403. X          5.9.3   Automatic    Dialing/Login Procedure.....  39
  404. X    5.10  DO : perform procedure........................  40
  405. X    5.11  DUplex : set/display duplex...................  40
  406. X    5.12  EXit : drop carrier, exit    program.............  41
  407. X    5.13  FI : send    text file to line...................  41
  408. X    5.14  FKEy : function key definition................  42
  409. X    5.15  FKMap : funckeymap (function key recognition)
  410. X          management....................................  43
  411. X    5.16  HAngup : hang up modem........................  44
  412. X    5.17  HElp : invoke help............................  44
  413. X    5.18  KBDTest :    test keyboard mapping...............  44
  414. X    5.19  LLp : set    session    log to /dev/lp..............  45
  415. X    5.20  LOFf : turn off session logging...............  45
  416. X    5.21  LOG : session logging control.................  45
  417. X    5.22  NL : display CR/LF mapping....................  45
  418. X
  419. X
  420. X
  421. X                   - ii -
  422. X
  423. X
  424. X
  425. X
  426. X
  427. X
  428. X
  429. X
  430. X
  431. X
  432. X
  433. X    5.23  NLIn : set receive CR/LF mapping..............  46
  434. X    5.24  NLOut : set transmit CR/LF mapping............  46
  435. X    5.25  OA : octal to ascii char......................  46
  436. X    5.26  PARity : set/display line    parity..............  47
  437. X    5.27  PId : display process ids.....................  47
  438. X    5.28  PLog : procedure logging......................  47
  439. X    5.29  POpd : pop to previous directory..............  47
  440. X    5.30  PTrace : control procedure trace..............  48
  441. X    5.31  PUshd : push to new directory.................  48
  442. X    5.32  PWd : print working directory.................  49
  443. X    5.33  REDial : redial last number...................  49
  444. X    5.34  REV : ECU    revision/make date..................  49
  445. X    5.35  RK : receive via C-Kermit.....................  49
  446. X    5.36  RS : receive via SEAlink......................  50
  447. X    5.37  RTScts : control RTS/CTS flow control.........  50
  448. X    5.38  RX : receive via XMODEM/CRC...................  51
  449. X    5.39  RY : receive via YMODEM Batch.................  51
  450. X    5.40  RZ : receive via ZMODEM/CRC32.................  52
  451. X    5.41  SDNAME : select screen dump file name.........  52
  452. X    5.42  SK : send    via C-Kermit........................  52
  453. X    5.43  SS : send    via SEAlink.........................  53
  454. X    5.44  STat : verbose status summary.................  53
  455. X    5.45  SX : send    via XMODEM/CRC......................  54
  456. X    5.46  SY : send    via YMODEM Batch....................  55
  457. X    5.47  SZ : send    via ZMODEM/CRC32....................  55
  458. X    5.48  TIme : time of day............................  56
  459. X    5.49  TTy : console tty    name........................  56
  460. X    5.50  XA : hex to ascii    char........................  56
  461. X    5.51  XON : xon/xoff flow control...................  57
  462. X    5.52  !    : execute shell.............................  57
  463. X
  464. X    6.    HoneyDanBer UUCP Interface..........................  58
  465. X    6.1   Control Files.................................  58
  466. X          6.1.1   Devices...............................  58
  467. X          6.1.2   Dialers...............................  58
  468. X          6.1.3   Sysfiles..............................  58
  469. X          6.1.4   Systems...............................  58
  470. X    6.2   Choosing a Dialout Line.......................  58
  471. X    6.3   SCO Tty Naming................................  59
  472. X    6.4   Ecuungetty (Getty    Interface)..................  60
  473. X    6.5   SCO Dialer Programs...........................  61
  474. X    6.6   Gendial Dialer Package........................  61
  475. X
  476. X    7.    Exit Codes..........................................  62
  477. X
  478. X
  479. X
  480. X
  481. X
  482. X
  483. X
  484. X
  485. X
  486. X
  487. X                  -    iii -
  488. X
  489. X
  490. X
  491. X
  492. SHAR_EOF
  493. echo 'File doc/ecu.man is complete' &&
  494. chmod 0644 doc/ecu.man ||
  495. echo 'restore of doc/ecu.man failed'
  496. Wc_c="`wc -c < 'doc/ecu.man'`"
  497. test 126187 -eq "$Wc_c" ||
  498.     echo 'doc/ecu.man: original size 126187, current size' "$Wc_c"
  499. rm -f _shar_wnt_.tmp
  500. fi
  501. # ============= doc/proc.man ==============
  502. if test -f 'doc/proc.man' -a X"$1" != X"-c"; then
  503.     echo 'x - skipping doc/proc.man (File already exists)'
  504.     rm -f _shar_wnt_.tmp
  505. else
  506. > _shar_wnt_.tmp
  507. echo 'x - extracting doc/proc.man (Text)'
  508. sed 's/^X//' << 'SHAR_EOF' > 'doc/proc.man' &&
  509. X
  510. X
  511. X
  512. X
  513. X
  514. X
  515. X
  516. X                      ECU
  517. X
  518. X                (Extended Call Utility)
  519. X
  520. X
  521. X
  522. X
  523. X
  524. X
  525. X                Research and Engineering
  526. X              Asynchronous Communications Package
  527. X              for SCO UNIX 3.2 and XENIX System    V,
  528. X               ISC 386/ix 2.2 (or later),
  529. X               SunOS 4.1, ISC System V Release 4
  530. X              and ESIX System V Release 4
  531. X
  532. X
  533. X
  534. X
  535. X
  536. X
  537. X
  538. X
  539. X
  540. X
  541. X
  542. X
  543. X        Warren H. Tucker, III <wht@n4hgf.Mt-Park.GA.US>
  544. X
  545. X
  546. X
  547. X
  548. X
  549. X
  550. X                   Procedure Language
  551. X                 Revision 3.20
  552. X                    9/10/92
  553. X
  554. X
  555. X
  556. X
  557. X
  558. X
  559. X    NOTE: Many sections    of the manual are likely to be obsolete    at any given
  560. X    time until the writer get lots of free time.  Much of it was written
  561. X    when the program was supported only    on SCO XENIX and UNIX.
  562. X
  563. X
  564. X
  565. X
  566. X
  567. X
  568. X
  569. X
  570. X    Public Domain by wht@n4hgf                 9/10/92
  571. X
  572. X
  573. X
  574. X
  575. X
  576. X
  577. X
  578. X    ECU    Procedure Language                       2
  579. X
  580. X
  581. X
  582. X    1.    Introduction
  583. X
  584. X
  585. X    Procedures are "programs" or "scripts" written in an addled    but adequate
  586. X    language which ECU executes    upon demand.  The documentation    refers to
  587. X    procedures as files    on the disk or as in-memory copies under execution.
  588. X
  589. X    An "initial    procedure" may be executed when    ECU starts up (see the
  590. X    description    of the -p command line switch).     Certain special procedures
  591. X    are    executed automatically as described below in the section "Special
  592. X    Procedures."
  593. X
  594. X    The    procedures themselves are source files consisting of the procedure
  595. X    "name" with    an extension of    ".ep".    When executing a procedure by name,
  596. X
  597. X     do name       interactive
  598. X     -or-
  599. X     do 'name'     from inside a procedure
  600. X
  601. X    is sufficient if the procedure is in the current directory,    the user's
  602. X    ~/.ecu directory or    in the ECU library subdirectory    "ep" (normally
  603. X    /usr/local/lib/ecu/ep).  Procedure files are searched for in the above
  604. X    order, so you may have a system default in the lib directory, a user
  605. X    default in the ~/.ecu directory and    a specific version in the current
  606. X    directory all by the same name.
  607. X
  608. X    You    may execute a procedure    by specifying it's full    pathname (minus    the
  609. X    .ep    extension).  For example:
  610. X
  611. X     do /tmp/doit        interactive    invocation of /tmp/doit.ep
  612. X     -or-
  613. X     do '/tmp/doit'        from inside    a procedure
  614. X
  615. X
  616. X    Many example procedures, some quite    useful,    some not so, are found in
  617. X    the    models subdirectory of the release.  There are also many fragments
  618. X    used as examples throughout    the following sections.
  619. X
  620. X
  621. X
  622. X
  623. X
  624. X
  625. X
  626. X
  627. X
  628. X
  629. X
  630. X
  631. X
  632. X
  633. X
  634. X
  635. X
  636. X    Public Domain by wht@n4hgf                 9/10/92
  637. X
  638. X
  639. X
  640. X
  641. X
  642. X
  643. X
  644. X    ECU    Procedure Language                       3
  645. X
  646. X
  647. X
  648. X    2.    Line Syntax (Labels, Commands and Comments)
  649. X
  650. X    Lines in a procedure consist of an optional    label, followed    by optional
  651. X    commands and arguments.  Anything on a line    after an octothorpe (#)
  652. X    outside of quote marks is ignored (read "# is the comment character").
  653. X
  654. X
  655. X    Example:
  656. X    ----------------------------------------------------------------------
  657. X    # example procedure
  658. X    echo 'Hello.  Please tell me your name.'
  659. X    $s0 = %cgets  #    read string from console into string variable $s0
  660. X    ifs $s0    == 'foo' goto label
  661. X    echo 'Hello there, '+$s0
  662. X    return
  663. X
  664. X    label echo 'You must be kidding.'
  665. X    ----------------------------------------------------------------------
  666. X
  667. X
  668. X    Labels must    begin in column    one.  A    label may appear on a line by itself
  669. X    or with a comment appended.     A common mistake I make (from writing too
  670. X    much C) is to append a colon to a label declaration; this does not work
  671. X    unless you also "goto label:". Labels are not allowed inside braces
  672. X    (inside of compound    statements); you may get away with it sometimes
  673. X    because the    procedure language processor is    written    for speed, not
  674. X    political correctness.
  675. X
  676. X    Commands must have white space before them and white space before each
  677. X    argument.
  678. X
  679. X
  680. X
  681. X
  682. X
  683. X
  684. X
  685. X
  686. X
  687. X
  688. X
  689. X
  690. X
  691. X
  692. X
  693. X
  694. X
  695. X
  696. X
  697. X
  698. X
  699. X
  700. X
  701. X
  702. X    Public Domain by wht@n4hgf                 9/10/92
  703. X
  704. X
  705. X
  706. X
  707. X
  708. X
  709. X
  710. X    ECU    Procedure Language                       4
  711. X
  712. X
  713. X
  714. X    3.    Arguments
  715. X
  716. X
  717. X    There are five types of arguments to procedure commands:
  718. X
  719. X     Switch
  720. X     Alphabetic Token
  721. X     Integer
  722. X     String
  723. X     Relational Operators
  724. X
  725. X    This section describes the syntax and construction of each type in turn.
  726. X    There are separate groups of valid of relational operators for integers
  727. X    and    strings; thus, they are    described under    the appropriate    sections.
  728. X
  729. X
  730. X    3.1     Switches
  731. X
  732. X
  733. X    Switch arguments begin with    a hyphen (minus, '-').    The switch argument
  734. X    must be the    first argument after the command.  Only    one switch argument
  735. X    is allowed on the command line.  If    switches '-a', '-b' and    '-c', are
  736. X    available and '-a' and '-b'    are desired, '-ab' or '-ba' is entered.
  737. X
  738. X
  739. X    3.2     Alphabetic Tokens
  740. X
  741. X
  742. X    Alphabetic tokens, for lack    of a better term, are non-integer, non-
  743. X    quoted terms used as arguments for certain commands, such as:
  744. X
  745. X     plog off
  746. X
  747. X    Such argument types    are fairly simple to understand    and use; they are
  748. X    described here for completeness.
  749. X
  750. X
  751. X    3.3     Integers
  752. X
  753. X
  754. X    Integer values are 32-bit quantities ranging between -2147483647 and
  755. X    2147483647.
  756. X
  757. X    In one case, an integer is used to store a 32-bit color mask as
  758. X    described by the color command and the %colors integer function.
  759. X
  760. X
  761. X    3.3.1  Constants
  762. X
  763. X    Integer constants are numeric strings, optionally with an initial minus
  764. X    sign, the absolute value of    which must be less than    2147483648.  If    the
  765. X
  766. X
  767. X
  768. X    Public Domain by wht@n4hgf                 9/10/92
  769. X
  770. X
  771. X
  772. X
  773. X
  774. X
  775. X
  776. X    ECU    Procedure Language                       5
  777. X
  778. X
  779. X
  780. X    constant begins with the string "0x", it is    interpreted as hexadecimal.
  781. X    Octal, like    FORTRAN    and COBOL will be dead soon (heh heh); until then,
  782. X    however, octal constants may be denoted by a leading "0o".    This differs
  783. X    from the usual convention so as to allow decimal strings with leading
  784. X    zeroes to be correctly interpreted.
  785. X
  786. X
  787. X    Examples:
  788. X        123      --> 123(10)
  789. X        0123  --> 123(10)
  790. X        0x123 --> 291(10)
  791. X        0o123 -->  83(10)
  792. X
  793. X
  794. X
  795. X    3.3.2  Variables
  796. X
  797. X    There are 50 numbered, permanent integer variables referenced by the
  798. X    terms '$i0'    through    '$i49'.     When ECU is started, the value    of each
  799. X    variable is    zero.  Variables retain    their value until changed, even
  800. X    between procedure executions.  The integer variable    number may be
  801. X    expressed as an expression by enclosing an integer expression in
  802. X    brackets.  For instance:
  803. X
  804. X     $i[4+5]      refers to    $i9
  805. X
  806. X     $i2=5
  807. X     $i[20+$i2]   refers to    $i25
  808. X
  809. X
  810. X    Integer variables may be created for use as    "local"    variables or to
  811. X    promote code readability.  Refer to    the mkvar command.
  812. X
  813. X
  814. X    3.3.3  Functions
  815. X
  816. X    ECU    has many built-in functions which return the value of ecu- or
  817. X    system-related information.     A list    of the functions appears in a later
  818. X    section.
  819. X
  820. X
  821. X    3.3.4  Expressions
  822. X
  823. X    In almost any place    an integer argument is allowed,    an expression may be
  824. X    supplied.  Expressions are composed    of two or more integer constants or
  825. X    variables separated    by operators from the group:
  826. X
  827. X
  828. X
  829. X
  830. X
  831. X
  832. X
  833. X
  834. X    Public Domain by wht@n4hgf                 9/10/92
  835. X
  836. X
  837. X
  838. X
  839. X
  840. X
  841. X
  842. X    ECU    Procedure Language                       6
  843. X
  844. X
  845. X
  846. X    +     addition
  847. X    -     subtraction
  848. X    *     multiplication
  849. X    /     division
  850. X    |     OR
  851. X    @     MOD
  852. X    ^     XOR
  853. X    &     AND
  854. X
  855. X    Evaluation of expressions is left-to-right.     Parentheses are not
  856. X    allowed.
  857. X
  858. X
  859. X    3.3.5  Relational Operators
  860. X
  861. X    Integer relational operators are chosen from the following group:
  862. X
  863. X     =     "is equal to"
  864. X     ==     "is equal to"
  865. X     !=     "is not equal to"
  866. X     <>     "is not equal to"
  867. X     >     "is greater than"
  868. X     <     "is greater than"
  869. X     >=     "is greater than or equal to"
  870. X     <=     "is less than or equal    to"
  871. X
  872. X
  873. X
  874. X    3.4     Strings
  875. X
  876. X
  877. X    Strings are    classic    concatenations of zero or more eight-bit characters.
  878. X    In general,    the maximum size of a string used by ECU is 256    characters.
  879. X    The    absolute maximum size is 16384 characters.
  880. X
  881. X    Null in strings are    poorly handled.     You may be able to get    away with
  882. X    using them,    but it is not recommended.
  883. X
  884. X
  885. X    3.4.1  Constants
  886. X
  887. X    String constants are formed    by placing alphanumeric    characters between
  888. X    single quote characters (apostrophes).  The    backslash ('\')    character is
  889. X    used to "escape" certains characters:
  890. X
  891. X    \\           one backslash
  892. X    \n           newline
  893. X    \t           tab
  894. X    \'           apostrophe
  895. X
  896. X
  897. X
  898. X
  899. X
  900. X    Public Domain by wht@n4hgf                 9/10/92
  901. X
  902. X
  903. X
  904. X
  905. X
  906. X
  907. X
  908. X    ECU    Procedure Language                       7
  909. X
  910. X
  911. X
  912. X    NOTE: ecu converts every tab in a procedure    line to    one space when the
  913. X    procedure file is read in.    Therefore, IF YOU WISH TO PLACE    A TAB IN A
  914. X    STRING CONSTANT, you must place it there with the \t escape    sequence.
  915. X
  916. X
  917. X    3.4.2  Variables
  918. X
  919. X    There are 50 numbered, permanent string variables referenced by the
  920. X    terms '$s0'    through    '$s49',    each possessing    a maximum length of 256
  921. X    characters When ECU    is started, the    value of each variable is null (zero
  922. X    length).  Variables    retain their value until changed, even between
  923. X    procedure executions.  The string variable number may be expressed as an
  924. X    expression by enclosing an string expression in brackets.  For instance:
  925. X
  926. X     $s[4+5]      refers to    $s9
  927. X
  928. X     $s2=5
  929. X     $s[20+$s2]   refers to    $s25
  930. X
  931. X
  932. X    String variables may be created for    use as "local" variables or to
  933. X    promote code readability.  Refer to    the mkvar command. Created variables
  934. X    have a life    equal to the duration of the procedure which created them.
  935. X    Regardless of the declared size of a created string    variable, ECU will
  936. X    automatically grow it to a maximum of 16384    characters as necessary.
  937. X    Numbered (permanent) string    variables have a maximum size of 256 bytes.
  938. X
  939. X
  940. X    3.4.3  Functions
  941. X
  942. X    ECU    has many built-in functions which return the value of ecu- or
  943. X    system-related information.     A list    of the functions appears in a later
  944. X    section.
  945. X
  946. X
  947. X    3.4.4  Expressions
  948. X
  949. X    String expressions are formed by the concatenation of string constants,
  950. X    variables and function return values using the '+' operator:
  951. X
  952. X    Example:
  953. X       'The quick brown    fox jumped over    the '+$s0'+' dog at '+%time
  954. X
  955. X
  956. X
  957. X    3.4.5  Relational Operators
  958. X
  959. X    String relational operators    are chosen from    the following group:
  960. X
  961. X
  962. X
  963. X
  964. X
  965. X
  966. X    Public Domain by wht@n4hgf                 9/10/92
  967. X
  968. X
  969. X
  970. X
  971. X
  972. X
  973. X
  974. X    ECU    Procedure Language                       8
  975. X
  976. X
  977. X
  978. X     =     "is equal to"
  979. X     ==     "is equal to"
  980. X     !=     "is not equal to"
  981. X     <>     "is not equal to"
  982. X
  983. X
  984. X
  985. X
  986. X
  987. X
  988. X
  989. X
  990. X
  991. X
  992. X
  993. X
  994. X
  995. X
  996. X
  997. X
  998. X
  999. X
  1000. X
  1001. X
  1002. X
  1003. X
  1004. X
  1005. X
  1006. X
  1007. X
  1008. X
  1009. X
  1010. X
  1011. X
  1012. X
  1013. X
  1014. X
  1015. X
  1016. X
  1017. X
  1018. X
  1019. X
  1020. X
  1021. X
  1022. X
  1023. X
  1024. X
  1025. X
  1026. X
  1027. X
  1028. X
  1029. X
  1030. X
  1031. X
  1032. X    Public Domain by wht@n4hgf                 9/10/92
  1033. X
  1034. X
  1035. X
  1036. X
  1037. X
  1038. X
  1039. X
  1040. X    ECU    Procedure Language                       9
  1041. X
  1042. X
  1043. X
  1044. X    4.    Integer    Functions
  1045. X
  1046. X
  1047. X
  1048. X    4.1     %argc
  1049. X
  1050. X
  1051. X    This function returns the number of    arguments passes to the    current
  1052. X    procedure.
  1053. X
  1054. X
  1055. X    4.2     %baud
  1056. X
  1057. X
  1058. X    This function returns the baud rate    of the communications line.  If    no
  1059. X    line is currently attached,    the baud rate returned is the value of the
  1060. X    last line attached.     If no line has    been attached during the current
  1061. X    session, the default baud rate is returned.
  1062. X
  1063. X
  1064. X    4.3     %colors
  1065. X
  1066. X
  1067. X    This function returns the state of the normal and reverse video
  1068. X    foreground and background colors in    the 32-bit value:
  1069. X
  1070. X     00000000001111111111222222222233
  1071. X     01234567890123456789012345678901
  1072. X     0000|--|0000|--|0000|--|0000|--|
  1073. X          fg      bk      fg      bk
  1074. X           reverse        normal
  1075. X
  1076. X
  1077. X    The    color values are obtained from the following lists:
  1078. X
  1079. X
  1080. X
  1081. X
  1082. X
  1083. X
  1084. X
  1085. X
  1086. X
  1087. X
  1088. X
  1089. X
  1090. X
  1091. X
  1092. X
  1093. X
  1094. X
  1095. X
  1096. X
  1097. X
  1098. X    Public Domain by wht@n4hgf                 9/10/92
  1099. X
  1100. X
  1101. X
  1102. X
  1103. X
  1104. X
  1105. X
  1106. X    ECU    Procedure Language                      10
  1107. X
  1108. X
  1109. X
  1110. X    Alphabetic Order
  1111. X    black         0
  1112. X    blue         1
  1113. X    brown         6
  1114. X    cyan         3
  1115. X    gray         8
  1116. X    green         2
  1117. X    hi_white    15
  1118. X    lt_blue         9
  1119. X    lt_cyan        11
  1120. X    lt_green    10
  1121. X    lt_magenta  13
  1122. X    lt_red        12
  1123. X    magenta         5
  1124. X    red         4
  1125. X    white         7
  1126. X    yellow        14
  1127. X
  1128. X
  1129. X
  1130. X    Numeric    Order
  1131. X    black         0
  1132. X    blue         1
  1133. X    green         2
  1134. X    cyan         3
  1135. X    red         4
  1136. X    magenta         5
  1137. X    brown         6
  1138. X    white         7
  1139. X    gray         8
  1140. X    lt_blue         9
  1141. X    lt_green    10
  1142. X    lt_cyan        11
  1143. X    lt_red        12
  1144. X    lt_magenta  13
  1145. X    yellow        14
  1146. X    hi_white    15
  1147. X
  1148. X
  1149. X
  1150. X    4.4     %cols
  1151. X
  1152. X
  1153. X    This function returns the screen width in columns.    If running non-
  1154. X    interactively, the value will always be 80.
  1155. X
  1156. X
  1157. X
  1158. X
  1159. X
  1160. X
  1161. X
  1162. X
  1163. X
  1164. X    Public Domain by wht@n4hgf                 9/10/92
  1165. X
  1166. X
  1167. X
  1168. X
  1169. X
  1170. X
  1171. X
  1172. X    ECU    Procedure Language                      11
  1173. X
  1174. X
  1175. X
  1176. X    4.5     %conn
  1177. X
  1178. X
  1179. X    This function returns the (positive) communications    line file descriptor
  1180. X    if a connection is in effect.  If there is no connection, but there    is a
  1181. X    line opened, 0 is returned.     If no line is open (as    may be the case    in
  1182. X    an _rc.ep procedure), -1 is    returned.  NOTE:  if carrier is    lost
  1183. X    abnormally,    %conn will return a positive number incorrectly    if the DCD
  1184. X    watcher is disabled    or if a    procedure was being executed at    the time of
  1185. X    carrier loss. (See the sections on the dcdwatch interactive    and
  1186. X    procedure commands).
  1187. X
  1188. X
  1189. X    4.6     %curx
  1190. X
  1191. X
  1192. X    This function returns the display cursor column position last set by the
  1193. X    remote system.  This value does not    reflect    the actual hardware cursor.
  1194. X
  1195. X
  1196. X    4.7     %cury
  1197. X
  1198. X
  1199. X    This function returns the display cursor row position last set by the
  1200. X    remote system.  This value does not    reflect    the actual hardware cursor.
  1201. X
  1202. X
  1203. X    4.8     %csec
  1204. X
  1205. X
  1206. X    This function returns the number of    seconds    ECU has    been connected to a
  1207. X    remote system.  If ECU is not connected, zero is returned.
  1208. X
  1209. X
  1210. X    4.9     %ctoi
  1211. X
  1212. X
  1213. X    usage: %ctoi(str0)
  1214. X
  1215. X    This function returns the integer value of the first character in string
  1216. X    str0.  If str0 is non-empty, the return value will be between 0 and    255,
  1217. X    inclusive.    if str0    is empty, then -1 is returned.
  1218. X
  1219. X
  1220. X    4.10  %esecs
  1221. X
  1222. X
  1223. X    usage: %esecs
  1224. X
  1225. X    This function, "Epoch SECondS," returns the    number of seconds since
  1226. X    January 1, 1970 00:00 UTC (GMT).
  1227. X
  1228. X
  1229. X
  1230. X    Public Domain by wht@n4hgf                 9/10/92
  1231. X
  1232. X
  1233. X
  1234. X
  1235. X
  1236. X
  1237. X
  1238. X    ECU    Procedure Language                      12
  1239. X
  1240. X
  1241. X
  1242. X    4.11  %fatime
  1243. X
  1244. X    usage: %fatime(int0)
  1245. X       %fatime(str0)
  1246. X
  1247. X
  1248. X    This function returns the time of last access of the file referenced by
  1249. X    the    argument.  If the argument is an integer, the file referenced is the
  1250. X    file opened    by that    number with the    fopen command.    If the argument    is a
  1251. X    string, it is the literal filename.
  1252. X
  1253. X    If int0 does not refer to an open file, the    procedure terminates with an
  1254. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1255. X
  1256. X    The    return value is    the number of seconds since January 1, 1970 at 0000
  1257. X    UTC.  The %edate string function may be used to convert the    integer
  1258. X    value to a string representation of    the date and time expressed relative
  1259. X    to the current time    zone.
  1260. X
  1261. X
  1262. X    4.12  %fmode
  1263. X
  1264. X    usage: %fmode(int0)
  1265. X       %fmode(str0)
  1266. X
  1267. X
  1268. X    This function returns the file mode    value ("rwxrwx---" == 077) of the
  1269. X    file referenced by the argument.  If the argument is an integer, the
  1270. X    file referenced is the file    opened by that number with the fopen
  1271. X    command.  If the argument is a string, it is the literal filename.
  1272. X
  1273. X    If int0 does not refer to an open file, the    procedure terminates with an
  1274. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1275. X
  1276. X
  1277. X    4.13  %fmtime
  1278. X
  1279. X    usage: %fmtime(int0)
  1280. X       %fmtime(str0)
  1281. X
  1282. X
  1283. X    This function returns the time of last modified of the file    referenced
  1284. X    by the argument.  If the argument is an integer, the file referenced is
  1285. X    the    file opened by that number with    the fopen command.  If the argument
  1286. X    is a string, it is the literal filename.
  1287. X
  1288. X    If int0 does not refer to an open file, the    procedure terminates with an
  1289. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1290. X
  1291. X    The    return value is    the number of seconds since January 1, 1970 at 0000
  1292. X    UTC.  The %edate string function may be used to convert the    integer
  1293. X
  1294. X
  1295. X
  1296. X    Public Domain by wht@n4hgf                 9/10/92
  1297. X
  1298. X
  1299. X
  1300. X
  1301. X
  1302. X
  1303. X
  1304. X    ECU    Procedure Language                      13
  1305. X
  1306. X
  1307. X
  1308. X    value to a string representation of    the date and time expressed relative
  1309. X    to the current time    zone.
  1310. X
  1311. X
  1312. X    4.14  %fmode
  1313. X
  1314. X    usage: %fmode(int0)
  1315. X       %fmode(str0)
  1316. X
  1317. X
  1318. X    This function returns the size of the file referenced by the argument.
  1319. X    If the argument is an integer, the file referenced is the file opened by
  1320. X    that number    with the fopen command.     If the    argument is a string, it is
  1321. X    the    literal    filename.
  1322. X
  1323. X    If int0 does not refer to an open file, the    procedure terminates with an
  1324. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1325. X
  1326. X
  1327. X    4.15  %ftell
  1328. X
  1329. X
  1330. X    usage: ftell(int0)
  1331. X
  1332. X    This function returns the current file position of the the file opened
  1333. X    by int0 with the fopen command.
  1334. X
  1335. X    If int0 does not refer to an open file, the    procedure terminates with an
  1336. X    error.
  1337. X
  1338. X
  1339. X    4.16  %instr
  1340. X
  1341. X
  1342. X    usage: %instr(str0,str1)
  1343. X
  1344. X    This function returns the leftmost column position withing str0 that
  1345. X    str1 is found (zero    relative).  If str1 cannot be found in string str0,
  1346. X    -1 is returned.  However, if str1 is null and str0 is not, zero will be
  1347. X    returned (i.e., the    null string matches at the left).
  1348. X
  1349. X    The    comparison is made without regard to case. See also %instr.
  1350. X
  1351. X
  1352. X
  1353. X
  1354. X
  1355. X
  1356. X
  1357. X
  1358. X
  1359. X
  1360. X
  1361. X
  1362. X    Public Domain by wht@n4hgf                 9/10/92
  1363. X
  1364. X
  1365. X
  1366. X
  1367. X
  1368. X
  1369. X
  1370. X    ECU    Procedure Language                      14
  1371. X
  1372. X
  1373. X
  1374. X     Examples:
  1375. X
  1376. X             00000000001111111
  1377. X             01234567890123456
  1378. X     Assume    $s0='abcdefghijklmnabc'
  1379. X        $s1='abc'
  1380. X        $s2='gHi'
  1381. X        $s3='cat'
  1382. X
  1383. X        %instr($s0,$s1)           returns 0
  1384. X        %instr($s0,$s2)           returns 6
  1385. X        %instr($s0,$s3)           returns -1
  1386. X        %instr($s0,'bcd')      returns 2
  1387. X        %instr($s0,'bad')      returns -1
  1388. X
  1389. X
  1390. X
  1391. X    4.17  %ischr
  1392. X
  1393. X    usage: %ischr(int0)
  1394. X       %ischr(str0)
  1395. X
  1396. X
  1397. X    This function returns 1 if the file    referenced by the argument is a
  1398. X    character special file, else 0.  If    the argument is    an integer, the    file
  1399. X    referenced is the file opened by that number with the fopen    command.  If
  1400. X    the    argument is a string, it is the    literal    filename.
  1401. X
  1402. X    If int0 does not refer to an open file, the    procedure terminates with an
  1403. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1404. X
  1405. X    Examples:
  1406. X
  1407. X
  1408. X     %ischr('/dev/tty')    returns 1
  1409. X     %ischr('/usr/bin')    returns 0
  1410. X     %ischr('/xenix')      returns 0
  1411. X
  1412. X
  1413. X
  1414. X    4.18  %isdir
  1415. X
  1416. X    usage: %isdir(int0)
  1417. X       %isdir(str0)
  1418. X
  1419. X
  1420. X    This function returns 1 if the file    referenced by the argument is a
  1421. X    directory file, else 0.  If    the argument is    an integer, the    file
  1422. X    referenced is the file opened by that number with the fopen    command.  If
  1423. X    the    argument is a string, it is the    literal    filename.
  1424. X
  1425. X
  1426. X
  1427. X
  1428. X    Public Domain by wht@n4hgf                 9/10/92
  1429. X
  1430. X
  1431. X
  1432. X
  1433. X
  1434. X
  1435. X
  1436. X    ECU    Procedure Language                      15
  1437. X
  1438. X
  1439. X
  1440. X    If int0 does not refer to an open file, the    procedure terminates with an
  1441. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1442. X
  1443. X    Examples:
  1444. X
  1445. X
  1446. X     %isdir('/dev/tty')    returns 0
  1447. X     %isdir('/usr/bin')    returns 1
  1448. X     %isdir('/xenix')      returns 0
  1449. X
  1450. X
  1451. X
  1452. X    4.19  %isreg
  1453. X
  1454. X    usage: %isreg(int0)
  1455. X       %isreg(str0)
  1456. X
  1457. X
  1458. X    This function returns 1 if the file    referenced by the argument is a
  1459. X    regular file, else 0.  If the argument is an integer, the file
  1460. X    referenced is the file opened by that number with the fopen    command.  If
  1461. X    the    argument is a string, it is the    literal    filename.
  1462. X
  1463. X    If int0 does not refer to an open file, the    procedure terminates with an
  1464. X    error.  If the file    specified by str0 does not exist, -1 is    returned.
  1465. X
  1466. X    Examples:
  1467. X
  1468. X
  1469. X     %isreg('/dev/tty')    returns 0
  1470. X     %isreg('/usr/bin')    returns 0
  1471. X     %isreg('/xenix')      returns 1
  1472. X
  1473. X
  1474. X
  1475. X    4.20  %len
  1476. X
  1477. X
  1478. X    usage: %len(str0)
  1479. X
  1480. X    This function returns the length of    str0.
  1481. X
  1482. X     Example:
  1483. X
  1484. X     set str0='abcdef',i0=%len(str0),i1=%len('1234')
  1485. X     str00 = 'abcdef'
  1486. X     int00 = 6
  1487. X     int01 = 4
  1488. X
  1489. X
  1490. X
  1491. X
  1492. X
  1493. X
  1494. X    Public Domain by wht@n4hgf                 9/10/92
  1495. X
  1496. X
  1497. X
  1498. X
  1499. X
  1500. X
  1501. X
  1502. X    ECU    Procedure Language                      16
  1503. X
  1504. X
  1505. X
  1506. X    4.21  %lgetc
  1507. X
  1508. X
  1509. X    usage: %lgetc(int0)
  1510. X
  1511. X    Reads a character from the line and    returns    it.  Argument int0 is the
  1512. X    number of milliseconds to wait for a character.  Use a large positive
  1513. X    number if you want to wait "forever."  The function    returns    the
  1514. X    character value between 0 and 255 or -1 if the timeout period is
  1515. X    exceeded.
  1516. X
  1517. X
  1518. X    4.22  %lines
  1519. X
  1520. X
  1521. X    This function returns the screen height in lines.  If running non-
  1522. X    interactively, the value will always be 25.
  1523. X
  1524. X
  1525. X    4.23  %nice
  1526. X
  1527. X
  1528. X    usage: %nice
  1529. X
  1530. X    This function returns the nice value of the    ECU process.
  1531. X
  1532. X
  1533. X    4.24  %pid
  1534. X
  1535. X
  1536. X    This function returns the process id (pid) of ECU.
  1537. X
  1538. X
  1539. X    4.25  %match
  1540. X
  1541. X
  1542. X    usage: %match(str0,str1)
  1543. X
  1544. X    This function searches string str0 for a match with    the regular
  1545. X    expression in str1 (for information    on regular expressions,    refer to the
  1546. X    ed(C) manual pages).  The function returns the index into str0 where the
  1547. X    match is found or -1 if no match can be found.  The    matching process is
  1548. X    case sensitive.
  1549. X
  1550. X    The    variable $i0 receives the length of the    matching string    in str0    if a
  1551. X    match is found.  For this reason, it is not    advisable that $i0 otherwise
  1552. X    be involved    in the operation.  Specifically    to be avoided is:
  1553. X
  1554. X     set $i0=%instr(...)
  1555. X
  1556. X
  1557. X
  1558. X
  1559. X
  1560. X    Public Domain by wht@n4hgf                 9/10/92
  1561. X
  1562. X
  1563. X
  1564. X
  1565. X
  1566. X
  1567. X
  1568. X    ECU    Procedure Language                      17
  1569. X
  1570. X
  1571. X
  1572. X    Examples:
  1573. X
  1574. X        00000000001111111
  1575. X        01234567890123456
  1576. X    Assume $s0='abcdefghijklmnabc'
  1577. X       $s1='abc'
  1578. X       $s2='n.*'
  1579. X
  1580. X       %match($s0,$s1)      returns 0   $i0=3
  1581. X       %match($s0,$s2)      returns 16  $i0=4
  1582. X       %match($s0,$s3)      returns -1  $i0 unchanged
  1583. X       %match($s0,'de..h')      returns 3   $i0=5
  1584. X       %match($s0,'de..H')      returns -1  $i0 unchanged
  1585. X
  1586. X
  1587. X
  1588. X    4.26  %mhack
  1589. X
  1590. X
  1591. X    usage: %mhack
  1592. X
  1593. X    This function ("Millisecond    time HACK") returns the    number of
  1594. X    milliseconds since ecu was started.     It isn't a very useful    value by
  1595. X    itself, but    differences between the    values returned    by two calls to    the
  1596. X    function may be used to determine the time between two events with the
  1597. X    maximum accuracy the operating system can deliver (1/HZ resolution with
  1598. X    a bit of latency).
  1599. X
  1600. X
  1601. X    Examples:
  1602. X    $i10 = %mhack
  1603. X    send 'test'
  1604. X    lookfor    -e %chr(0x0A) 100
  1605. X    ifi $i0    == 0 echo 'no response in 10 seconds'
  1606. X    else echo 'response time '+%itos(%mhack    - $i10)+' msec'
  1607. X
  1608. X
  1609. X
  1610. X    4.27  %rchr
  1611. X
  1612. X
  1613. X    This function returns the number of    characters received by ECU since the
  1614. X    program starrted.
  1615. X
  1616. X
  1617. X    4.28  %rchrc
  1618. X
  1619. X
  1620. X    This function returns the number of    characters received by ECU during
  1621. X    the    current    connection.
  1622. X
  1623. X
  1624. X
  1625. X
  1626. X    Public Domain by wht@n4hgf                 9/10/92
  1627. X
  1628. X
  1629. X
  1630. X
  1631. X
  1632. X
  1633. X
  1634. X    ECU    Procedure Language                      18
  1635. X
  1636. X
  1637. X
  1638. X    4.29  %rinstr
  1639. X
  1640. X
  1641. X    usage: %rinstr(str0,str1)
  1642. X
  1643. X    This function returns the rightmost    column position    withing    str0 that
  1644. X    str1 is found (zero    relative).  If str1 cannot be found in string str0,
  1645. X    -1 is returned.  However, if str1 is null and str0 is not, zero will be
  1646. X    returned (i.e., the    null string matches at the left).
  1647. X
  1648. X    The    comparison is made without regard to case. See also %instr.
  1649. X
  1650. X
  1651. X     Examples:
  1652. X
  1653. X             00000000001111111
  1654. X             01234567890123456
  1655. X     Assume    $s0='abcdefghijklmnabc'
  1656. X        $s1='abc'
  1657. X        $s2='gHi'
  1658. X        $s3='cat'
  1659. X
  1660. X        %instr($s0,$s1)           returns 14
  1661. X        %instr($s0,$s2)           returns 6
  1662. X        %instr($s0,$s3)           returns -1
  1663. X
  1664. X
  1665. X
  1666. X    4.30  %shmid
  1667. X
  1668. X
  1669. X    This function returns the integer shared memory segment id for the
  1670. X    current ECU    process.  It may be used to pass the id    to a "friend"
  1671. X    process so that it may access the shared memory segment (described in
  1672. X    header file    ecushm.h).  For    more details, refer to an earlier section
  1673. X    entitled "Shared Memory 'Friend' Interface."
  1674. X
  1675. X
  1676. X    Example:
  1677. X
  1678. X     system    'ecufriend '+%itos(%shmid)
  1679. X
  1680. X
  1681. X
  1682. X    4.31  %stoi
  1683. X
  1684. X
  1685. X    usage: %stoi(str0)
  1686. X
  1687. X    This function converts the contents    of str0    to an integer and returns
  1688. X    the    value.
  1689. X
  1690. X
  1691. X
  1692. X    Public Domain by wht@n4hgf                 9/10/92
  1693. X
  1694. X
  1695. X
  1696. X
  1697. X
  1698. X
  1699. X
  1700. X    ECU    Procedure Language                      19
  1701. X
  1702. X
  1703. X
  1704. X    4.32  %uid
  1705. X
  1706. X
  1707. X    usage: %uid
  1708. X
  1709. X    This function returns the uid of the user.
  1710. X
  1711. X
  1712. X    4.33  %xchr
  1713. X
  1714. X
  1715. X    This function returns the number of    characters transmitted by ECU since
  1716. X    the    program    starrted.
  1717. X
  1718. X
  1719. X    4.34  %xchrc
  1720. X
  1721. X
  1722. X    This function returns the number of    characters transmitted by ECU during
  1723. X    the    current    connection.
  1724. X
  1725. X
  1726. X
  1727. X
  1728. X
  1729. X
  1730. X
  1731. X
  1732. X
  1733. X
  1734. X
  1735. X
  1736. X
  1737. X
  1738. X
  1739. X
  1740. X
  1741. X
  1742. X
  1743. X
  1744. X
  1745. X
  1746. X
  1747. X
  1748. X
  1749. X
  1750. X
  1751. X
  1752. X
  1753. X
  1754. X
  1755. X
  1756. X
  1757. X
  1758. X    Public Domain by wht@n4hgf                 9/10/92
  1759. X
  1760. X
  1761. X
  1762. X
  1763. X
  1764. X
  1765. X
  1766. X    ECU    Procedure Language                      20
  1767. X
  1768. X
  1769. X
  1770. X    5.    String Functions
  1771. X
  1772. X
  1773. X
  1774. X    5.1     %argv
  1775. X
  1776. X
  1777. X    usage: %argv(int0)
  1778. X
  1779. X    This function returns the string value of an argument passed to the
  1780. X    procedure by the 'do' command.  Argument 0 is the name of the procedure
  1781. X    itself.  The integer function %argc    may be used to determine the number
  1782. X    of arguments passed    to the procedure.  Specifying an argument number
  1783. X    greater than the number of arguments passed    returns    a null string (if
  1784. X    procedure tracing is enabled with the 'ptrace' comand, a warning will be
  1785. X    displayed in this case).
  1786. X
  1787. X     Example:
  1788. X         invocation    from shell:
  1789. X         ecu -p test Quick Brown Fox
  1790. X
  1791. X         invocation    from interactive command line:
  1792. X         do    test Quick Brown Fox
  1793. X
  1794. X         invocation    from procedure:
  1795. X         do    'test' 'Quick' 'Brown' 'Fox'
  1796. X
  1797. X         results in:
  1798. X         %argv(0) =    'test'
  1799. X         %argv(1) =    'Quick'
  1800. X         %argv(2) =    'Brown'
  1801. X         %argv(3) =    'Fox'
  1802. X         %argv(4) =    ''
  1803. X
  1804. X
  1805. X    NOTE: the interactive dial command,    the dialing directory menu and the
  1806. X    initial setup menu all can automatically execute a procedure which
  1807. X    matches a dialed logical telephone number.    There two arguments passed
  1808. X    to these procedures, %argv(0) being    the procedure name as always.
  1809. X    %argv(1) is    set according to the following table:
  1810. X
  1811. X      invoker           %argv(1)
  1812. X     -------------------  -------------
  1813. X     initial setup menu   !INITIAL
  1814. X     interactive dial     !INTERACTIVE
  1815. X     dialing menu          !MENU
  1816. X
  1817. X    Thus it is possible    for the    invoked    procedure to determine that it has
  1818. X    been automatically executed    by testing %argv(1) for    an exclamation
  1819. X    point, or possibly the entire argument.
  1820. X
  1821. X
  1822. X
  1823. X
  1824. X    Public Domain by wht@n4hgf                 9/10/92
  1825. X
  1826. X
  1827. X
  1828. X
  1829. X
  1830. X
  1831. X
  1832. X    ECU    Procedure Language                      21
  1833. X
  1834. X
  1835. X
  1836. X    5.2     %basename
  1837. X
  1838. X
  1839. X    Usage: %basename(str0,str1)
  1840. X
  1841. X    This function is similar to    the UNIX basename(1) utility in    that it
  1842. X    returns a filename minus a supplied    suffix,    if it is present.  Unlike
  1843. X    the    UNIX basename(C) program, %basename does not remove the    directory
  1844. X    part of the    filename.  See also %dirpart and %filepart.
  1845. X
  1846. X
  1847. X    Examples:
  1848. X
  1849. X    %basename('/u1/src/ecu/ecu.c','.c') = /u1/src/ecu/ecu
  1850. X    %basename('ecu.c','.c')    = ecu
  1851. X    %basename('ecu.c','.x')    = ecu.c
  1852. X
  1853. X
  1854. X
  1855. X    5.3     %cgetc
  1856. X
  1857. X
  1858. X    usage: %cgetc
  1859. X
  1860. X    This  function reads one character from the    console    keyboard and returns
  1861. X    it.     The character is not echoed.
  1862. X
  1863. X
  1864. X    5.4     %cgets
  1865. X
  1866. X
  1867. X    usage: %cgets
  1868. X
  1869. X    This function reads    a string from the console keyboard and returns it.
  1870. X    Each character is echoed as    it is typed and    the user's normal erase    and
  1871. X    kill character is available    to edit    the input before terminating the
  1872. X    read with ENTER.
  1873. X
  1874. X
  1875. X    5.5     %chr
  1876. X
  1877. X
  1878. X    usage: %chr(int0)
  1879. X
  1880. X    This function returns the character    value whose ASCII value    is supplied
  1881. X    in int0.
  1882. X
  1883. X
  1884. X
  1885. X
  1886. X
  1887. X
  1888. X
  1889. X
  1890. X    Public Domain by wht@n4hgf                 9/10/92
  1891. X
  1892. X
  1893. X
  1894. X
  1895. X
  1896. X
  1897. X
  1898. X    ECU    Procedure Language                      22
  1899. X
  1900. X
  1901. X
  1902. X    Example:
  1903. X
  1904. X    set $s0    = %chr(4)  places a ^D (EOT) character into $s0
  1905. X
  1906. X
  1907. X
  1908. X    5.6     %date
  1909. X
  1910. X
  1911. X    usage: %date
  1912. X
  1913. X    This function returns the current date in the form 'mm-dd-yyyy' in the
  1914. X    local time zone (daylight time if it applies).
  1915. X
  1916. X
  1917. X    5.7     %datez
  1918. X
  1919. X
  1920. X    usage: %datez
  1921. X
  1922. X    This function returns the current date in the form 'mm-dd-yyyy' in the
  1923. X    UTC    (Z) time zone.
  1924. X
  1925. X
  1926. X    5.8     %day
  1927. X
  1928. X
  1929. X    usage: %day
  1930. X
  1931. X    This function returns the current day of the week as a three character
  1932. X    abbreviation: 'Sun', 'Mon',    'Tue', 'Wed', 'Thu', 'Fri', 'Sat' in the
  1933. X    local time zone (daylight time if it applies).
  1934. X
  1935. X
  1936. X    5.9     %dayz
  1937. X
  1938. X
  1939. X    usage: %dayz
  1940. X
  1941. X    This function returns the current day of the week as a three character
  1942. X    abbreviation: 'Sun', 'Mon',    'Tue', 'Wed', 'Thu', 'Fri', 'Sat' in the UTC
  1943. X    (Z)    time zone.
  1944. X
  1945. X
  1946. X    5.10  %dir
  1947. X
  1948. X
  1949. X    usage: %dir
  1950. X
  1951. X    This function returns the full pathname of the current working
  1952. X    directory.
  1953. X
  1954. X
  1955. X
  1956. X    Public Domain by wht@n4hgf                 9/10/92
  1957. X
  1958. X
  1959. X
  1960. X
  1961. X
  1962. X
  1963. X
  1964. X    ECU    Procedure Language                      23
  1965. X
  1966. X
  1967. X
  1968. X    5.11  %dirpart
  1969. X
  1970. X
  1971. X    usage: %dirpart(str0)
  1972. X
  1973. X    This function returns the directory    portion    of the pathname    supplied in
  1974. X    str0.  See also %basename and %filepart.
  1975. X
  1976. X
  1977. X
  1978. X    Examples:
  1979. X
  1980. X    %dirpart('/u1/src/src/foo.c') = "/u1/src/src"
  1981. X    %dirpart('foo.c') =    "foo.c"
  1982. X    %dirpart('/usr') = ""
  1983. X
  1984. X
  1985. X
  1986. X    5.12  %edate
  1987. X
  1988. X
  1989. X    usage: %edate(int0)
  1990. X
  1991. X    The    value in int0 is expected to be    a number of seconds since January 1,
  1992. X    1970 00:00 UTC (Universal Coordinated Time)    as returned by the integer
  1993. X    functions %fatime and %fmtime.  This function converts the value into a
  1994. X    string representing    the equivalent local time in the form 'mm-dd-yyyy
  1995. X    hh:mm:ss'.
  1996. X
  1997. X    Example:
  1998. X
  1999. X    set    $i0=%fmtime('/xenix')
  2000. X    $i00 = 601178971 (0x23d5435b,04365241533)
  2001. X
  2002. X    set    $s0=%edate($i0)
  2003. X    $s00 = '01-18-1989 21:09:31'
  2004. X
  2005. X
  2006. X
  2007. X    5.13  %envvar
  2008. X
  2009. X
  2010. X    usage: %envvar()
  2011. X
  2012. X    This function returns the string value of an environment variable.
  2013. X
  2014. X
  2015. X    Example:
  2016. X
  2017. X    set $s0=%envvar('HOME')    might set $s0 '/usr/user'
  2018. X
  2019. X
  2020. X
  2021. X
  2022. X    Public Domain by wht@n4hgf                 9/10/92
  2023. X
  2024. X
  2025. X
  2026. X
  2027. X
  2028. X
  2029. X
  2030. X    ECU    Procedure Language                      24
  2031. X
  2032. X
  2033. X
  2034. X    Typical Environment    Variables:
  2035. X
  2036. X    HOME          pathname of home directory
  2037. X    EDITOR          user's preferred editor
  2038. X    PATH          program execution    searchlist
  2039. X    TERM          terminal type
  2040. X    SHELL          user's preferred shell
  2041. X    MAIL          user's mail box file
  2042. X    ECUPROMPT     ECU interactive command prompt
  2043. X              at beginning of execution
  2044. X
  2045. X
  2046. X
  2047. X    5.14  %errstr
  2048. X
  2049. X
  2050. X    usage: %errstr(int0)
  2051. X
  2052. X    This function returns the system error message, given int0 as an errno
  2053. X    as returned    by a file-related command.  fopen.
  2054. X
  2055. X
  2056. X    Example:
  2057. X
  2058. X    echo %errstr(1)
  2059. X    Not owner
  2060. X
  2061. X
  2062. X
  2063. X    5.15  %etime
  2064. X
  2065. X
  2066. X    usage: %etime(int0)
  2067. X
  2068. X    This function returns a string representation of elapsed time in the
  2069. X    format 'hh:mm:ss' for the integer parameter    int0, a    number of seconds.
  2070. X
  2071. X
  2072. X    Example:
  2073. X
  2074. X    echo %etime(62)
  2075. X    00:01:02
  2076. X
  2077. X
  2078. X
  2079. X    5.16  %filepart
  2080. X
  2081. X
  2082. X    usage: %filepart(str0)
  2083. X
  2084. X    This function returns the filename portion of the pathname supplied    in
  2085. X
  2086. X
  2087. X
  2088. X    Public Domain by wht@n4hgf                 9/10/92
  2089. X
  2090. X
  2091. X
  2092. X
  2093. X
  2094. X
  2095. X
  2096. X    ECU    Procedure Language                      25
  2097. X
  2098. X
  2099. X
  2100. X    str0.  See also %basename and %dirpart.
  2101. X
  2102. X
  2103. X    Examples:
  2104. X
  2105. X    %filepart('/u1/src/src/foo.c') = "foo.c"
  2106. X    %filepart('foo.c') = "foo.c"
  2107. X
  2108. X
  2109. X
  2110. X    5.17  %fmodestr
  2111. X
  2112. X
  2113. X    usage: %fmodestr(int0)
  2114. X
  2115. X    This function returns a string representation of the familiar file mode
  2116. X    string given the file mode integer int0.
  2117. X
  2118. X
  2119. X    Example:
  2120. X
  2121. X    echo %fmodestr(0100755)
  2122. X    -rwxr-xr-x
  2123. X
  2124. X    echo %fmodestr(%fmode('/usr/lib'))
  2125. X    drwxr-xr-x
  2126. X
  2127. X
  2128. X
  2129. X    5.18  %itos
  2130. X
  2131. X
  2132. X    usage: %itos(int0[,format])
  2133. X
  2134. X    This function converts integer int0    to a string, optionally    controlling
  2135. X    the    format of the conversion.
  2136. X
  2137. X    If the format parameter is missing,    the conversion is to a minimum
  2138. X    number of decimal characters necessary to hold the result.
  2139. X
  2140. X    If the format parameter is present,    it must    of consist of a    non-null
  2141. X    string made    of one or both optional    parts:
  2142. X
  2143. X
  2144. X
  2145. X
  2146. X
  2147. X
  2148. X
  2149. X
  2150. X
  2151. X
  2152. X
  2153. X
  2154. X    Public Domain by wht@n4hgf                 9/10/92
  2155. X
  2156. X
  2157. X
  2158. X
  2159. X
  2160. X
  2161. X
  2162. X    ECU    Procedure Language                      26
  2163. X
  2164. X
  2165. X
  2166. X    decimal    number of digits to be part of result string
  2167. X    (a leading zero    indicates leading zeroes are to
  2168. X    appear in the string; no leading zero pads with
  2169. X    leading    spaces
  2170. X
  2171. X    a lower    case letter from the following list:
  2172. X        d -    decimal    conversion
  2173. X        x -    hexadecimal conversion
  2174. X        o -    octal conversion
  2175. X
  2176. X    Example:
  2177. X
  2178. X    %itos(33)        '33'
  2179. X    %itos(33,d)        '33'
  2180. X    %itos(33,x)        '21'
  2181. X    %itos(33,5d)        '    33'
  2182. X    %itos(33,010d)        '0000000033'
  2183. X    %itos(33,10d)        '         33'
  2184. X    %itos(33,x)        '21'
  2185. X    %itos(33,04x)        '0021'
  2186. X    %itos(33,4x)        '  21'
  2187. X    %itos(33,o)        '41'
  2188. X    %itos(33,4o)        '     41'
  2189. X
  2190. X
  2191. X
  2192. X    5.19  %left
  2193. X
  2194. X
  2195. X    usage: %left(str0,int0)
  2196. X
  2197. X    This function returns the leftmost int0 characters of str0.     If the
  2198. X    length of the string is less than int0, the    entire str0 is returned.
  2199. X
  2200. X    Example:
  2201. X
  2202. X    if $s0 == 'abcdefg'
  2203. X    %left($s0,3) returns 'abc'
  2204. X
  2205. X
  2206. X
  2207. X    5.20  %line
  2208. X
  2209. X
  2210. X    usage: %line
  2211. X
  2212. X    This function returns the name of the attached communications line in
  2213. X    the    form "/dev/ttyxx".  If no line is currently attached, the function
  2214. X    returns null.
  2215. X
  2216. X
  2217. X
  2218. X
  2219. X
  2220. X    Public Domain by wht@n4hgf                 9/10/92
  2221. X
  2222. X
  2223. X
  2224. X
  2225. X
  2226. X
  2227. X
  2228. X    ECU    Procedure Language                      27
  2229. X
  2230. X
  2231. X
  2232. X    5.21  %logname
  2233. X
  2234. X
  2235. X    usage: %logname
  2236. X
  2237. X    This function returns the login name of the    user executing ECU.  Note:
  2238. X    the    name returned is the name supplied to a    login prompt, not any
  2239. X    current su(C) username that    may be in effect.
  2240. X
  2241. X
  2242. X    5.22  %mid
  2243. X
  2244. X
  2245. X    usage: %mid(str0,int0[,int1])
  2246. X
  2247. X    This function returns the middle portion of    a string str0 beginning    with
  2248. X    the    character at position int0 and for a length of int1 characters.     If
  2249. X    int0 is greater than or equal to the length    of stro, a null    string is
  2250. X    returned.  If the optional argument    int1 is    not supplied, or if the
  2251. X    length of the string is less than int1, the    entire str0 is returned.
  2252. X
  2253. X    Example:
  2254. X
  2255. X    if $s0 == '0123456789abc'
  2256. X    %mid($s0,3,4)  returns '3456'
  2257. X    %mid($s0,3)    returns '3456789abc'
  2258. X    %mid($s0,10,2) returns 'ab'
  2259. X    %mid($s0,10,5) returns 'abc'
  2260. X
  2261. X
  2262. X
  2263. X    5.23  %month
  2264. X
  2265. X
  2266. X    usage: %month
  2267. X
  2268. X    This function returns the current month as a three character
  2269. X    abbreviation: 'Jan', 'Feb',    'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
  2270. X    'Sep', 'Oct', 'Nov', 'Dec'.
  2271. X
  2272. X
  2273. X    5.24  %rdesc
  2274. X
  2275. X
  2276. X    usage: %rdesc
  2277. X
  2278. X    This function returns the description portion of the dialing directory
  2279. X    entry for the currently connected remote.  If no connection    exists,    the
  2280. X    function returns null.
  2281. X
  2282. X
  2283. X
  2284. X
  2285. X
  2286. X    Public Domain by wht@n4hgf                 9/10/92
  2287. X
  2288. X
  2289. X
  2290. X
  2291. X
  2292. X
  2293. X
  2294. X    ECU    Procedure Language                      28
  2295. X
  2296. X
  2297. X
  2298. X    5.25  %right
  2299. X
  2300. X
  2301. X    usage: %right(str0,int0)
  2302. X
  2303. X    This function returns the rightmost    int0 characters    of str0.  If the
  2304. X    length of the string is less than int0, the    entire str0 is returned.
  2305. X
  2306. X    Example:
  2307. X
  2308. X    if $s0 == 'abcdefg'
  2309. X    %right($s0,3) returns 'efg'
  2310. X
  2311. X
  2312. X
  2313. X    5.26  %rname
  2314. X
  2315. X
  2316. X    usage: %rname
  2317. X
  2318. X    This function returns the logical name portion of the dialing directory
  2319. X    entry for the currently connected remote.  If the remote was dialed
  2320. X    directly, as in dial 5551212, the returned value is    the phone number.
  2321. X    If no connection exists, the function returns null.
  2322. X
  2323. X    The    value returned by this command may be overridden by use    of the rname
  2324. X    procedure command.
  2325. X
  2326. X
  2327. X    5.27  %rtelno
  2328. X
  2329. X    usage: %rtelno
  2330. X
  2331. X    This function returns the telephone    number portion of the dialing
  2332. X    directory entry for    the currently connected    remote.     If no connection
  2333. X    exists, the    function returns null.
  2334. X
  2335. X
  2336. X    5.28  %time
  2337. X
  2338. X
  2339. X    usage: %time
  2340. X
  2341. X    This function returns the current time in the form 'hh:mm' in the local
  2342. X    time zone (daylight    time if    it applies).
  2343. X
  2344. X
  2345. X
  2346. X
  2347. X
  2348. X
  2349. X
  2350. X
  2351. X
  2352. X    Public Domain by wht@n4hgf                 9/10/92
  2353. X
  2354. X
  2355. X
  2356. X
  2357. X
  2358. X
  2359. X
  2360. X    ECU    Procedure Language                      29
  2361. X
  2362. X
  2363. X
  2364. X    5.29  %times
  2365. X
  2366. X
  2367. X    usage: %times
  2368. X
  2369. X    This function returns the current time in the form 'hh:mm:ss' in the
  2370. X    local time zone (daylight time if it applies).
  2371. X
  2372. X
  2373. X    5.30  %timez
  2374. X
  2375. X
  2376. X    usage: %timez
  2377. X
  2378. X    This function returns the current time in the form 'hh:mm' in the UTC
  2379. X    (Z)    time zone.
  2380. X
  2381. X
  2382. X    5.31  %timezs
  2383. X
  2384. X
  2385. X    usage: %timezs
  2386. X
  2387. X    This function returns the current time in the form 'hh:mm:ss' in the UTC
  2388. X    (Z)    time zone.
  2389. X
  2390. X
  2391. X    5.32  %tty
  2392. X
  2393. X
  2394. X    usage: %tty
  2395. X
  2396. X    This function returns the console tty name in the form "/dev/ttynn".
  2397. X
  2398. X
  2399. X    5.33  %uname
  2400. X
  2401. X
  2402. X    usage: %uname
  2403. X
  2404. X    This function returns the system name you are executing ECU    on as
  2405. X    reported by    uname(2)/uname(S).  On SCO systems, if /etc/systemid exists
  2406. X    and    is readable, the name in that file isused in place of the name from
  2407. X    uname.
  2408. X
  2409. X
  2410. X
  2411. X
  2412. X
  2413. X
  2414. X
  2415. X
  2416. X
  2417. X
  2418. X    Public Domain by wht@n4hgf                 9/10/92
  2419. X
  2420. X
  2421. X
  2422. X
  2423. X
  2424. X
  2425. X
  2426. X    ECU    Procedure Language                      30
  2427. X
  2428. X
  2429. X
  2430. X    6.    Commands
  2431. X
  2432. X
  2433. X
  2434. X    6.1     autorz
  2435. X
  2436. X
  2437. X    usage: autorz [off | on]
  2438. X
  2439. X    ECU    in the interactive mode    (no procedure executing) can interpret a
  2440. X    SUB, 'B', '0', '0' receive data sequence as    a ZMODEM ZRQINIT frame and
  2441. X    automatically begin    a ZMODEM receive operation.  This command controls
  2442. X    this feature.  By default, this feature is turned on.
  2443. X
  2444. X
  2445. X    6.2     baud
  2446. X
  2447. X
  2448. X    usage: baud    <baud-int>
  2449. X
  2450. X    This command sets the baud rate for    the attached line.  The    integer
  2451. X    argument <baud-int>    must be    one of 110, 300, 600, 1200, 2400, 4800,
  2452. X    9600, 19200    and 38400.
  2453. X
  2454. X    Using the 'baud' procedure command in the ECU initialization procedure
  2455. X    "_rc.ep" serves as an exact    analog of the -b command.  The baud command
  2456. X    with the setline command gives you programatic control over    the actual
  2457. X    choice of the line and rate    or the defaults    for the    setup screen,
  2458. X    depending upon other options.  NOTE: using the baud    command    in _rc.ep
  2459. X    will override any command line -b specification.
  2460. X
  2461. X
  2462. X    Example:
  2463. X    baud 9600
  2464. X    set $i0=2400; baud $i0
  2465. X
  2466. X
  2467. X
  2468. X    6.3     break
  2469. X
  2470. X
  2471. X    usage: break
  2472. X
  2473. X    This command is used inside    a whilei or whiles compound statement to
  2474. X    exit the loop.
  2475. X
  2476. X    This is not    to be confused with the    interactive command "break" when
  2477. X    sends an asynchronous BREAK    signal.     Use the procedure command lbreak
  2478. X    for    this purpose.
  2479. X
  2480. X
  2481. X
  2482. X
  2483. X
  2484. X    Public Domain by wht@n4hgf                 9/10/92
  2485. X
  2486. X
  2487. X
  2488. X
  2489. X
  2490. X
  2491. X
  2492. X    ECU    Procedure Language                      31
  2493. X
  2494. X
  2495. X
  2496. X    Example:
  2497. X
  2498. X    whilei 1=1 #forever unless break command executed
  2499. X    {
  2500. X        echo -n 'Answer yes    or no: '
  2501. X        set    $s0=%cgets # get answer
  2502. X        ifi    %instr($s0,'y')    == 0 set $i0 = 1; break
  2503. X        ifi    %instr($s0,'n')    == 0 set $i0 = 0; break
  2504. X        # got neither 'y' nor 'n' ... keep trying
  2505. X    }
  2506. X    # now $i0 = 1 if yes, 0    if no
  2507. X
  2508. X
  2509. X    NOTE: further examples of break usage may be found in the example for
  2510. X    the    else command.
  2511. X
  2512. X
  2513. X    6.4     cd
  2514. X
  2515. X
  2516. X    usage: cd <directory-path>
  2517. X
  2518. X    This command changes ECU's current working directory.  The string
  2519. X    argument <directory-path> may contain any directory    pathname
  2520. X    specification legal    to be submitted    to the shell csh.  Wild    card
  2521. X    characters may be used, provided the expansion produces only one
  2522. X    pathname.
  2523. X
  2524. X
  2525. X    Example:
  2526. X
  2527. X    cd '~user/bin'
  2528. X    cd %envvar('HOME')+'/bin'
  2529. X
  2530. X
  2531. X
  2532. X    6.5     clrx
  2533. X
  2534. X
  2535. X    usage: clrx
  2536. X
  2537. X    This command clears     the attached line's transmitter XOFF state.
  2538. X    Issuing the    command    is the equivalent to receiving an XON from the
  2539. X    remote system.
  2540. X
  2541. X
  2542. X
  2543. X
  2544. X
  2545. X
  2546. X
  2547. X
  2548. X
  2549. X
  2550. X    Public Domain by wht@n4hgf                 9/10/92
  2551. X
  2552. X
  2553. X
  2554. X
  2555. X
  2556. X
  2557. X
  2558. X    ECU    Procedure Language                      32
  2559. X
  2560. X
  2561. X
  2562. X    6.6     cls
  2563. X
  2564. X
  2565. X    usage: cls
  2566. X
  2567. X    This command clears    the screen.
  2568. X
  2569. X
  2570. X    6.7     color
  2571. X
  2572. X
  2573. X
  2574. X    usage: color <normal-foreground> [<normal-background>]
  2575. X    usage: color -r <reverse-foreground> [<reverse-background>]
  2576. SHAR_EOF
  2577. true || echo 'restore of doc/proc.man failed'
  2578. fi
  2579. echo 'End of ecuman320 part 3'
  2580. echo 'File doc/proc.man is continued in part 4'
  2581. echo 4 > _shar_seq_.tmp
  2582. exit 0
  2583.  
  2584. exit 0 # Just in case...
  2585.