[comp.sources.amiga] v89i179: vt100 - terminal emulator v2.9, Part02/09

page%swap@Sun.COM (Bob Page) (10/20/89)

Submitted-by: acs@pccuts.pcc.amdahl.com (Tony Sumrall)
Posting-number: Volume 89, Issue 179
Archive-name: comm/vt100r29.2

# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
#	README
#	ReleaseNotes
#	RexxSamples/Forward.rexx
#	RexxSamples/Forwarding.rexx
#	RexxSamples/FwdLogon.vt100
#	RexxSamples/OnLogon.vt100
#	RexxSamples/TestDisplay.vt100
#	RexxSamples/TestErrs.vt100
#	RexxSamples/TestFor.rexx
#	RexxSamples/TestMsg.vt100
#	Zmodem/README.1ST
#	Zmodem/Amiga.doc
#	Zmodem/sz.doc
#	Zmodem/rz.doc
#	Zmodem/makefile.ami
#	Zmodem/makefile.uni
#	Zmodem/zmodem.init
#	Zmodem/zmodem.h
# This is archive 2 of a 9-part kit.
# This archive created: Thu Oct 19 22:30:28 1989
echo "extracting README"
sed 's/^X//' << \SHAR_EOF > README
XThis archive contains a vt100 emulator with KERMIT and XMODEM file
Xtransfer protocols.  Original work by Dave Wecker, V2.7-V2.8 by Tony Sumrall.
X
XThanks:
X-------
X	To everyone who sent in code, suggestions and fixes!
X
XReleases:
X---------
X	v2.9 ?????? ACS - See Release Notes.
X	v2.8 880117 ACS - See Release Notes.
X	v2.7 870825 ACS - See Release Notes.
X	v2.6 870227 DBW - bug fixes for all the stuff in v2.5
X	v2.5 870214 DBW - more additions (see readme file)
X	v2.4 861214 DBW - lots of fixes/additions
X	v2.3 861101 DBW - minor bug fixes
X	v2.2 861012 DBW - more of the same
X	v2.1 860915 DBW - new features (see README)
X	v2.0 860823 DBW - Major rewrite
X	v1.1 860720 DBW	- Switches, 80 cols, colors, bug fixes
X	v1.0 860712 DBW	- First version released
X
XUsage:
X------
X	Please read VT100.DOC for usage information and examples.
X
XKnown problems:
X---------------
X	none
X
XSuggestions/bug fixes not implemented (as of yet):
X--------------------------------------------------
X	- Custom screen should use a borderless backdrop window
X	- Quit from keyboard should be supported (for above)
X	- Automatic maximum sizing of window should happen
X	- Screen should be resizable
X	- AT TIME should be implemented in scripts (besides DELAY)
X	- Kermit should create sub directories (when necessary)
X	- Use a disk font for graphic character set
X	- Kermit VM/CMS (IBM) protocol support (it works for me, how about
X	  you?)
X	- Allow the user to use a keymap different from the default one.
X
XInstallation:
X-------------
X	The files in this archive may be extracted by the bourne shell
X	(/bin/sh) or the shar program using the "unshar switch (-u)",
X	contact me if you need a copy of this version of shar.
X
X	REMEMBER: Set the correct compiler definition in VT100.H
X
XFiles:
X------
X	README		- this file
X	ReleaseNotes	- Details of what's changed
X	vt100.doc	- documentation for the terminal emulator
X	makefile	- make file for the emulator (under MANX AZTEC-C)
X	vt100.h		- include file used by all other modules
X	window.c	- manager for window and keyboard
X	vt100.c		- main module, handles menus
X	remote.c	- handle remote characters (vt100 emulation)
X	kermit.c	- kermit protocol (to transfer text files on VMS
X			  select the CRLF option on the transfer mode menu,
X			  otherwise use image mode).
X	init.c		- startup code
X	xmodem.c	- xmodem protocol that understands AMIGA binary and
X			  text file formats (automatically).
X	script.c	- script control package
X	expand.c	- filename expansion (wildcards) and dir setting
X	rexx.c		- handles the AREXX interface
X	newkermit.c	- New kermit module by Steve Walton suitable for
X			  expanding VT100's capabilities
X	kermitproto.c	- New kermit module by Steve Walton
X	kermitproto.h	- New kermit module by Steve Walton
X
XOther directories:
X
XRexxSamples:
X	Forward.rexx	- Shows use of FORWARD command.  Interacts with VT100.
X	Forwarding.rexx	- Shows use of FORWARD command.  Interacts with VT100.
X	TestFor.rexx	- Shows use of FORWARD command.  Interacts with VT100.
X	FwdLogon.vt100	- Demos use of FORWARD cmd to log you on
X	OnLogon.vt100	- Demos use of ON and FORWARD cmds to log you on
X	TestMsg.vt100	- Demos use of MSG command.
X	TestDisp.vt100	- Demos use of DISPLAY command.
X	TestErrs.vt100	- Shows various return codes from VT100 commands.
X
XZmodem:
X	Amiga.doc	- Text file about the Amiga implementation of zmodem
X	SerIO.c		- Serial I/O support for Zmodem
X	makefile.ami	- Amiga makefile for Zmodem
X	makefile.uni	- Un*x makefile for Zmodem
X	patch		- Patches that I applied to the Frank's original
X	rbsb.c		- Support routines for Zmodem
X	rz.c		- Mainline code for Zmodem receive
X	rz.doc		- Documentation for Amiga Zmodem receive
X	sz.c		- Mainline code for Zmodem send
X	sz.doc		- Documentation for Amiga Zmodem send
X	term.c		- Terminal-mode routine for Amiga Zmodem
X	zm.c		- Support routines for Zmodem
X	zmodem.h	- Header file for Amiga Zmodem
X	zmodem.init	- Sample Amiga Zmodem initialization file
X
XGNU-Emacs:
X	amiga.el	- Emacs Lisp code to utilitize the mouse.
X
X
XContact:
X--------
XPlease send bugs/comments/suggestions/praise for V2.9 to:
X
X	Tony Sumrall at USENET: acs@amdahl.com
SHAR_EOF
echo "extracting ReleaseNotes"
sed 's/^X//' << \SHAR_EOF > ReleaseNotes
XRelease Notes:
X--------------
Xv2.9 ?????? ACS - Many changes.  Highlights:
X	- Open information window at far right of main window.
X	- Remember last CD name, last script file name and the name of the last
X	  file transferred.
X	- Support mouse location presentation including new MENU options in the
X	  Utility menu (Mouse Up and Mouse Dn), new F-key command "F M" to
X	  set the mouse introducer and some ELISP code to allow GNU EMACS to
X	  make use of the mouse.  Compliments of: Mike (I'll think of something
X	  yet) Meyer <mwm@violet.berkeley.edu> and Mic Kaczmarczik
X	  (mic@emx.cc.utexas.edu).
X	- Correctly handles multiple menu selections at once.
X	- New command: AUTOCHOP (with companion shortcut) to enable/disable
X	  XMODEM auto-chop code.
X	- New command: RX which will invoke an AREXX macro (if compiled with
X	  AREXX defined AND you have AREXX).  Companion shortcut.  Unrecognized
X	  commands are automatically sent to AREXX.
X	- XMODEM now uses a larger buffer (4K) so it won't write to disk so
X	  often.
X	- New command: EXTERNAL which allows specification of an external (to
X	  VT100) program which is to handle file transfer.  XPROTO command can
X	  select an EXTERNAL protocol as the default.  Note that this is NOT
X	  support or external protocol libraries -- that will come in a later
X	  release.  Along with this I'm, distributing a modified version of
X	  Frank Anthes' sz/rz port to the Amiga.
X	- Added a RexxSamples directory to the distribution.
X	- A500/A2000 users can use ()*/ on their keypad as F1-F4.
X	- New command: FONTSIZE.  User may now specify the size of the font to
X	  be used...you're no longer restricted to 8x8.  Still doesn't handle
X	  proportional fonts.
X	- New, optional, kermit routines: kermitproto.[ch] and newkermit.c
X	  courtesy of Steve Walton.  You may use these routines in place of
X	  the original kermit.c
X	- Should compile under Lattice 5.02 with few error messages.  REMEMBER
X	  TO CHANGE THE DEFINE IN VT100.H!!!
X	- New command: MSG allows user to display text in the info window.
Xv2.8 880117 ACS - Info/Status window automatically deselected.
X	- 1st menu item re-worked.  Now the user need only choose Send,
X	  Receive, Kermit Get, Kermit Bye and Capture.  Protocol to send or
X	  receive is selected via the 1st sub-menu from the 1st menu item.
X	- New command: XPROTO XMODEM | XMODEMCRC | ASCII | KERMIT to select
X	  transfer protocol via scripts.
X	- User may capture simultaneously with sending or receiving via
X	  a different protocol by using the Capture menu item.  This item
X	  changes to Capturing when capture is in effect.
X	- Kermit will transfer long packets (up to 1000 bytes).  New cmd:
X	  "KMAXPACK n" sets maximum packet length to n bytes.  Remember to
X	  increase your send and/or receive timeouts on your host!!!
X	- Added insert/delete character to the recognized escape sequences.
X	  ESC [ n @ inserts n characters, ESC [ n P deletes n characters
X	  (thanks to John Wang (jwang@ATRP.MEDIA.MIT.EDU)).  He suggests 
X	  using the following termcap:
X	  CA|vt100|amiga|Amiga termcap:al=\E[L:AL=\E[%dL:am:bl=^G:bs:cd=\E[J:\
X	    :ce=\E[K:cl=\E[;H\E[2J:cm=\E[%i%d;%dH:co#80:cr=^M:cs=\E[%i%d;%dr:\
X	    :dc=\E[P:DC=\E[%dP:dl=\E[M:DL=\E[%dM:do=^J:ho=\E[H:\
X	    :is=\E[1;24r\E[24;1H:ic=\E[@:IC=\E[%d@:kb=^H:kd=\E[B:\
X	    :ke=\E[?1l\E>:kl=\E[D:kr=\E[C:ks=\E[?1h\E=:ku=\E[A:k1=\EOP:\
X	    :k2=\EOQ:k3=\EOR:k4=\EOS:le=^H:li#24:mb=\E[5m:md=\E[1m:me=\E[m:\
X	    :mr=\E[7m:nd=\E[C:pt:rc=\E8:rf=/usr/lib/tabset/vt100:\
X	    :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:sc=\E7:se=\E[m:\
X	    :sf=^J:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:vc#16:vt#3:xn:
X	- Fixed scroll regions.  Now will not wrap-around out of a scroll
X	  region. (thanks to Tad Guy (ames!xanth.cs.odu.edu!tadguy))
X	- Fixed the FileLock() problem (thanks to many!).
X	- The "nagging requester" bug was a bug in *my* code (gasp!).  Thanks
X	  to Joel Swank (joels@tekred.TEK.COM) for finding and squashing it!
X	- Fixed overzealous xmodem chopping.  It now strips contiguous
X	  strings of nulls OR Ctrl-Z (not a mixture) and will avoid writing
X	  anything if they were all chopped.  Thanks to Wayne Davison
X	  (drivax!davison--I only had to modify it a little, Wayne).  Also,
X	  when sending, it now sends a stream of nulls OR Ctrl-Zs, whichever
X	  is NOT the last character.
X	- Removed an extraneous continue in readchar().  Thanks to someone!
X	  (Sorry, I lost your name and address.)
X	- Now uses the default keymap.  All of the old mappings have been
X	  retained (e.g. Ctrl-2 generates Ctrl-@, Ctrl-6 generates Ctrl-^,
X	  ALT acts as META key (i.e. sets the high-order bit)).  Note,
X	  however, that your keymap may preclude the use of the ALT key if
X	  dead keys are defined.  A future version will support specification
X	  of a keymap different from the system map.
X	- New commands: SENDF file-spec and REC file which will send/receive
X	  via the default XPROTO setting.  You still have XS, KR, etc.
X	- New command: FONT font-name.  Allows the user to specify which
X	  8-point font to use.  If you want to use your new whippy-font, sau
X	  FONT whippy-font.  These must be 8-point fonts for now!
X	- Saying LINES 0 will use all available lines on the screen (useful
X	  to you MoreRows groupies).
X	- P_unit may be changed in vt100.c to specify a different unit of
X	  the serial.device to use (for expansion serial ports).  As of this
X	  writing there are no expansion serial devices...this is just in
X	  preparation for the future.  Also provided a new INIT command:
X	  UNIT which accomplishes the same result.
Xv2.7 870825 ACS - Requester is only used for input.  A new window (the
X	  Info/Xfer Status window) now shows what used to go there and the
X	  requester now comes up in this window.  The window is sizable,
X	  draggable, closeable and front-to-backable; when re-opened it
X	  will appear in its last location with its last dimensions.  The
X	  window ignores input but will become active when it's first
X	  displayed as well as when a requester is put up in it.  To
X	  cancel a transfer request, first ensure that the mail VT100
X	  windiw is active then hit ESC in it.
X	- KERMIT mode has been hardened and wildcarded files can be sent
X	  to a KERMIT that is *not* in server mode.  E.g. you may say
X	  RECEIVE to your host's KERMIT then send Foo* -- all files
X	  starting with Foo in the current directory will be sent.
X	- New command line switches -i and +i.  -I says don't use an init
X	  file, +i file says use "file".  User may also specify script
X	  files on the command line which will be executed in sequence.
X	- New init file command SHORTCUT.  See vt100.doc.
X	- I've included the font code.  It looks for an env variable named
X	  "font" (yes, lowercase) and, if found, uses that font for its
X	  test.  If you don't like it you may wanna remove it.  I was gonna
X	  ifdef it but I ran out of time.  Remember that there's a PD set
X	  cmd to allow Lattice users to set env vars.
X	- Nagging bug: On 2nd and subsequent uses of the requester, the
X	  1st character of the last use is redisplayed.  Intuition bug?
Xv2.6 870227 DBW - bug fixes for all the stuff in v2.5
X	- Input requestors are now self selecting (ignore comment in 2.5)
X	- Added a BS<->DEL menu item and startup option (SWAP ON/OFF)
X	- Renamed dopen/dnext/dclose to diropen/dirnext/dirclose for LATTICE
X	- Added a CONVERT option that tells whether KERMIT should downcase
X	- MAJOR CHANGE: re write the INPUT/SCRIPT commands, see VT100.DOC
X	- Fixed a major problem with Set Directory causing LOCK conflicts
X	- Moved the Title up 1 pixel so that it doesn't get cut off anymore
Xv2.5 870214 DBW - more additions (see readme file)
X	- All prompting now done through a string requester/gadget.
X	  NOTE: YOU MUST SELECT THE INPUT STRING OF THE REQUESTER BEFORE
X		YOU CAN TYPE A RESPONSE.
X	- Local echo mode added (half duplex for Carolyn)
X	- BEEP command added to SCRIPT
X	- New menu/init/script items:
X		CLEAR SCREEN	- clears the screen
X	 	ECHO		- turns on/off half duplex mode
X		WRAP		- turns on/off autowrap on long lines
X		NUMKEY		- turns on/off numeric keypad mode
X		APPCUR		- turns on/off application cursor mode
X	- Rewrote toasc() to use qualifier field (no more getting the
X	  keyboard "stuck")
X	- Fixed locking of directories (should now run under workbench ok)
X	- Cleaned up VT100.H to really check includes on compile
X	- Setting font explicitly to TOPAZ 8 (no more dumb assumptions)
X
Xv2.4 861214 DBW - lots of fixes/additions
X	- Beep should now work under Lattice
X	- CreatePort now passes longs (as it should always have)
X	- Nested comments in KERMIT.C removed
X	- Beep volume of 0 (DisplayBeep) now works
X	- snum[] declaration in KERMIT.C fixed
X	- multi_xfer is now void and return fixed (in kermit)
X	- "." can no longer get "stuck" as the break key
X
X	- RIGHT-AMIGA-keys have been added for most menu items
X	- The ALT key is now an EIGHTth bit shifter
X	- Control-@, Control-2, Control-space send the NULL character
X	- Control-6 now sends Control-^
X	- Control-- and Control-? now sends Control-_
X	- Cursor application mode (<esc>[?1h and <esc>[?1l) now work
X	- XMODEM now masks the eighth bit if parity is other than NONE
X
Xv2.3 861101 DBW - minor bug fixes:
X	- added p_wbcolors to allow workbench colors on custom screen
X	  (In the init file you can specify WBCOLORS to be NO (use color
X	   definitions in INIT FILE or VT100.H) or YES (use WORKBENCH
X	   colors for everything)).
X	- "$" now sends a kermit-bye (like it says in VT100.DOC).
X	- made window/screen heights more reasonable
X	- Added ANSI insert line and delete line (<csi><num>L and
X	  <csi><num>M) to speed up various editors (like emacs).
X	  NOTE: This is NOT a VT100 sequence (new extension).
X	- ctrl-space now also sends a null (along with ^@ and ^`)
X	- RAWKEY fixed in WINDOW.C
X	- p_wrap fixed in WINDOW.C
X	- removed WRDMAX from VT100.H
X	- fixed exit with no params in SCRIPT.C
X	- fixed parity comparisons in KERMIT.C
X	- init file [n+1] changed to [nplus1] to make Lattice happy.
X	- cursoron(), cursoroff() changed to one routine cursorflip().
X	- long lines shortened to less than 80 characters (for gateways).
X	- blanks following exit (or comments) now work in scripts.
X
Xv2.2 861012 DBW - more of the same:
X	- The INIT file "exit" can now chain to a script
X	- The SCRIPT command "exit" can now chain to another script
X	- Hangup menu item now works.
X	- Autowrap can now be set from VT100.H, VT100.INIT (<esc>[?7h l)
X	- Control-G is now handled with an audible beep
X	- Script now used "^chr" to send control characters
X	- The graphics "box" character (a) was added
X	- Control-@ and Control-` now send the NULL character
X	- Alternate color for BOLD has been re-instated by popular demand
X	- Menus have been cleaned up.
X	- Lattice compilation cleaned up.
X	- No more wordsize parameter since PARITY takes care of all cases
X	- Function keys can now call scripts
X	- Double shift keys are now handled correctly.
X	- Version has been added to the title bar (for bug reports).
X
Xv2.1 860915 DBW - new features / bug fixes
X	- Now identifies as a VT100 (including the response to <esc>Z)
X	- Cursor color now gets read in as hex (instead of decimal)
X	- REPORTMOUSE taken out of definitions (not needed)
X	- XON/XOFF now being handled by the device driver instead of me
X	- Literal escape characters have been replaced with \033
X	- At init time the user can now specify the input BUFFER size
X	  (typically between 512 and 2048 bytes) depending on baud rate
X	- Script files are now case insensitive for commands
X	- XMODEM now turns off the driver XON/XOFF during transfers
X	- Graphic rendition now done by the OS instead of me.
X	- Initialization files are now searched for in S: instead of C:
X	- Forward GOTO bug fixed in the script package.
X	- Keypad can now be used in both numeric and application mode
X	- General purpose cleanup() routine added for all exits.
X	- Utility menu added (sendbreak, hangup, change directory).
X	  NOTE: hangup is not implemented yet.
X	- Full wild card support in file transfers (see vt100.doc).
X	- Kermit cleaned up with better filename handling (from host).
X	- Script now has CD (changed directory) and SB (send break) commands
X	- Added Parity and Wordsize choices in VT100.H, VT100.INIT, menu
X	  and scripts. (Generates parity from a table).
X	- Added 8th bit quoting in KERMIT when using 7 bit words (ODD or
X	  EVEN parity).
X	- Break time can be set from VT100.H, VT100.INIT or a script file.
X	- Transfer mode (image or CRLF) can now be set from a script file.
X	- Control characters in escape sequences now act like a true VT100.
X	- F10 now works from init files.
X	- Right (or Left) AMIGA with period (".") sends a BREAK to the host
X	  from the keyboard.
X	- XMODEM status kept down to one line for a file transfer.
X
Xv2.0 860823 DBW	- Major rewrite:
X	- Emulator now compiles under either MANX or LATTICE by defining
X	  the appropriate compiler type in VT100.H.
X	- Sped up code to an effective baud rate of (about) 8k. This means
X	  that clear text at 4800 baud should be no problem.
X	- Added XON/XOFF generation so that characters should not get lost
X	  any more at 9600 baud (when receiving clear text).
X	- Got rid of all command line switches and environment variables.
X	  Instead upon invocation the program searches first for any file
X	  named on the command line, then looks for VT100.INIT in the
X	  current directory and finally searches for C:VT100.INIT.
X	  All parameters can be set in the init file, and a sample VT100.INIT
X	  is provided in VT100.DOC that shows all possible options.
X	- All parameters that are set by VT100.INIT are defined in VT100.H
X	  (variables starting with "p_"). This allows you to compile your
X	  own defaults into the code.
X	- You can now set the number of lines (for all you EMACS freaks :-).
X	  On an interlaced screen this gives you upto a 48 line terminal.
X	- WORKBENCH colors are NEVER touched.
X	- In an attempt to keep the size down, the color palette menu item
X	  has been removed (current). Code is about 36K in size with a
X	  run time image (using workbench screen) of about 88k.
X	- Many bugs fixed including reverse scrolling with descenders,
X	  reverse video at end of line, clearing with scrolling regions,
X		... and 20 or more others.
X	- File capture now no longer sends the filename to the host.
X	- BOLD (<esc>[1m) has now been added by using an additional color
X	  when you specify a depth of 2 (instead of 1) bitplane.
X	- UNDERLINE (<esc>[4m) has now been added.
X	- The handling of remote (host) escape sequences has been completly
X	  re-written (thanks to Dawn Banks for all the work).
X	- Function keys (and shifted function keys) can now be bound to
X	  arbitrary strings (Jim Ravan gets his macros). See VT100.DOC
X	  for details.
X	- Cursor has no been reduced to the size of a normal character for
X	  easier readability.
X	- XMODEM has been improved (by Steve Drew) to use a timer device
X	  (for timeouts) and to abort immediately if the user types <ESC>.
X	- KERMIT has been completely re-written and appears to work fine,
X	  thanks to the efforts of Steve Drew.
X	- New menu item allows script file support. Module written by
X	  Steve Drew. See VT100.DOC for details.
SHAR_EOF
if `test ! -d RexxSamples`
then
  mkdir RexxSamples
  echo "mkdir RexxSamples"
fi
echo "extracting RexxSamples/Forward.rexx"
sed 's/^X//' << \SHAR_EOF > RexxSamples/Forward.rexx
X/*   An AREXX macro to demonstrate the FORWARD command and its use.  It will
X** open a port and request VT100 to forward received data to this port.  It
X** will then await 3 messages from VT100 (3 batches of data) and then will ask
X** VT100 to quit forwarding received data, close the port and exit.
X**/
X
Xtrace R
X
Xaddress VT100-serial.device-00
X
Xif show("L", "rexxsupport.library") = 0
Xthen call addlib "rexxsupport.library", 0, -30, 0
X
Xportname = "REXX-VT100"
Xport = openport(portname)
X
Xif Port = '0000 0000'x
Xthen do
X	say "Couldn't open the port."
X	exit 20
Xend
X
X"FORWARD" portname
X
Xdo i = 1 to 3
X	packet = getpkt(portname)
X	if packet = '0000 0000'x
X	then do
X		call waitpkt portname
X		packet = getpkt(portname)
X	end
X	call reply packet, 0
Xend
X
X'FORWARD'
X
Xpacket = getpkt(portname)
Xdo while packet ~= '0000 0000'x
X	call reply packet, 0
X	packet = getpkt(portname)
Xend
X
Xcall closeport port
X
Xexit
SHAR_EOF
echo "extracting RexxSamples/Forwarding.rexx"
sed 's/^X//' << \SHAR_EOF > RexxSamples/Forwarding.rexx
X/* */
Xtrace R
X
Xportname = "REXX-VT100"
XPort = openport(portname)
X
Xif Port = '00000000'x
Xthen do
X	say "Couldn't open the port."
X	exit 20
Xend
X
Xaddress VT100-serial.device-00 "FORWARD" portname
X
Xdo i = 1 to 5
X	call waitpkt portname
X	packet = getpkt(portname)
X	message.i = getarg(packet);
X	call reply packet, 0
Xend
Xtrace ?R
Xpacket = getpkt(portname)
Xif packet ~= '00000000'x
Xthen do
X	message.6 = getarg(packet)
X	call reply packet, 0
Xend
X
Xcall closeport port
X
Xnop
Xexit
SHAR_EOF
echo "extracting RexxSamples/FwdLogon.vt100"
sed 's/^X//' << \SHAR_EOF > RexxSamples/FwdLogon.vt100
X/*   This VT100 AREXX macro will try to log you onto a mythical machine at
X** 555-1212.  This machine expects a username (signalled by the appearance of
X** the character "gin:"), 2 passwords (eached signalled by "word:") and a
X** terminal identifier (signalled by "#?").  If any step is unsuccessful this
X** macro will abort and cause VT100 to issue an appropriate message.  If you
X** get logged on via this macro, it will cause VT100 to display a success msg.
X**
X**   This macro uses the FORWARD and MSG commands of VT100 R2.9.  The FORWARD
X** command is used to step through the login sequence.  This is a fairly slow
X** process and is just used as an example.  If you would like to use some
X** macro as a model, you would probably prefer to use OnLogon.vt100 as it
X** runs MUCH faster.
X**
X**   Note that this macro uses the AmigaDOS WAIT command (in routine receive:).
X** This WILL cause your disks to be accessed every second or so while awaiting
X** receipt of a character from the serial port.  AREXX 1.10 has a delay()
X** which you can use to replace the AmigaDOS WAIT command.  Simply comment out
X** the WAIT and un-comment the delay.
X**
X** Tony Sumrall
X**/
Xtrace Off
X
Xarg phone
X
Xportname = "REXX-VT100"
Xport = openport(portname)
X
Xif Port = '0000 0000'x
Xthen do
X	say "Couldn't open the port."
X	exit 20
Xend
X
X"FORWARD" portname
Xif rc ~= 0
Xthen exit
X
X"BAUD 2400"
X
Xif dial("DT555-1212") = 0
Xthen do
X	'MSG "Dial failed."'
X	call cleanup 20
Xend
X
Xdo i = 1 to 5 while get_match(5, "gin:") ~= 2
X	'SEND "^M"'
Xend
X
Xif login("acs^M", "word:", "1st-pwd^M", "word:", "2nd-pwd^M",,
X	"#?", "1^M") = 0
Xthen do
X	'MSG "Login failed."'
X	call cleanup 20
Xend
X
X'MSG "Logon successful!"'
Xcall cleanup 0
Xexit
X
X/*   Dial the specified number(s).  If we get no connection we keep going till
X** we get a connection.  If we never get one then we return 0 for failure else
X** we return 1 for success.
X**/
Xdial: procedure expose port portname
Xnumargs = arg()
X
Xmsgdata = ""
Xdo i = 1 to numargs
X	'SEND "AT' || arg(i) || '^M"'
X	if get_match(40, "CONNECT", "BUSY", "NO") = 2
X	then leave
Xend
X
Xif i > numargs
Xthen return 0	/* Failure */
Xelse return 1	/* Success */
X
X/*   Login to a host.  We get send/expect sequences and we have to match a prior
X** sequence before going on to the next one.  If we ever miss a match we return
X** 0 for failure; if we match on all args we return 1 for success.
X**/
Xlogin: procedure expose port portname
Xnumargs = arg()
X
Xmsgdata = ""
Xfailures = 0
Xdo i = 1 to numargs
X	if i // 2 = 1
X	then 'SEND "' || arg(i) || '"'
X	else if get_match(5, arg(i)) ~= 2
X	then return 0
Xend
X
Xreturn 1
X
X/*   Get a match from the serial port via VT100.  1st arg is the maximum time
X** we'll wait; subsequent args are "acceptable" match strings.  We return the
X** arg() index of the matched string so if we ever time out we'll return 1
X** (since that's the index of the max time arg).
X**/
Xget_match: procedure expose port portname
Xnumargs = arg()
Xlongest = 0
Xdo i = 2 to numargs
X	longest = max(longest, length(arg(i)))
Xend
X
Xmsgdata = ""
Xmaxtime = arg(1)
Xdo forever
X	msg = receive(maxtime)
X	if msg == ""
X	then return 1
X
X	msgdata = msgdata || msg
X	do i = 2 to numargs
X		ndx = index(msgdata, arg(i))
X		if ndx > 0
X		then leave
X	end
X	if i <= numargs
X	then return i
X
X	if length(msgdata) > longest
X	then msgdata = right(msgdata, longest - 1)
Xend
X
X/*   Don't use the AREXX waitpkt() function as that locks us up until something
X** arrives at the port.  Instead, use the AmigaDOS WAIT command or, if you have
X** AREXX 1.10 or later, the AREXX delay() function.
X**/
Xreceive: procedure expose port portname
Xarg waittime
X
Xtime = 0
Xpacket = getpkt(portname)
Xdo while packet = '0000 0000'x
X	if waittime ~= 0
X	then do
X		if time > waittime
X		then return ""
X		address COMMAND "WAIT 1 SEC"	/* AmigaDOS */
X/*		call delay 50					/* AREXX 1.10 or above */ */
X		time = time + 1
X	end
X	else call waitpkt portname
X	packet = getpkt(portname)
Xend
Xmsg = getarg(packet)
Xcall reply packet, 0
X
Xretval = ""
Xdo while length(msg) > 0
X	parse var msg first '00'x msg
X	retval = retval || first
Xend
X
Xreturn retval
X
Xcleanup: procedure expose port portname
Xarg retc
X
X'FORWARD'
X
Xpacket = getpkt(portname)
Xdo while packet ~= '0000 0000'x
X	call reply packet, 0
X	packet = getpkt(portname)
Xend
X
Xcall closeport port
X
Xexit retc
SHAR_EOF
echo "extracting RexxSamples/OnLogon.vt100"
sed 's/^X//' << \SHAR_EOF > RexxSamples/OnLogon.vt100
X/*   This VT100 AREXX macro will try to log you onto a mythical machine at
X** 555-1212.  This machine expects a username (signalled by the appearance of
X** the character "gin:"), 2 passwords (eached signalled by "word:") and a
X** terminal identifier (signalled by "#?").  If any step is unsuccessful this
X** macro will abort and cause VT100 to issue an appropriate message.  If you
X** get logged on via this macro, it will cause VT100 to display a success msg.
X**
X**   This macro uses the ON, FORWARD and MSG commands of VT100 R2.9.  The ON
X** command is used to step this macro through each of the login steps.  You
X** can probably modify this macro a little and use it yourself.
X**
X**   Note that this macro uses the AmigaDOS WAIT command (in routine receive:).
X** This WILL cause your disks to be accessed every second or so while awaiting
X** receipt of a character from the serial port.  AREXX 1.10 has a delay()
X** which you can use to replace the AmigaDOS WAIT command.  Simply comment out
X** the WAIT and un-comment the delay.
X**
X** Tony Sumrall
X**/
Xtrace Off
X
Xif show("L", "rexxsupport.library") = 0
Xthen call addlib "rexxsupport.library", 0, -30, 0
X
Xif arg() = 0
Xthen do
X	portname = "REXX-VT100"
X	port = openport(portname)
X
X	if Port = '0000 0000'x
X	then do
X		say "Couldn't open the port."
X		exit 20
X	end
X
X	"FORWARD" portname
X	if rc ~= 0
X	then exit
X
X	"BAUD 2400"
X
X	if dial("DT555-1212") = 0
X	then do
X		'MSG "Dial failed."'
X		call cleanup 20
X	end
X
X	do i = 1 to 5	/* Try 5 times to get a login prompt */
X		'SEND "^M"'
X
X		if get_match(2, "gin:") = 2
X		then leave
X	end
X	if i > 5
X	then do
X		'MSG "No login prompt!"'
X		call cleanup 20
X	end
X
X	call cleanup -1
X
X	'ON "word:" rx onlogon pwd1'	/* Setup for 1st password */
X	'SEND "acs^M"'
Xend
Xelse do
X	parse upper arg cmd
X	if cmd = "PWD1"
X	then do
X		/*   First password prompt */
X		'SEND "your-pwd^M"'
X		'ON "word:" rx onlogon pwd2'	/* Setup for 2nd password */
X		exit 0
X	end
X	else if cmd = "PWD2"
X	then do
X		/*   Second password prompt */
X		'SEND "2nd-pwd^M"'
X		'ON "#?" rx onlogon termtp'	/* Setup for term type prompt */
X		exit 0
X	end
X	else if cmd = "TERMTP"
X	then do
X		/*   Send our terminal type.  While we're at it, cancel any
X		** outstanding ON commands. */
X		'ON ""'
X		'SEND "1^M"'
X		'MSG "Logon successful!"'
X		exit 0
X	end
X	else do
X		'MSG "Unknown command:' cmd || '"'
X		exit 20
X	end
Xend
X
Xexit 0
X
X
X/*   Dial the specified number(s).  If we get no connection we keep going till
X** we get a connection.  If we never get one then we return 0 for failure else
X** we return 1 for success.
X**/
Xdial: procedure expose port portname
Xnumargs = arg()
X
Xmsgdata = ""
Xdo i = 1 to numargs
X	'SEND "AT' || arg(i) || '^M"'
X	if get_match(40, "CONNECT", "BUSY", "NO") = 2
X	then leave
Xend
X
Xif i > numargs
Xthen return 0	/* Failure */
Xelse return 1	/* Success */
X
X/*   Get a match from the serial port via VT100.  1st arg is the maximum time
X** we'll wait; subsequent args are "acceptable" match strings.  We return the
X** arg() index of the matched string so if we ever time out we'll return 1
X** (since that's the index of the max time arg).
X**/
Xget_match: procedure expose port portname
Xnumargs = arg()
Xlongest = 0
Xdo i = 2 to numargs
X	longest = max(longest, length(arg(i)))
Xend
X
Xmsgdata = ""
Xmaxtime = arg(1)
Xdo forever
X	msg = receive(maxtime)
X	if msg == ""
X	then return 1
X
X	msgdata = msgdata || msg
X	do i = 2 to numargs
X		ndx = index(msgdata, arg(i))
X		if ndx > 0
X		then leave
X	end
X	if i <= numargs
X	then return i
X
X	if length(msgdata) > longest
X	then msgdata = right(msgdata, longest - 1)
Xend
X
X/*   Don't use the AREXX waitpkt() function as that locks us up until something
X** arrives at the port.  Instead, use the AmigaDOS WAIT command or, if you have
X** AREXX 1.10 or later, the AREXX delay() function.
X**/
Xreceive: procedure expose port portname
Xarg waittime
X
Xtime = 0
Xpacket = getpkt(portname)
Xdo while packet = '0000 0000'x
X	if waittime ~= 0
X	then do
X		if time > waittime
X		then return ""
X		address COMMAND "WAIT 1 SEC"	/* AmigaDOS */
X/*		call delay 50					/* AREXX 1.10 or above */ */
X		time = time + 1
X	end
X	else call waitpkt portname
X	packet = getpkt(portname)
Xend
Xmsg = getarg(packet)
Xcall reply packet, 0
X
Xretval = ""
Xdo while length(msg) > 0
X	parse var msg first '00'x msg
X	retval = retval || first
Xend
X
Xreturn retval
X
Xcleanup: procedure expose port portname
Xarg retc
X
X'FORWARD'
X
Xpacket = getpkt(portname)
Xdo while packet ~= '0000 0000'x
X	call reply packet, 0
X	packet = getpkt(portname)
Xend
X
Xcall closeport port
X
Xif retc = -1
Xthen return
X
Xexit retc
SHAR_EOF
echo "extracting RexxSamples/TestDisplay.vt100"
sed 's/^X//' << \SHAR_EOF > RexxSamples/TestDisplay.vt100
X/*   This routine shows the capabilities of the DISPLAY VT100 script command.
X** It will write data to the screen both one character at a time as well as
X** a string at a time and makes use of the defined VT100 escape sequences to
X** cause the cursor to move non-destructively.
X**
X** ACS 08/28/89
X**/
Xtrace Off
X
Xcr = "^M"
Xlf = "^J"
X
X"display" cr	/* Cursor back to first column */
X"display" lf	/* Cursor down one line        */
X
X"display ""Here is some data" || cr || lf || '"'
X
X"display ""Gonna delete this line."""
Xaddress COMMAND 'WAIT 3 SEC'
X'display "^[[M"'	/* Issue escape sequence to delete 1 line */
X
X"display" cr	/* Cursor back to first column */
X"display" lf	/* Cursor down one line        */
X
X/*   Write "Move" on one line, move the cursor up one line without changing
X** the column and write "up one line". */
X'display "Move^[[Aup one line"'
X
Xexit 0
SHAR_EOF
echo "extracting RexxSamples/TestErrs.vt100"
sed 's/^X//' << \SHAR_EOF > RexxSamples/TestErrs.vt100
X/* Show return codes generated as a result of various error conditions. */
Xtrace Off
X
X/* NONREXX command issued from an AREXX macro: CMDFAIL */
Xcmd = "WAIT ""JUNK"""
Xcmd
Xsay cmd "yielded RC =" rc
X
X/* Invalid BAUD rate: CMDFAIL */
Xcmd = "BAUD 123456789"
Xcmd
Xsay cmd "yielded RC =" rc
X
X/* INIT command issued from a script: CMDBS */
Xcmd = "SCREEN CUSTOM"
Xcmd
Xsay cmd "yielded RC =" rc
X
Xcmd = "EXTERNAL 1234567890 ""FOO"" ""BAR"""
Xcmd
Xsay cmd "yielded RC =" rc
X
X/* Unknown command will be given to AREXX.  Probably RC0 */
Xcmd = "FARKEL"
Xcmd
Xsay cmd "yielded RC =" rc
X
Xexit
SHAR_EOF
echo "extracting RexxSamples/TestFor.rexx"
sed 's/^X//' << \SHAR_EOF > RexxSamples/TestFor.rexx
X/* */
Xtrace R
X
Xportname = "REXX-VT100"
XPort = openport(portname)
X
Xif Port = '00000000'x
Xthen do
X	say "Couldn't open the port."
X	exit 20
Xend
X
Xaddress VT100-serial.device-00 "FORWARD" portname
X
Xtrace ?R
X/*  Need to getpkt(port), getarg(packet), reply(packet,0) */
Xpacket = getpkt(portname)
Xif packet ~= '00000000'x
Xthen do
X	message.6 = getarg(packet)
X	call reply packet, 0
Xend
X
Xcall closeport port
X
Xnop
Xexit
SHAR_EOF
echo "extracting RexxSamples/TestMsg.vt100"
sed 's/^X//' << \SHAR_EOF > RexxSamples/TestMsg.vt100
X/*   Have VT100 display messages for us */
Xtrace Off
X
Xparse source . . . cmdname .
X
X'MSG "From' cmdname || ': A little demo"'
X'MSG "Watch this line get overlaid by the next...^M"'
Xaddress COMMAND "WAIT 2 SECS"
X'MSG "This data has overlaid the previous message."'
X'MSG "Now we''ll leave a blank line..."'
X"MSG"
X'MSG "All done with' cmdname '"'
X
Xexit
SHAR_EOF
if `test ! -d Zmodem`
then
  mkdir Zmodem
  echo "mkdir Zmodem"
fi
echo "extracting Zmodem/README.1ST"
sed 's/^X//' << \SHAR_EOF > Zmodem/README.1ST
XNote that, while a makefile is provided for Un*x, I do not plan to support
Xthis Un*x version of the zmodem programs.  There are newer versions out
Xthere for sz and rz which should be readily available to you.  Note that I
X*am* working on updating the Amiga version of rz and sz; the results of
Xmy efforts will be made available later.
X
XAlso note that this is NOT an XPR -- 2.9 of VT100 does not support the XPR
Xprotocol specification.  2.10 will.
X
XThis version of sz has a bug in Ymodem-batch in that it does not update
Xthe "packet" count.  I know that this is inconvenient.  It will be repaired
Xin a subsequent release.
X---
XTony Sumrall
SHAR_EOF
echo "extracting Zmodem/Amiga.doc"
sed 's/^X//' << \SHAR_EOF > Zmodem/Amiga.doc
X
X			     Amiga zmodem
X			     ------------
X
X
X
X Zmodem is a file transfer protocol which will enable you to transmit files
Xbetween different computers. In fact the zmodem programs can transfer files
Xusing several popular protocols: Xmodem,Ymodem and Zmodem. To find out about
Xall the features of the zmodem programs, be sure to read rz.doc and sz.doc,
Xbecause I will only mention the features specific to the amiga version here.
X Please note that some features of UNIX zmodem are not supported. This is
Xmentioned in the zmodem '.doc' files.
X
X The reason I ported these programs to the Amiga, is that Zmodem file transfers
Xare very fast. When I was using Kermit the throughput I got was about 30
Xcharacters/second (1200 baud modem, going through packet switching network), now
Xwith Amiga zmodem I get at least 100 characters/second. Your mileage may
Xvary, but I'm pretty sure you'll get a significant speedup if you've been
Xusing either Kermit or Xmodem. Enjoy!
X
X		    CONTENTS
X
X	     I	 Installing zmodem
X	     II  Quick explanation on transferring files
X	     III Cooperating communications programs
X	     IV  Amiga specific features
X	     V	 Caveats,bugs and "features" (sigh!)
X
X
X I/ Installing zmodem
X
X To install UNIX zmodem rename the file 'makefile.unix' as 'makefile'. Then
Xtype 'make system'. Where system is the version of UNIX you are using, and is
Xone of the following:
X
X	sysv	    for SYSTEM 5 Unix
X	xenix	    for SYSTEM 3/5 Xenix
X	x386	    for 386 Xenix
X	bsd	    for Berkeley 4.x BSD and Ultrix
X
X To install Amiga zmodem just uudecode the files rz.uu and sz.uu, and you're
Xready to go.
X
X
X
X II/ Quick explanation on transferring files
X
X Sending files from UNIX to the AMIGA using zmodem:
X
X			    (log in on UNIX machine)
X			    (make sure preferences has the correct serial
X			     setup, or that you have the zmodem.init file
X			     correctly set up, or a cooperating
X			     comm. program running)
X
X    sz file1 file2 ...	    (type this on your UNIX system)
X			    (exit your communications program)
X    rz			    (type this on the Amiga)
X
X Sending files from the Amiga to UNIX using zmodem:
X
X			    (log in on UNIX machine)
X			    (if your comm. program doesn't cooperate
X			     exit it.)
X			    (make sure preferences has the correct serial
X			     setup, or that you have the zmodem.init file
X			     correctly set up, or a cooperating
X			     comm. program running)
X    sz file1 file2 ...	    (type this on the Amiga, Amiga sz automatically
X			     fires up UNIX rz)
X
X
X
X III/ Cooperating communications programs
X
X There are many different protocols for transferring files from one
Xcomputer to another. So many in fact, that almost no terminal program
Xcan support them all! So my idea was to provide a stand along program
Xthat would work with a terminal program. This would allow more efficient
Xuse of the computer's memory because the file transfer program would only
Xbe in memory when it was actually being used. Also authors of terminal
Xprograms could concentrate their efforts on other issues. The unique
Xfeatures of the Amiga make this idea possible.
X
X Zmodem can cooperate with other programs using the serial port. For this
Xto work, the other program has to do two things:
X
X    - Open the serial port in shared mode
X    - suspend it's read operations while zmodem is transferring files
X
X Actually it's also a good idea to suspend write operations also, because
Xaccidental keyboard input could interfere with the file transfer.
X
X An example of a cooperating communications program should be the new
Xversion of VT100 (r. 2.9).
X
X If your comm. program doesn't cooperate, you can still be use Amiga zmodem.
XJust exit your non-cooperating comm. program before running zmodem. If your
Xmodem drops the line when you exit (ie. when DTR goes down), just use the
Xbuilt in terminal mode in zmodem ('-T' switch).
X
X
X
X
X IV/ Amiga specific features
X
X  a/Initializing the serial port
X
X A new amiga specific switch '-I' has been added to allow initialization of
Xthe serial port parameters. If this switch is used, zmodem will look
Xfor a file called 'zmodem.init', which can either be in the current
Xdirectory, or the 'S:' directory.
X
X The file has the following format: 1 line composed of
X
X--------------------
Xbaudrate nps
X--------------------
X
X Where 'baudrate' is a number between 110 and 29,200 representing the
Xtransmission speed to be used.
X
X Where 'n' is the number of bits per character (7 or 8).
X
X Where 'p' is the parity to be used. The value of 'p' will be
Xone of: 'N','E','O' (standing for None,Even and Odd respectively)
X
X And where 's' is the number of stop bits (between 0 and 2).
X
X So if you want your file transfers to take place at 2400 bits per second,
X8 bits per character, no parity and 1 stop bit, you would place the following
Xline in your zmodem.init file:
X
X2400 8N1
X
X These parameters have to be on the first line of the file, no other lines
Xwill be examined. Also, if the zmodem.init file is not found, then the '-I'
Xswitch will be ignored.
X
X If no '-I' is given on the command line, then default parameters are
Xused. This means that if a cooperating program using the serial port is in
Xuse, then the default parameters are the ones set up by that program.
XOtherwise the default parameters are the ones you have specified using
Xpreferences. If you use preferences to specify the serial parameters you must
Xdisenable xON/xOFF handshaking for Xmodem and Ymodem transfers to work
Xcorrectly.
X
X If the terminal program you are using doesn't cooperate, then zmodem will
Xtell you that it can't open the serial port for transferring files, and
Xabort its execution. In that case stop the terminal program before
Xrunning zmodem.
X
X When a cooperating terminal program is running, it isn't possible to
Xuse the '-I' option. The parameters used will be automatically those
Xset up by the terminal program. If you try the '-I' option under these
Xconditions zmodem will print an error message and abort.
X
X  b/ Aborting file transfers
X
X Zmodem can be aborted at any time by clicking in the close box of the zmodem
Xwindow.
X
X  c/ Files to large for space remaining on disk
X
X Amiga zmodem will detect if the incoming file is too large to fit on the
Xcurrent disk. The files that won't fit are skipped. Zmodem only checks the
Xspace remaining at the start of each file, so you may still get full
Xdisks, if you use up some of the remaining free space while the file
Xtransfer is going on (hurrah for multi-tasking:-). This feature can be
Xdisabled with the '-n' option, which is useful if the destination device
Xhappens to be RAM:. That's because RAM:, is always full, so you couldn't
Xreceive any files on it at all.
X
X  d/ Ymodem file transfers
X
X With the UNIX version of zmodem, Ymodem transfers were requested by calling
Xzmodem using the names sb or rb (send batch or receive batch). But on
Xthe amiga this isn't practical, since this would require keeping several
Xcopies of zmodem, with only the name being different. To remedy this
Xsituation, the '-B' switch was added, this lets you use the Ymodem protocol
Xand have only one copy of zmodem around.
X
Xexamples: sz -B f1 f2 f3
X	  rz -B
X
X e/ Xmodem file transfers
X
X To send with the xmodem protocol use: 'sz -X file', and for receiving
X'rz file'. If you give a file name to rz, the file transfer will
Xbe done using Xmodem protocol, even if on the sending end you specified
Xa zmodem transfer, so watch out!
X
X
X f/ Maintaining file protection bits
X
X When transferring between UNIX and the Amiga, the file protection
Xbits are also transfered. When sending from the amiga to UNIX the bits 'rwe'
Xare translated into the 'rwe' for user bits on UNIX. UNIX doesn't have a
X'd' bit, but if you don't have write permission rm will ask for permission
Xto over-ride protection (ie. you can't delete it accidentally). So the UNIX
X 'w' bit is translated into the Amiga 'wd' bits. That is to say if the UNIX
Xfile doesn't have write permission the Amiga file won't have write or delete
Xpermission. The transmission of the file protection bits can be overriden,
Xwith the '-m' option. In this case the transmitted files will have the
Xdefault file protection bits.
X
X
X g/ Automatic ASCII transfer mode
X
X To be able to transfer raw binary files zmodem needs 8 bits per
Xcharacter. If the serial port parameters aren't set up this way zmodem
Xautomatically uses it's ASCII transfer mode. The transfer mode being used
Xby zmodem is printed when the file transfer starts. You should transfer
Xfiles using binary mode for files you want transferred without any changes
Xmade to them. The ASCII mode will try to adapt the incoming file to
Xamiga text file conventions ( all CR LF sequences replaced by LF ).
X
X h/ Maintaining file dates
X
X One of the features of Zmodem, is that it keeps the same file-modification
Xdate on the source and destination files. But due to the format used to
Xtransmit the date, zmodem has to know what time zone you are in, relative
Xto the GM (Greenwich Meridian). I know this is strange, but that's the
Xway zmodem works. This time zone difference can also change during the year,
Xbecause GMT doesn't have any daylight savings time! Anyway, if you want
Xthe file dates maintained you must add an extra number (this is an option)
Xinto your zmodem.init file which specifies the difference between your local
Xtime zone and GMT.
X
X In this case the format of the zmodem.init file becomes:
X
X---------------------
Xbaudrate nps gmt_diff
X---------------------
X
Xmy zmodem.init file is
X
X  1200 8N1 +2  (this is for europe)
X
XIf you are in the EST time zone, you will probably set gmt_diff to -4.
XIf you don't care about the file-modification date on the transfered file,
Xthe easiest thing to do is just leave gmt_diff out. Then the transfered
Xfile's date will be set by zmodem to the current date.
X
X
X i/ Terminal mode
X
X A very primitive terminal mode has been provided, to enable those with "smart"
Xmodems (ie. ones that drop phone connection when DTR goes down) to use zmodem.
XUse the terminal mode to log in, and then click on the close box of the zmodem
Xwindow, the file transfer requested will follow automatically. Once the file
Xtransfer is completed, zmodem will re-enter the terminal mode, permitting
Xyou to log out cleanly.
X
X
X
X V/ Caveats,bugs and "features" (sigh!)
X
X If Ymodem protocol is used by the sending program, and the receiving
Xprogram is using Xmodem, the first file will be transferred, but the
Xsending Ymodem program will not exit correctly.
X
Xexample: sz foo        <-- starts out with Zmodem, steps down to Ymodem
X	 rz foo        <-- uses Xmodem because file name is given
X
X the correct sequences would be:
X
X  sz foo bar toto	<-- Zmodem transfer
X  rz
X
X or
X  sz -B foo bar toto	<-- Batch Ymodem transfer
X  rz -B
Xor
X  sz -X foo	   <-- Xmodem transfer
X  rz foo
X
X
X When using the '-f' option of sz (send whole pathname) the directories in
Xthe path will not be created. If one of the directories in the pathname
Xdoesn't exist, the file will not be sent. A newer version of UNIX rz will
Xhandle the creation of the directories. Amiga rz still doesn't though.
X
X If you are using parity, amiga zmodem won't accept any characters without
Xthe parity bit correctly set. Many UNIX hosts won't set the parity bit
Xcorrectly on output even if they are set up to check parity on input.
XI recommend  avoiding using parity with zmodem whenever possible.
XIt limits you to transferring just text files anyway.
X
X Sz's -n (send file iff newer) and -N (send file if newer or longer) options
Xare not implemented in Unix or Amiga zmodem.
X
X Sz's -r (resume interupted file transfer) option isn't implemented in this
Xversion of UNIX zmodem, or Amiga zmodem.
X
X Sz's -y (overwrite existing files with same name) option is pretty useles
Xwith the UNIX and Amiga versions of zmodem, because this is already the
Xdefault behavior.
X
X I haven't been able to test Amiga zmodem at speeds other than 1200 bps.
XI hope that zmodem will be reasonably efficient and bug free using
Xdifferent speeds. If rz can't keep up at higher speeds, it may be
Xnecessary to increase the size of the serial buffer using preferences.
XIf you increase the buffer size, don't use the '-I' option. With the
X'-I' option the buffer size is always the same no matter what you choose
Xin preferences (1024 bytes).
X
X---------------------------------------------------------------------------
X
X Many thanks to Chuck Forsberg who wrote the UNIX version of zmodem, and on
Xwhich Amiga zmodem is based. Thanks also go to all the good people who
Xhave helped to make the amiga the useful and successful machine it is
Xtoday. The people from Los Gatos, and CATS. And also those who have
Xprovided the public domain tools that have made this program possible,
XMatt Dillon for DME and the shell, Steve Drew for his work on the shell,
XDave Wecker and Tony Sumrall for the vt100 terminal program, Peter Da Silva
Xfor Browser, and all the other PD authors who's programs I've used. And of
Xcourse Fred Fish, for making all the PD software available.
X
X Please send bug reports and/or bug corrections to me:
X
X
X  Frank Anthes-Harper
X  72, Le Puech des Bruyeres
X  Av. de Mr. Teste
X  34070 Montpellier
X  France
X
XUsenet:  ...!ucbvax!decvax!uunet!mcvax!inria!geocub!anthes
SHAR_EOF
echo "extracting Zmodem/sz.doc"
sed 's/^X//' << \SHAR_EOF > Zmodem/sz.doc
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
XNAME
X     sx, sb, sz - XMODEM, YMODEM, ZMODEM file send
X
XSYNOPSIS
X     sz [-+1abdefkLlNnopqTtuvyY] file ...
X     sb [-1adfkqtuv] file ...
X     sx [-1akqtuv] file
X     sz [-1oqtv] -c COMMAND
X     sz [-1oqtv] -i COMMAND
X
XDESCRIPTION
X     Sz uses the ZMODEM, YMODEM or XMODEM error correcting proto-
X     col to send one or more files over a serial port to a
X     variety of programs running under PC-DOS, CP/M, Unix, VMS,
X     and other operating systems.
X
X
X     The first form of sz sends one or more files with ZMODEM
X     protocol.
X
X     ZMODEM greatly simplifies file transfers compared to XMODEM.
X     In addition to a friendly user interface, ZMODEM provides
X     Personal Computer and other users an efficient, accurate,
X     and robust file transfer method.
X
X     ZMODEM provides complete END-TO-END data integrity between
X     application programs.  ZMODEM's 32 bit CRC catches errors
X     that sneak into even the most advanced networks.
X
X     Advanced file management features include AutoDownload
X     (Automatic file Download initiated without user interven-
X     tion), Crash Recovery, selective file transfers, and preser-
X     vation of exact file date and length.
X
X>Not implemented in amiga version
X>     Output from another program may be piped to sz for transmis-
X>     sion by denoting standard input with "-":
X>			     ps -ef | sz -
X>     The program output is transmitted with the filename sPID.sz
X>     where PID is the process ID of the sz program.  If the
X>     environment variable ONAME is set, that is used instead.	In
X>     this case, the Unix command:
X>		       ONAME=con ps -ef|sz -ay -
X>     will send a "file" to the PC-DOS console display.  The -y
X>     option instructs the receiver to open the file for writing
X>     unconditionally.	The -a option causes the receiver to con-
X>     vert Unix newlines to PC-DOS carriage returns and linefeeds.
X>
X
X     The second form is invoked as sb to batch send one or more
X     files with ZMODEM or YMODEM protocol.  The initial ZMODEM
X     initialization is not sent.  When requested by the receiver,
X     sb supports YMODEM-g with "cbreak" tty mode, XON/XOFF flow
X
X
X
XPrinted 10/25/87	      OMEN				1
X
X
X
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
X     control, and interrupt character set to CAN (^X).  YMODEM-g
X     (Professional-YAM g option) increases throughput over error
X     free channels (direct connection, X.PC, etc.) by not ack-
X     nowledging each transmitted sector.
X
X     On Unix systems, additional information about the file is
X     transmitted.  If the receiving program uses this informa-
X     tion, the transmitted file length controls the exact number
X     of bytes written to the output dataset, and the modify time
X     and file mode are set accordingly.
X
X
X     The third form of sz is invoked as sx to send a single file
X     with XMODEM or XMODEM-1k protocol (sometimes incorrectly
X     called "ymodem").  The user must supply the file name to
X     both sending and receiving programs.
X
X>Not implemented in amiga version
X>     Iff sz is invoked with $SHELL set and iff that variable con-
X>     tains the string rsh or rksh (restricted shell), sz operates
X>     in restricted mode.  Restricted mode restricts pathnames to
X>     the current directory and PUBDIR (usually
X>     /usr/spool/uucppublic) and/or subdirectories thereof.
X
X
X     The fourth form sends a single COMMAND to a ZMODEM receiver
X     for execution.  Sz exits with the COMMAND return value.  If
X     COMMAND includes spaces or characters special to the shell,
X     it must be quoted.
X
X
X     The fifth form sends a single COMMAND to a ZMODEM receiver
X     for execution.  Sz exits as soon as the receiver has
X     correctly received the command, before it is executed.
X
X
X     If sz is invoked with stdout and stderr to different
X     datasets, Verbose is set to 2, causing frame by frame pro-
X     gress reports to stderr.  This may be disabled with the q
X     option.
X
X     The meanings of the available options are:
X
X     +	  Instruct the receiver to append transmitted data to an
X	  existing file (ZMODEM only).
X
XNot implemented in Amiga version
X>     1    Use file descriptor 1 for ioctls and reads.	By
X>	   default, file descriptor 0 is used.	This option allows
X>	   sz to be used with the Professional-YAM $ command.
X
X     a	  Convert NL characters in the transmitted file to CR/LF.
X	  This is done by the sender for XMODEM and YMODEM, by
X	  the receiver for ZMODEM.
X     b	  (ZMODEM) Binary override: transfer file without any
X	  translation.
X
X
X
XPrinted 10/25/87	      OMEN				2
X
X
X
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
X     c COMMAND
X	  Send COMMAND to the receiver for execution, return with
X	  COMMAND's exit status.
X     d	  Change all instances of "." to "/" in the transmitted
X	  pathname.  Thus, C.omenB0000 (which is unacceptable to
X	  MSDOS or CP/M) is transmitted as C/omenB0000.  If the
X	  resultant filename has more than 8 characters in the
X	  stem, a "." is inserted to allow a total of eleven.
X     e	  Escape all control characters; normally XON, XOFF, DLE,
X	  CR-@-CR, and Ctrl-X are escaped.
X     f	  Send Full pathname.  Normally directory prefixes are
X	  stripped from the transmitted filename.
X     i COMMAND
X	  Send COMMAND to the receiver for execution, return
X	  Immediately upon the receiving program's successful
X	  recption of the command.
X     k	  (XMODEM/YMODEM) Send files using 1024 byte blocks
X	  rather than the default 128 byte blocks.  1024 byte
X	  packets speed file transfers at high bit rates.  (ZMO-
X	  DEM streams the data for the best possible throughput.)
X     L N  Use ZMODEM sub-packets of length N.  A larger N (32 <=
X	  N <= 1024) gives slightly higher throughput, a smaller
X	  N speeds error recovery.  The default is 128 below 300
X	  baud, 256 above 300 baud, or 1024 above 2400 baud.
X     l N  Wait for the receiver to acknowledge correct data every
X	  N (32 <= N <= 1024) characters.  This may be used to
X	  avoid network overrun when XOFF flow control is lack-
X	  ing.
X     n	  (ZMODEM) Send each file if destination file does not
X	  exist.  Overwrite destination file if source file is
X	  newer than the destination file.
X     N	  (ZMODEM) Send each file if destination file does not
X	  exist.  Overwrite destination file if source file is
X	  newer or longer than the destination file.
X     o	  (ZMODEM) Disable automatic selection of 32 bit CRC.
X     p	  (ZMODEM) Protect existing destination files by skipping
X	  transfer if the destination file exists.
X     q	  Quiet suppresses verbosity.
X     r	  (ZMODEM) Resume interrupted file transfer.  If the
X	  source file is longer than the destination file, the
X	  transfer commences at the offset in the source file
X	  that equals the length of the destination file.
X     t tim
X	  Change timeout to tim tenths of seconds.
X     u	  Unlink the file after successful transmission.
X     v	  Verbose causes a list of file names to be appended to
X	  /tmp/szlog .	More v's generate more output.
X     y	  Instruct a ZMODEM receiving program to overwrite any
X	  existing file with the same name.
X     Y	  Instruct a ZMODEM receiving program to overwrite any
X	  existing file with the same name, and to skip any
X	  source files that do have a file with the same pathname
X
X
X
XPrinted 10/25/87	      OMEN				3
X
X
X
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
X	  on the destination system.
X
XEXAMPLES
X     ZMODEM File Transfer
X     $ sz -a *.c
X     This single command transfers all .c files in the current
X     Unix directory with conversion (-a) to end of line conven-
X     tions appropriate to the receiving environment.  With ZMODEM
X     AutoDownload enabled, Professional-YAM  and ZCOMM will
X     automatically recieve the files after performing a security
X     check.
X
X     $ sz -Yan *.c *.h
X     Send only the .c and .h files that exist on both systems,
X     and are newer on the sending system than the corresponding
X     version on the receiving system, converting Unix to DOS text
X     format.
X
X     ZMODEM Command Download
X      cpszall:all
X	 sz -c "c:;cd /yam/dist"
X	 sz -ya $(YD)/*.me
X	 sz -yqb y*.exe
X	 sz -c "cd /yam"
X	 sz -i "!insms"
X     This Makefile fragment uses sz to issue commands to
X     Professional-YAM to change current disk and directory.
X     Next, sz transfers the .me files from the $YD directory,
X     commanding the receiver to overwrite the old files and to
X     convert from Unix end of line conventions to PC-DOS conven-
X     tions.  The third line transfers some .exe files.	The
X     fourth and fifth lines command Pro-YAM to change directory
X     and execute a PC-DOS batch file insms . Since the batch file
X     takes considerable time, the -i form is used to allow sz to
X     exit immediately.
X
X     XMODEM File Transfer (To Crosstalk)
X     $ sx -a foo.c
X     ESC
X     rx foo.c
X     The above three commands transfer a single file from Unix to
X     a PC and Crosstalk with sz translating Unix newlines to DOS
X     CR/LF.  This combination is much slower than ZMODEM.
X
XSEE ALSO
X     rz(omen), ZMODEM.DOC, YMODEM.DOC, Professional-YAM,
X     IMP(CP/M), sq(omen), todos(omen), tocpm(omen), tomac(omen),
X     yam(omen)
X
X     Compile time options required for various operating systems
X     are described in the source file.
X
X
X
X
XPrinted 10/25/87	      OMEN				4
X
X
X
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
XVMS VERSION
X     The VMS version does not transmit the file date.  The VMS
X     version calculates the file length by reading the file and
X     counting the bytes.
X
X     The VMS version does not support YMODEM-g or ZMODEM.
X
X     When VMS is lightly loaded, the response time may be too
X     quick for MODEM7 unless the MODEM7 q modifier is used.
X
X     The VMS C standard i/o package and RMS sometimes interact to
X     modify file contents unexpectedly.
X
XFILES
X     32 bit CRC code courtesy Gary S. Brown.
X
X     sz.c, rbsb.c, zm.c, zmodem.h source files
X
X     /tmp/szlog stores debugging output (sz -vv)
X
X>Not implemented in amiga version
X>TESTING FEATURE
X>     The command "sz -T file" exercises the Attn sequence error
X>     recovery by commanding errors with unterminated packets.
X>     The receiving program should complain five times about
X>     binary data packets being too long.  Each time sz is inter-
X>     rupted, it should send a ZDATA header followed by another
X>     defective packet.  If the receiver does not detect five long
X>     data packets, the Attn sequence is not interrupting the
X>     sender, and the Myattn string in sz.c must be modified.
X>
X>     After 5 packets, sz stops the "transfer" and prints the
X>     total number of characters "sent" (Tcount).  The difference
X>     between Tcount and 5120 represents the number of characters
X>     stored in various buffers when the Attn sequence is gen-
X>     erated.
X>
XBUGS
X     Calling sz from most versions of cu(1) doesn't work because
X     cu's receive process fights sz for characters from the
X     modem.
X
X     Many programs claiming to support YMODEM only support XMODEM
X     with 1k blocks, and they often don't get that quite right.
X
X     XMODEM transfers add up to 127 garbage bytes per file (1023
X     bytes with XMODEM-k).
X
X     YMODEM programs use the file length transmitted at the
X     beginning of the transfer to prune the file to the correct
X     length; this may cause problems with source files that grow
X     during the course of the transfer.  This problem does not
X     pertain to ZMODEM transfers, which preserve the exact file
X
X
X
XPrinted 10/25/87	      OMEN				5
X
X
X
X
X
X
XSZ(1)               UNIX Programmer's Manual                SZ(1)
X
X
X
X     length unconditionally.
X
X     Most ZMODEM options are merely passed to the receiving pro-
X     gram; some do not implement all these options.
X
X     Circular buffering and a ZMODEM sliding window should be
X     used when input is from pipes instead of acknowledging
X     frames each 1024 bytes.  If no files can be opened, sz sends
X     a ZMODEM command to echo a suitable complaint; perhaps it
X     should check for the presence of at least one accessible
X     file before getting hot and bothered.  The test mode leaves
X     a zero length file on the receiving system.
X
X     Some high speed modems have a firmware bug that drops char-
X     acters when the direction of high speed transmissson is
X     reversed.	The environment variable ZNULLS may be used to
X     specify the number of nulls to send before a ZDATA frame.
X     Values of 101 for a 4.77 mHz PC and 124 for an AT are typi-
X     cal.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XPrinted 10/25/87	      OMEN				6
X
X
X
SHAR_EOF
echo "extracting Zmodem/rz.doc"
sed 's/^X//' << \SHAR_EOF > Zmodem/rz.doc
X
X
X
XRZ(1)               UNIX Programmer's Manual                RZ(1)
X
X
X
XNAME
X     rx, rb, rz - XMODEM, YMODEM, ZMODEM (Batch) file receive
X
XSYNOPSIS
X     rz [- +1abepqtuv]
X     rb [- +1abqtuv]
X     rz [- 1abceqtuv] file
X     gz file ...
X>Not implemented in amiga version
X>     [-][v]rzCOMMAND
X
XDESCRIPTION
X     This program uses error correcting protocol to receive files
X     over a serial port from a variety of programs running under
X     AmigaDos,PC-DOS, CP/M, Unix, and other operating systems.
X
X     The first form of rz (Receive ZMODEM) receives files with
X     the ZMODEM batch protocol.  If the sending program does not
X     support ZMODEM, rz steps down to YMODEM protocol after 50
X     seconds.  This delay can be eliminated by invoking the pro-
X     gram as rb .
X
X     When receiving with XMODEM or YMODEM, Rz accepts either
X     standard 128 byte sectors or 1024 byte sectors (YAM -k
X     option).  The user should determine when the longer block
X     length actually improves throughput without causing prob-
X     lems.
X
X     If extended file information (file length, etc.) is
X     received, the file length controls the number of bytes writ-
X     ten to the output dataset (YMODEM only), and the modify time
X     and file mode (iff non zero) are set accordingly.
X
X     If no extended file information is received, slashes in the
X     pathname are changed to underscore, and any trailing period
X     in the pathname is eliminated.  This conversion is useful
X     for files received from CP/M systems.  With YMODEM, each
X     file name is converted to lower case unless it contains one
X     or more lower case letters.
X
X
X     The second form of rz receives a single file with XMODEM
X     protocol.	The user must supply the file name to both send-
X     ing and receiving programs.
X
X
X     Gz is a shell script which calls sz to command Pro-YAM or
X     ZCOMM to transmit the specified files.  Pathnames used with
X     gz must be escaped if they have special significance to the
X     Unix shell.
X     EXAMPLE: gz "-a C:*.c D:*.h"
X
X>Not implemented in amiga version
X>     The third form of rz is invoked as rzCOMMAND (with an
X
X
X
XPrinted 10/25/87	      OMEN				1
X
X
X
X
X
X
XRZ(1)               UNIX Programmer's Manual                RZ(1)
X
X
X
X>     optional leading - as generated by login(1)).  For each
X>     received file, rz will pipe the file to ``COMMAND filename''
X>     where filename is the name of the transmitted file with the
X>     file contents as standard input.
X>
X>     Each file transfer is acknowledged when COMMAND exits with 0
X>     status.  A non zero exit status terminates transfers.
X>
X>     A typical use for this form is rzrmail which calls rmail(1)
X>     to post mail to the user specified by the transmitted file
X>     name.  For example, sending the file "caf" from a PC-DOS
X>     system to rzrmail on a Unix system would result in the con-
X>     tents of the DOS file "caf" being mailed to user "caf".
X>
X>     On some Unix systems, the login directory must contain a
X>     link to COMMAND as login sets SHELL=rsh which disallows
X>     absolute pathnames.  If invoked with a leading ``v'', rz
X>     will report progress to /tmp/rzlog.  The following entry
X>     works for Unix 3.0:
X>		 rzrmail::5:1::/bin:/usr/local/rzrmail
X>     If the SHELL environment variable includes rsh or rksh (res-
X>     tricted shell), rz will not accept absolute pathnames or
X>     references to a parent directory, will not modify an exist-
X>     ing file, and removes any files received in error.
X>
X>     If rz is invoked with stdout and stderr to different
X>     datasets, Verbose is set to 2, causing frame by frame pro-
X>     gress reports to stderr.	This may be disabled with the q
X>     option.
X>
X>
X      The meanings of the available options are:
X
X>Not implemented in amiga version
X>
X>     1    Use file descriptor 1 for ioctls and reads (Unix only).
X>	   By default, file descriptor 0 is used for ioctls and
X>	   reads.  This option allows rz to be used with the
X>	   Professional-YAM $ command and some versions of ncu(1).
X     a	  Convert files to Unix conventions by stripping carriage
X	  returns and all characters beginning with the first
X	  Control Z (CP/M end of file).
X     b	  Binary (tell it like it is) file transfer override.
X     c	  Request 16 bit CRC.  XMODEM file transfers default to 8
X	  bit checksum.  YMODEM and ZMODEM normally use 16 bit
X	  CRC.
X     D	  Output file data to /dev/null; for testing.
X     e	  Force sender to escape all control characters; normally
X	  XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.
X     p	  (ZMODEM) Protect: skip file if destination file exists.
X     q	  Quiet suppresses verbosity.
X     t tim
X	  Change timeout to tim tenths of seconds.
X     v	  Verbose causes a list of file names to be appended to
X
X
X
XPrinted 10/25/87	      OMEN				2
X
X
X
X
X
X
XRZ(1)               UNIX Programmer's Manual                RZ(1)
X
X
X
X	  /tmp/rzlog .	More v's generate more output.
X
XEXAMPLES
X     (Pro-YAM command)
X     <ALT-2>
X     Pro-YAM Command: sz *.h *.c
X     (This automatically invokes rz on the connected system.)
X
XSEE ALSO
X     ZMODEM.DOC, YMODEM.DOC, IMP(CP/M), Professional-YAM,
X     sz(omen), usq(omen), undos(omen)
X
X     Compile time options required for various operating systems
X     are described in the source file.
X
XNOTES
X     The Unix "ulimit" parameter must be set high enough to per-
X     mit large file transfers.
X
X     The TTY input buffering on some systems may not allow long
X     blocks or streaming input at high speed.  You should suspect
X     this problem when you can't send data to the Unix system at
X     high speeds using ZMODEM when YMODEM with 128 byte blocks
X     works properly.  If the system's tty line handling is really
X     broken, the serial port or the entire system may not survive
X     the onslaught of long bursts of high speed data.
X
X     The DSZ or Pro-YAM zmodem l numeric parameter may be set to
X     a value between 64 and 1024 to limit the burst length ("zmo-
X     dem pl128").
X
X     32 bit CRC code courtesy Gary S. Brown.
X
XBUGS
X     Calling rz from most versions of cu(1) doesn't work because
X     cu's receive process fights rz for characters from the
X     modem.
X
X     Pathnames are restricted to 127 characters.  In XMODEM sin-
X     gle file mode, the pathname given on the command line is
X     still processed as described above.  The ASCII option's
X     CR/LF to NL translation merely deletes CR's; undos(omen)
X     performs a more intelligent translation.
X
XVMS VERSION
X     Some of the #includes with file names enclosed with angle
X     brackets <> may need to have the angle brackets changed to
X     "", or vice versa.
X
X     The VMS version does not set binary mode according to the
X     incoming file type.  Non binary file processing consists of
X     stripping all characters beginning with CPMEOF (^Z).
X
X
X
XPrinted 10/25/87	      OMEN				3
X
X
X
X
X
X
XRZ(1)               UNIX Programmer's Manual                RZ(1)
X
X
X
X     The VMS version does not set the file time.
X
X     At high speeds, VMS sometimes loses incoming characters,
X     resulting in retries and degradation of throughput.
X
X     The mysterious VMS C Standard I/O Package and RMS may
X     interact to modify file contents unexpectedly.
X
X     The VMS version does not support invocation as rzCOMMAND .
X     ZMODEM has not yet been implemented on the VMS version.
X
XZMODEM CAPABILITIES
X     Rz supports incoming ZMODEM binary (-b), ASCII (-a), protect
X     (-p), and append (-+) requests, and ZMODEM command execu-
X     tion.
X
XFILES
X     rz.c, rbsb.c, zm.c, zmodem.h source files.
X
X     /tmp/rzlog stores debugging output generated with -vv
X     option.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
XPrinted 10/25/87	      OMEN				4
X
X
X
SHAR_EOF
echo "extracting Zmodem/makefile.ami"
sed 's/^X//' << \SHAR_EOF > Zmodem/makefile.ami
X
XCC     = cc
XCFLAGS = +L -DAMIGA
X
Xzmodem: sz rz
X
Xsz: sz.o SerIO.o term.o
X	ln sz.o SerIO.o term.o -lc32
X
Xrz: rz.o SerIO.o term.o
X	ln rz.o SerIO.o term.o -lc32
X
Xsz.o: sz.c rbsb.c zm.c zmodem.h
X	$(CC) $(CFLAGS) sz.c
X
Xrz.o: rz.c rbsb.c zm.c zmodem.h
X	$(CC) $(CFLAGS) rz.c
X
XSerIO.o: SerIO.c
X	$(CC) $(CFLAGS) SerIO.c
X
Xterm.o: term.c
X	$(CC) $(CFLAGS) term.c
X
SHAR_EOF
echo "extracting Zmodem/makefile.uni"
sed 's/^X//' << \SHAR_EOF > Zmodem/makefile.uni
X# Makefile for Unix/Xenix rz and sz programs
X# the makefile is not too well tested yet
X
Xnothing:
X	@echo
X	@echo "Please study the #ifdef's in rbsb.c, rz.c and sz.c,"
X	@echo "then type 'make system' where system is one of:"
X	@echo "	sysv	SYSTEM 5 Unix"
X	@echo "	xenix	SYSTEM 3/5 Xenix"
X	@echo "	x386	386 Xenix"
X	@echo "	bsd	Berkeley 4.x BSD, and Ultrix"
X	@echo
X
Xusenet:
X	shar -f /tmp/rzsz README Makefile zmodem.h zm.c sz.c rz.c rbsb.c \
X	  minirb.c *.1 gz ptest.sh zupl.t
X
Xshar:
X	 shar -f /tmp/rzsz1et2 -m 1000000 README Makefile zmodem.h zm.c \
X	    sz.c rz.c rbsb.c minirb.c *.1 gz ptest.sh zupl.t
X
Xarc:
X	rm -f /tmp/rzsz.arc
X	arc a /tmp/rzsz README Makefile zmodem.h zm.c sz.c rz.c \
X	    rbsb.c *.1 gz ptest.sh zupl.t minirb.c
X	chmod og-w /tmp/rzsz.arc
X	ln /tmp/rzsz.arc /usr/spool/uucppublic
X	mv /tmp/rzsz.arc /t/yam
X
Xzoo:
X	rm -f /tmp/rzsz.zoo
X	zoo a /tmp/rzsz README Makefile zmodem.h zm.c sz.c rz.c \
X	    rbsb.c *.1 gz ptest.sh zupl.t minirb.c
X	chmod og-w /tmp/rzsz.zoo
X	ln /tmp/rzsz.zoo /usr/spool/uucppublic
X	mv /tmp/rzsz.zoo /t/yam
X
X.PRECIOUS:rz sz
X
Xxenix:
X	cc -M0 -Ox -K -i -DNFGVMIN -DREADCHECK sz.c -lx -o sz
X	size sz
X	-ln sz sb
X	-ln sz sx
X	cc -M0 -Ox -K -i rz.c -o rz
X	size rz
X	-ln rz rb
X	-ln rz rx
X
Xx386:
X	cc -Ox rz.c -o rz
X	size rz
X	-ln rz rb
X	-ln rz rx
X	cc -Ox -DNFGVMIN -DREADCHECK sz.c -lx -o sz
X	size sz
X	-ln sz sb
X	-ln sz sx
X
Xsysv:
X	cc -O rz.c -o rz
X	size rz
X	-ln rz rb
X	-ln rz rx
X	cc -DSVR2 -O -DNFGVMIN sz.c -o sz
X	size sz
X	-ln sz sb
X	-ln sz sx
X
Xbsd:
X	cc -DV7 -O rz.c -o rz
X	size rz
X	-ln rz rb
X	-ln rz rx
X	cc -DV7 -O -DNFGVMIN sz.c -o sz
X	size sz
X	-ln sz sb
X	-ln sz sx
X
Xsz: nothing
Xsb: nothing
Xrz: nothing
Xrb: nothing
SHAR_EOF
echo "extracting Zmodem/zmodem.init"
sed 's/^X//' << \SHAR_EOF > Zmodem/zmodem.init
X2400 8N1 -7
SHAR_EOF
echo "extracting Zmodem/zmodem.h"
sed 's/^X//' << \SHAR_EOF > Zmodem/zmodem.h
X/*
X *   Z M O D E M . H     Manifest constants for ZMODEM
X *    application to application file transfer protocol
X *    05-23-87  Chuck Forsberg Omen Technology Inc
X */
X#define ZPAD '*'        /* 052 Padding character begins frames */
X#define ZDLE 030        /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
X#define ZDLEE (ZDLE^0100)       /* Escaped ZDLE as transmitted */
X#define ZBIN 'A'        /* Binary frame indicator */
X#define ZHEX 'B'        /* HEX frame indicator */
X#define ZBIN32 'C'      /* Binary frame with 32 bit FCS */
X
X/* Frame types (see array "frametypes" in zm.c) */
X#define ZRQINIT 0       /* Request receive init */
X#define ZRINIT  1       /* Receive init */
X#define ZSINIT 2        /* Send init sequence (optional) */
X#define ZACK 3          /* ACK to above */
X#define ZFILE 4         /* File name from sender */
X#define ZSKIP 5         /* To sender: skip this file */
X#define ZNAK 6          /* Last packet was garbled */
X#define ZABORT 7        /* Abort batch transfers */
X#define ZFIN 8          /* Finish session */
X#define ZRPOS 9         /* Resume data trans at this position */
X#define ZDATA 10        /* Data packet(s) follow */
X#define ZEOF 11         /* End of file */
X#define ZFERR 12        /* Fatal Read or Write error Detected */
X#define ZCRC 13         /* Request for file CRC and response */
X#define ZCHALLENGE 14   /* Receiver's Challenge */
X#define ZCOMPL 15       /* Request is complete */
X#define ZCAN 16         /* Other end canned session with CAN*5 */
X#define ZFREECNT 17     /* Request for free bytes on filesystem */
X#define ZCOMMAND 18     /* Command from sending program */
X#define ZSTDERR 19      /* Output to standard error, data follows */
X
X/* ZDLE sequences */
X#define ZCRCE 'h'       /* CRC next, frame ends, header packet follows */
X#define ZCRCG 'i'       /* CRC next, frame continues nonstop */
X#define ZCRCQ 'j'       /* CRC next, frame continues, ZACK expected */
X#define ZCRCW 'k'       /* CRC next, ZACK expected, end of frame */
X#define ZRUB0 'l'       /* Translate to rubout 0177 */
X#define ZRUB1 'm'       /* Translate to rubout 0377 */
X
X/* zdlread return values (internal) */
X/* -1 is general error, -2 is timeout */
X#define GOTOR 0400
X#define GOTCRCE (ZCRCE|GOTOR)   /* ZDLE-ZCRCE received */
X#define GOTCRCG (ZCRCG|GOTOR)   /* ZDLE-ZCRCG received */
X#define GOTCRCQ (ZCRCQ|GOTOR)   /* ZDLE-ZCRCQ received */
X#define GOTCRCW (ZCRCW|GOTOR)   /* ZDLE-ZCRCW received */
X#define GOTCAN  (GOTOR|030)     /* CAN*5 seen */
X
X/* Byte positions within header array */
X#define ZF0     3       /* First flags byte */
X#define ZF1     2
X#define ZF2     1
X#define ZF3     0
X#define ZP0     0       /* Low order 8 bits of position */
X#define ZP1     1
X#define ZP2     2
X#define ZP3     3       /* High order 8 bits of file position */
X
X/* Bit Masks for ZRINIT flags byte ZF0 */
X#define CANFDX  01      /* Rx can send and receive true FDX */
X#define CANOVIO 02      /* Rx can receive data during disk I/O */
X#define CANBRK  04      /* Rx can send a break signal */
X#define CANCRY  010     /* Receiver can decrypt */
X#define CANLZW  020     /* Receiver can uncompress */
X#define CANFC32 040     /* Receiver can use 32 bit Frame Check */
X#define ESCCTL 0100     /* Receiver expects ctl chars to be escaped */
X#define ESC8   0200     /* Receiver expects 8th bit to be escaped */
X
X/* Parameters for ZSINIT frame */
X#define ZATTNLEN 32     /* Max length of attention string */
X/* Bit Masks for ZSINIT flags byte ZF0 */
X#define TESCCTL 0100    /* Transmitter expects ctl chars to be escaped */
X#define TESC8   0200    /* Transmitter expects 8th bit to be escaped */
X
X/* Parameters for ZFILE frame */
X/* Conversion options one of these in ZF0 */
X#define ZCBIN   1       /* Binary transfer - inhibit conversion */
X#define ZCNL    2       /* Convert NL to local end of line convention */
X#define ZCRESUM 3       /* Resume interrupted file transfer */
X/* Management include options, one of these ored in ZF1 */
X#define ZMSKNOLOC       0200    /* Skip file if not present at rx */
X/* Management options, one of these ored in ZF1 */
X#define ZMMASK  037     /* Mask for the choices below */
X#define ZMNEWL  1       /* Transfer if source newer or longer */
X#define ZMCRC   2       /* Transfer if different file CRC or length */
X#define ZMAPND  3       /* Append contents to existing file (if any) */
X#define ZMCLOB  4       /* Replace existing file */
X#define ZMNEW   5       /* Transfer if source newer */
X        /* Number 5 is alive ... */
X#define ZMDIFF  6       /* Transfer if dates or lengths different */
X#define ZMPROT  7       /* Protect destination file */
X/* Transport options, one of these in ZF2 */
X#define ZTLZW   1       /* Lempel-Ziv compression */
X#define ZTCRYPT 2       /* Encryption */
X#define ZTRLE   3       /* Run Length encoding */
X/* Extended options for ZF3, bit encoded */
X#define ZXSPARS 64      /* Encoding for sparse file operations */
X
X/* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
X#define ZCACK1  1       /* Acknowledge, then do command */
X
Xlong rclhdr();
X
X/* Globals used by ZMODEM functions */
Xextern Rxframeind;      /* ZBIN ZBIN32, or ZHEX type of frame received */
Xextern Rxtype;          /* Type of header received */
Xextern Rxcount;         /* Count of data bytes received */
Xextern Zrwindow;        /* RX window size (controls garbage count) */
Xextern Rxtimeout;       /* Tenths of seconds to wait for something */
Xextern char Rxhdr[4];   /* Received header */
Xextern char Txhdr[4];   /* Transmitted header */
Xextern long Rxpos;      /* Received file position */
Xextern long Txpos;      /* Transmitted file position */
Xextern Txfcs32;         /* TURE means send binary frames with 32 bit FCS */
Xextern Crc32t;          /* Display flag indicating 32 bit CRC being sent */
Xextern Crc32;           /* Display flag indicating 32 bit CRC being received */
Xextern Znulls;          /* Number of nulls to send at beginning of ZDATA hdr */
Xextern char Attn[ZATTNLEN+1];   /* Attention string rx sends to tx on err */
X
X/* End of ZMODEM.H */
SHAR_EOF
echo "End of archive 2 (of 9)"
# if you want to concatenate archives, remove anything after this line
exit