; CKURZSZ.INI -- UNIX C-Kermit X/Y/ZMODEM extern protocol macros. ; ; F. da Cruz and C. Gianone, Columbia University, July 1994. ; Modeled after earlier non-REDIRECT macros by Rick Calder at AT&T. ; ; Most recent update: Mon Sep 5 13:00:32 1994 ; ; NOTE: This file is obsolete as of C-Kermit 6.0, which supports ; external protocols directly with its SET PROTOCOL command. ; ; UNIX C-Kermit Macros to run UNIX Xmodem, Ymodem, and Zmodem as external ; protocols when C-Kermit is in local mode, i.e. over SET LINE, SET HOST, or ; TELNET connections. ; ; To use, "take ckurzsz.ini" to define the following macros: ; ; SX - Send with Xmodem RX - Receive with Xmodem ; SB - Send with Ymodem RB - Receive with Ymodem ; SZ - Send with Zmodem RZ - Receive with Zmodem ; ; Each macro each takes the same arguments as the corresponding UNIX program. ; No validation is performed on the arguments except to ensure that the ; minimum number of them is supplied in each case. If so, the program is run ; with the given arguments with its input and output redirected to Kermit's ; communication channel. If not, the macro prints an error message and fails. ; ; It is assumed that sx, rx, sb, rb, sz, and rz are in your UNIX PATH, and ; that they are the pre-1989 versions that allow their standard input and ; output to be redirected. ; ; If this version of C-Kermit has the REDIRECT command, it is used and these ; macros will work no matter what your shell is. Otherwise your current shell ; must be ksh or bash for i/o redirection of \v(ttyfd). Note: both ksh and ; bash report themselves as /bin/ksh (or /usr/bin/ksh) via the SHELL ; environment variable. ; ; DISCLAIMER: ; These macro definitions are included with C-Kermit as a convenience to ; users of sz/rz. Columbia University is not a source for the sz/rz ; software, nor does it support sz/rz in any way. For further information ; about sz/rz and related products, contact: ; ; Omen Technology Inc ; 17505-V Northwest Sauvie Island Road ; Portland, OR 97231, USA ; Voice: +1 503 614-0430, Fax: 503 629-0665, Email: caf@omen.com ; set take error on ; And of course, we need the script programming language. check if set take error off if not eq "\v(system)" "UNIX" - stop 1 \v(cmdfile): Sorry - UNIX C-Kermit required. define _zcmd run ; Assume we don't have REDIRECT. xif not < \v(version) 501190 { - ; See if we do. check redirect, - if ok def _zcmd redirect - ; We do. } ; If no REDIRECT command, check shell, and if OK use RUN blah <&n ... >&n ... ; xif eq \m(_zcmd) run { - if not eq "\$(SHELL)" "/bin/bash" - if not eq "\$(SHELL)" "/bin/ksh" - if not eq "\$(SHELL)" "/usr/bin/ksh" - stop 1 - \v(cmdfile): Sorry - ksh or bash required - read comments in \v(cmdfile), - } ; Check that we are in local mode, get redirector if needed. ; This must be evaluated each time one of these macros is called in case ; the communication channel changed since last time. ; define _zchk if < \v(ttyfd) 0 - stop 1 Sorry - prior SET LINE or SET HOST required, - if eq \m(_zcmd) run asg _zio <&\v(ttyfd) >&\v(ttyfd) ; Send specified file(s) with Zmodem. ; define sz _zchk, if = \v(argc) 1 end 1 {sz what file(s)?}, - \m(_zcmd) sz \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 \m(_zio) ; Receive file(s) with Zmodem. ; define rz _zchk, \m(_zcmd) rz \m(_zio) ; Send specified file(s) with Ymodem. ; define sb _zchk, if = \v(argc) 1 end 1 {sb what file(s)?}, - \m(_zcmd) sb \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 \m(_zio) ; Receive with Ymodem. ; define rb _zchk, \m(_zcmd) rb \m(_zio) ; Send a single file with Xmodem. ; define sx _zchk, if = \v(argc) 1 end 1 {sx what file?}, - \m(_zcmd) sx \%1 \%2 \%3 \%4 \%5 \%6 \%7 \m(_zio) ; Receive a file with Xmodem (receiver must be told the filename too). ; define rx _zchk, if = \v(argc) 1 end 1 {rx what file?}, - \m(_zcmd) rx \%1 \m(_zio) ; End of CKURZSZ.INI