1 | ; CKURZSZ.INI -- UNIX C-Kermit X/Y/ZMODEM extern protocol macros. |
---|
2 | ; |
---|
3 | ; F. da Cruz and C. Gianone, Columbia University, July 1994. |
---|
4 | ; Modeled after earlier non-REDIRECT macros by Rick Calder at AT&T. |
---|
5 | ; |
---|
6 | ; Most recent update: Mon Sep 5 13:00:32 1994 |
---|
7 | ; |
---|
8 | ; UNIX C-Kermit Macros to run UNIX Xmodem, Ymodem, and Zmodem as external |
---|
9 | ; protocols when C-Kermit is in local mode, i.e. over SET LINE, SET HOST, or |
---|
10 | ; TELNET connections. |
---|
11 | ; |
---|
12 | ; To use, "take ckurzsz.ini" to define the following macros: |
---|
13 | ; |
---|
14 | ; SX - Send with Xmodem RX - Receive with Xmodem |
---|
15 | ; SB - Send with Ymodem RB - Receive with Ymodem |
---|
16 | ; SZ - Send with Zmodem RZ - Receive with Zmodem |
---|
17 | ; |
---|
18 | ; Each macro each takes the same arguments as the corresponding UNIX program. |
---|
19 | ; No validation is performed on the arguments except to ensure that the |
---|
20 | ; minimum number of them is supplied in each case. If so, the program is run |
---|
21 | ; with the given arguments with its input and output redirected to Kermit's |
---|
22 | ; communication channel. If not, the macro prints an error message and fails. |
---|
23 | ; |
---|
24 | ; It is assumed that sx, rx, sb, rb, sz, and rz are in your UNIX PATH, and |
---|
25 | ; that they are the pre-1989 versions that allow their standard input and |
---|
26 | ; output to be redirected. |
---|
27 | ; |
---|
28 | ; If this version of C-Kermit has the REDIRECT command, it is used and these |
---|
29 | ; macros will work no matter what your shell is. Otherwise your current shell |
---|
30 | ; must be ksh or bash for i/o redirection of \v(ttyfd). Note: both ksh and |
---|
31 | ; bash report themselves as /bin/ksh (or /usr/bin/ksh) via the SHELL |
---|
32 | ; environment variable. |
---|
33 | ; |
---|
34 | ; DISCLAIMER: |
---|
35 | |
---|
36 | ; These macro definitions are included with C-Kermit as a convenience to |
---|
37 | ; users of sz/rz. Columbia University is not a source for the sz/rz |
---|
38 | ; software, nor does it support sz/rz in any way. For further information |
---|
39 | ; about sz/rz and related products, contact: |
---|
40 | ; |
---|
41 | ; Omen Technology Inc |
---|
42 | ; 17505-V Northwest Sauvie Island Road |
---|
43 | ; Portland, OR 97231, USA |
---|
44 | ; Voice: +1 503 621-3406, Fax: -3735, Email: caf@omen.com |
---|
45 | ; |
---|
46 | set take error on ; And of course, we need the script programming language. |
---|
47 | check if |
---|
48 | set take error off |
---|
49 | |
---|
50 | if not eq "\v(system)" "UNIX" - |
---|
51 | stop 1 \v(cmdfile): Sorry - UNIX C-Kermit required. |
---|
52 | |
---|
53 | define _zcmd run ; Assume we don't have REDIRECT. |
---|
54 | xif not < \v(version) 501190 { - ; See if we do. |
---|
55 | check redirect, - |
---|
56 | if ok def _zcmd redirect - ; We do. |
---|
57 | } |
---|
58 | |
---|
59 | ; If no REDIRECT command, check shell, and if OK use RUN blah <&n ... >&n ... |
---|
60 | ; |
---|
61 | xif eq \m(_zcmd) run { - |
---|
62 | if not eq "\$(SHELL)" "/bin/bash" - |
---|
63 | if not eq "\$(SHELL)" "/bin/ksh" - |
---|
64 | if not eq "\$(SHELL)" "/usr/bin/ksh" - |
---|
65 | stop 1 - |
---|
66 | \v(cmdfile): Sorry - ksh or bash required - read comments in \v(cmdfile), - |
---|
67 | } |
---|
68 | |
---|
69 | ; Check that we are in local mode, get redirector if needed. |
---|
70 | ; This must be evaluated each time one of these macros is called in case |
---|
71 | ; the communication channel changed since last time. |
---|
72 | ; |
---|
73 | define _zchk if < \v(ttyfd) 0 - |
---|
74 | stop 1 Sorry - prior SET LINE or SET HOST required, - |
---|
75 | if eq \m(_zcmd) run asg _zio <&\v(ttyfd) >&\v(ttyfd) |
---|
76 | |
---|
77 | ; Send specified file(s) with Zmodem. |
---|
78 | ; |
---|
79 | define sz _zchk, if = \v(argc) 1 end 1 {sz what file(s)?}, - |
---|
80 | \m(_zcmd) sz \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 \m(_zio) |
---|
81 | |
---|
82 | ; Receive file(s) with Zmodem. |
---|
83 | ; |
---|
84 | define rz _zchk, \m(_zcmd) rz \m(_zio) |
---|
85 | |
---|
86 | ; Send specified file(s) with Ymodem. |
---|
87 | ; |
---|
88 | define sb _zchk, if = \v(argc) 1 end 1 {sb what file(s)?}, - |
---|
89 | \m(_zcmd) sb \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 \m(_zio) |
---|
90 | |
---|
91 | ; Receive with Ymodem. |
---|
92 | ; |
---|
93 | define rb _zchk, \m(_zcmd) rb \m(_zio) |
---|
94 | |
---|
95 | ; Send a single file with Xmodem. |
---|
96 | ; |
---|
97 | define sx _zchk, if = \v(argc) 1 end 1 {sx what file?}, - |
---|
98 | \m(_zcmd) sx \%1 \%2 \%3 \%4 \%5 \%6 \%7 \m(_zio) |
---|
99 | |
---|
100 | ; Receive a file with Xmodem (receiver must be told the filename too). |
---|
101 | ; |
---|
102 | define rx _zchk, if = \v(argc) 1 end 1 {rx what file?}, - |
---|
103 | \m(_zcmd) rx \%1 \m(_zio) |
---|
104 | |
---|
105 | ; End of CKURZSZ.INI |
---|