home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / os2 / m2z211.arj / M2ZMODEM.DOC < prev    next >
Encoding:
Text File  |  1991-09-18  |  47.1 KB  |  1,069 lines

  1. M2ZMODEM 2.11
  2. =============
  3.  
  4. Introduction
  5. ============
  6.    M2ZMODEM is a stand alone ZModem file transfer protocol for OS/2. 
  7. The primary intention is to supply other terminal programs or BBS's
  8. with the advanced Zmodem protocol, even if it is possible to use
  9. M2ZMODEM as a terminal program too, by invoking the terminal feature
  10. in this program.  The terminal functions are quite limited, but
  11. includes scripting, ZModem AUTO up and download.  The scripting
  12. ability makes it possible to auto dial, logon and much more.
  13.    The source is written in Modula-2 and compiled with JPI TopSpeed
  14. Modula-2 OS/2-compiler.
  15.  
  16.  
  17. Installation
  18. ============
  19.    The program was developed in the IBM OS/2 Extended Edition 1.20
  20. environment, but should work with any OS/2 version.  It uses the
  21. COM0x.SYS driver delivered with the operating system.  Install
  22. M2ZMODEM by:
  23.  
  24. *   Copy the files into any subdirectory on your harddisk (we use
  25.     C:\M2ZMODEM here as an example).
  26.  
  27. *   If you want to alter the default messages to another language,
  28.     you should copy the appropriate MSG-file, to M2ZMODEM.MSG.
  29.     There are different MSG-files included for different languages.
  30.     They are named "MSG.xxx" there xxx is replaced by a country 
  31.     code.  To get swedish messages, you should type "COPY MSG.SV
  32.     M2ZMODEM.MSG".  The default language is english (if you miss 
  33.     "your" language, please contact me and we could work it out).
  34.  
  35. *   Add this directory in your PATH and DPATH, either in your
  36.     CONFIG.SYS file or in a CMD-file (with the command 
  37.     "SET DPATH=%DPATH%C:\M2ZMODEM;").
  38.  
  39. *   Add the line "DEVICE=C:\OS2\COM01.SYS" if you have an AT-
  40.     compatible system, or "DEVICE=C:\OS2\COM02.SYS" if you have
  41.     a PS/2 compatible system.
  42.  
  43. *   If you plan to use the BBS protocol driver, with the SHELL
  44.     option, you should consider putting "AUTOFAIL=YES" in your
  45.     CONFIG.SYS (for OS/2 1.2 or later).  See more about this below
  46.     (BBS protocol driver).
  47.  
  48. *   Reboot your system.
  49.  
  50.    Now you should be ready to run M2ZMODEM.  You start the program
  51. by typing "M2ZMODEM" at the command prompt.  You may give several
  52. options on the command line, described below.  The program uses the
  53. three environment variables "M2Z", "RZ" and "SZ" if they exists.  The
  54. M2Z variable is always merged to the command line, when M2ZMODEM is
  55. started.  If you select to send by M2ZMODEM the environment variable
  56. "SZ" is also merged to the command line, and if you select receive
  57. the variable "RZ" is merged.
  58.    An example on how to use these environment variables is showed
  59. below:
  60.  
  61. SET M2Z=-l COM1 -b 19200 -h
  62. SET RZ=C:\DOWNLOAD\
  63. SET SZ=C:\UPLOAD\*.*
  64.  
  65.    You may now start a download by just typing "M2ZMODEM -r" on the
  66. command line, or start a upload by typing "M2ZMODEM -s".
  67.  
  68.    This program will only run in a OS/2 full screen or a Presentation
  69. Manager Text window, except for the optional Presentation Manager
  70. status window, which only runs with Presentation Manager.  Note that
  71. the terminal feature performance is decreased when running in a
  72. Presentation Manager text window.  ZModem file transfer is not
  73. affected by this, but the Presentation Manager status window
  74. processing does load the file transfer thread a little, which could
  75. affect performance when running high speed communications.  If you
  76. get performance problems, showing by extensive resending while
  77. receiving files, even if the communication connection is perfect, you
  78. should try to NOT load the PM status window.  You should also
  79. consider buying an enhanced 16550 UART.
  80.  
  81.    If you run OS/2 1.2 there is a potential problem for you.  The
  82. first COM0x-drivers supplied with the operating system, has com-
  83. patibility problems which makes it impossible to use the driver in
  84. hardware handshaking mode (the "-h" option).  If you have to use
  85. hardware handshaking, I recommend you to use the COM0x-driver
  86. supplied with OS/2 1.1.  There are no conflicts using the OS/2 1.1
  87. driver for OS/2 1.2.
  88.    If you run OS/2 1.2 or later, the program will automaticly fully
  89. use the extended hardware buffering in the 16550 UART, if existing. 
  90. One potential problem in using the hardware buffering capabilities
  91. is that the hardware handshaking has a slower response time, because
  92. the driver send up to 16 characters after a hardware handshaking
  93. signal.  This should not be any big problem, because in the most
  94. cases you want to enable the hardware handshaking to communicate with
  95. modern high speed modems, with a higher DTE/DCE rate than the link
  96. speed.  These modems have buffering capabilities, and they usually
  97. allow this behaviour.
  98.  
  99.  
  100. Performance
  101. ===========
  102.    During development special care was taken to manage high speed
  103. file transfers in background operation.  Performance tests have
  104. proved that there are no problems to perform file transfers with
  105. about 1700 cps throughput over a 19200 baud connection, from the COM1
  106. device to the COM2 device in background operation (not using the
  107. extended hardware buffering).  This means that the computer was busy
  108. with both receiving and sending during the tests.  A 16 Mhz 386/SX
  109. computer was used for the performance tests.  Disk I/O is internally
  110. buffered in blocks of 16 kB.  The performance is reduced a lot if the
  111. operating system begins to swap memory to the harddisk during a file
  112. transfer.  This situation is not recommended.
  113.  
  114.  
  115. Start options
  116. =============
  117.    When starting the program you may use the following options:
  118.  
  119. -a fn    Executes script file specified by "fn".  Only valid if you
  120.          invoke the terminal feature by the "-i" option.
  121.  
  122. -b n     Select baudrate specified by "n" (n=decimal value between
  123.          110 and 19200, as specified in the COM0x.SYS documentation). 
  124.          If not specified the system default will be used.
  125.  
  126. -c       The file transfer will be directly followed by another, do
  127.          not send ZFIN to close ZModem connection.  If not specified
  128.          the ZFIN header will be sent.
  129.  
  130. -d       Suppress checking for carrier loss.  If not specified the
  131.          program will abort if carrier loss is detected.
  132.  
  133. -e env   Searchs for the environment variable "env" and merges this
  134.          to the command line options.  It is possible to merge
  135.          several environment variables into the same command line. 
  136.          By using the OS-command SET, one may simplify the startup
  137.          options for M2Z.
  138.  
  139. -f n     Scan for COMx file handles and select the n'th found for
  140.          communication (n=decimal 0 < n < 65536).
  141.  
  142. -h       Enables hardware handshaking CTS/RTS.  Software handshaking
  143.          by Xon/Xoff is always enabled.
  144.  
  145. -his     Enables history logging.  Only used in combination with the
  146.          "-i" option.  When enabled, it is possible to scroll
  147.          backwards to see old lines.  This is done by putting the
  148.          keyboard in ScrollLock-mode, and press the Up-arrow key. 
  149.          This feature creates a file called M2ZMODEM.HIS, that may
  150.          be inspected after the program is terminated.  This option
  151.          might slow down execution.  Default is to disable this
  152.          option.
  153.  
  154. -i       Invokes the on line terminal feature.
  155.  
  156. -l dev   Select device specified by "dev" for communication.
  157.  
  158. -n       No sound when file transfer complete.  Normally a beep is
  159.          performed before program ends.
  160.  
  161. -o fn    Place log information in file specified by "fn".  Note that
  162.          the file "fn" is incremented without any warning, if the
  163.          file exists.
  164.  
  165. -p n     Specifies which translate table to use for the terminal
  166.          session.  The "n" parameter is equal to the COUNTRY
  167.          parameter specified in the CONFIG.SYS file.  If "n" is set
  168.          to zero, no translation will occur.  If this option is not
  169.          specified the system country code will be used.  This option
  170.          is only acted on if you invoke the terminal feature. 
  171.          Currently only country 001, 046, 047 and 358 is implemented
  172.          (US/Sweden/Norway/Finland).  Other country codes use the
  173.          USA character set.
  174.  
  175. -pm      Loads the Presentation Manager status reporting window.
  176.  
  177. -prot x  Specify another file transfer protocol.  The default
  178.          protocol to use is Zmodem, but by specifying this parameter
  179.          you may select the one indicated by "x".  Replace "x" by
  180.          XMODEM, XMODEM1K, YMODEM, YMODEMB, YMODEMG, YMODEMGB for
  181.          Xmodem, Xmodem/1K, Ymodem, Ymodem Batch, Ymodem-G or Ymodem-
  182.          G Batch.  By replacing "x" with "BBS" you load a user
  183.          interface for the remote system (a BBS protocol driver). 
  184.          This is suitable when you want to use M2Z to handle up and
  185.          downloads in your BBS.
  186.  
  187. -prty x  Specifies that the program should execute with priority x,
  188.          where x is replaced by a decimal value.  Current available
  189.          choices are: 0=Normal priority, 1=Default priority, 2=Time
  190.          Critical priority.  Prty 0 will usually give the best
  191.          result, if you want to work with other programs in the
  192.          foreground (this is the lowest priority).  Prty 2 will give
  193.          the M2Zmodem program a very high priority, resulting in good
  194.          performance in this program, while other programs get very
  195.          little time to execute.  Prty 1 is equal to prty 0 if the
  196.          baud rate is below 9600 and  equal to prty 2 if the baud
  197.          rate is 9600 or higher.  Prty 1 is the default action, but
  198.          I recommend you to try prty 0 first, and see if you
  199.          encounter any problems, and in that case you could switch
  200.          back to prty 1.
  201.  
  202. -q       Suppress status messages and keyboard scanning.  If not
  203.          specified status messages will be displayed and keyboard be
  204.          scanned for operator abort.
  205.  
  206. -r dir   Receive files into path specified by "dir".  If you want to
  207.          download into default directory, specify the "-r" option
  208.          last on the command line, and omit the "dir" parameter.
  209.  
  210. -ren     If the file already exists when receiving, the received file
  211.          will be renamed, with the prefix "1_", "2_" and so on.  This
  212.          is the default action.
  213.  
  214. -res     If the file already exists when receiving, it is assumed
  215.          that the existing file is incomplete, and is incremented by
  216.          the received file.  If the existing file is greater than the
  217.          received file, the received file is ignored.
  218.  
  219. -s fn    Send file(s) specified by "fn".  You may use wildcards to
  220.          specify batch transfers.
  221.  
  222. -skip    If the file already exists when receiving, the received file
  223.          will be skipped.
  224.  
  225. -t       Suppress conversion of file names to upper cases.  Normally
  226.          all file names are converted to all lower cases during send,
  227.          and converted back to all upper cases by the receiver.  By
  228.          specifying this parameter the file names are transfered
  229.          exactly as they appear in the operating system.
  230.  
  231. -u n     Select file handle specified by "n" for communication
  232.          (n=decimal value 0 <= n < 65536).
  233.  
  234.    The options may be placed in any order, but must be separated by
  235. spaces and prefixed with the minus sign.
  236.  
  237.  
  238. Invoking M2ZMODEM from another communication program
  239. ====================================================
  240.   If you want to execute the program from your own communication
  241. program, there are different techniques available for this, depending
  242. on how your communication program is written.  The problem is how to
  243. specify which communication port to use, because some communication
  244. programs does not allow other programs to access the same port as the
  245. communication program.  In any case, the communication program must
  246. have the possibility to execute a child process (DosExecPgm), or
  247. there is no way to invoke the Zmodem software, if you do not exit the
  248. communication program first, and executes Zmodem from the OS/2
  249. command line.
  250.  
  251.    If your software has opened the communication device with the
  252. SHARE mode field set to DENY NONE, you just invoke Zmodem as you do
  253. from the command line, using the "-l" option, by specifying the
  254. device name to use.
  255.  
  256.    If your software has opened the communication device with the
  257. SHARE mode field set to anything else than DENY NONE and has set the
  258. INHERITANCE field set to TRUE, you could try to invoke Zmodem by
  259. specifying the device handle to use, using the "-u" option.  This is
  260. only possible if the communication program used makes the device
  261. handle available to the user.
  262.  
  263.    If your software has opened the communication device with the
  264. SHARE mode field set to anything else than DENY NONE and has set the
  265. INHERITANCE field set to TRUE, but does not make the device handle
  266. available for the user, you could try to invoke Zmodem by using the
  267. "-f" option.  In most cases you should select "-f 1" option, which
  268. makes the Zmodem software scan all available device handles, and
  269. locks to the first appropriate device handle for communications.  If
  270. your communication program only supports one open communication
  271. device at the time, this should work fine.  If on the other hand,
  272. your software supports multiple concurrent open communication
  273. devices, it could be hard to know which occurence to use.  It is NOT
  274. always that way that COM1 is the first occurence and COM2 the second
  275. and so on.  It is rather so that the first occurence corresponds to
  276. the port first opened.  If you program first opens COM2 then COM3 and
  277. last COM1, these ports will correspond to "-f 1", "-f 2" and "-f 3"
  278. respectively.
  279.  
  280.    Any device that is compatible with COM0x.SYS may be used.  The
  281. only restriction is that the device name can not begin with the
  282. percent sign ("%COM10" is illegal).
  283.  
  284.    When M2ZMODEM exits, the return code is set to:
  285.  
  286. 0        If at least one file was sent/received.
  287. 1        If a command line parse error occured.
  288. 2        If send or receive failed.
  289. Zmodem specifikations
  290. =====================
  291.    The baudrate is not limited in the software, but the COM0x.SYS
  292. drivers currently only supports speeds from 110 up to 19200 bauds. 
  293. The communication line is always set to 8 databits, no parity and 1
  294. stopbit.  The line characteristics is restored to its previous
  295. condition when exiting the program (except for the baud rate). 
  296. Software handshaking with Xon/Xoff is always enabled, and hardware
  297. handshaking with CTS/RTS is optionally enabled.  The DTR signal is
  298. always set and RTS is set, if not used for hardware handshaking.  All
  299. these parameters are reset to their previous conditions when exiting.
  300.  
  301.    All filenames are sent exactly as they appear in the operating-
  302. system over the Zmodem protocol (upper and lower cases filenames will
  303. be sent).  Operating systems not supporting both upper and lower case
  304. filenames always send filenames in lower case.  When M2Zmodem
  305. receives files it will try to determine if the filename is a long
  306. filename (if it should permit both upper and lower case filenames). 
  307. If the received filename contains ANY upper case letter, or if it
  308. does not conform to the 8+3 MS-DOS naming convention, it will use the
  309. filename exactly as received, otherwise the filename will be
  310. converted to all upper case.  This means that if you transfer files
  311. between two M2Zmodem programs, the filename will be transmitted
  312. exactly as it appears in the operating system, except if the filename
  313. is ALL lower case, and conforms to the 8+3 format.  By specifying the
  314. "-t" option, you can disable conversion alltogether, resulting in
  315. filenames with all lower case, if it isn't sent by a operating system
  316. supporting both upper and lower case filenames.
  317.  
  318.    The program will select 32 bit CRC error checking if receiver has
  319. indicated this capability.
  320.  
  321.    File compression and decryption is not yet implemented in
  322. M2ZMODEM.  The program escapes control characters as specified in
  323. Omen technology documentation.  8th bit escaping and escaping of all
  324. control characters is not yet implemented.
  325.  
  326.    If a file already exists when receiving, the program may resume
  327. the file (increment it), rename the file or skip it.  The default
  328. action is to rename the file, but this may be altered by the command
  329. line options.  If the file is renamed this is done by giving the
  330. received file name a prefix of "1_", "2_" and so on.  Note that if
  331. you run on a HPFS-drive it is possible that the new file name, will
  332. not conform to the 8+3 standard "old" file name format.  And if you
  333. on the other hand don't run a HPFS-drive, the file name prefix is
  334. truncated to 8 characters.
  335.  
  336.    During a file transfer, it is possible to abort the ZModem session
  337. by pressing the Escape key (if you are lucky).
  338.  
  339.  
  340. OTHER FILE TRANSFER PROTOCOLS
  341. =============================
  342.    The M2ZMODEM program may use other file transfer protocols than
  343. the default (and best) Zmodem protocol.  By specifying the "-prot"
  344. option you may select another.  These currently are:
  345.  
  346. XMODEM            Xmodem.
  347. XMODEM1K          Xmodem with optionally 1024 bytes block length. 
  348.                   While receiving block length is detected automa-
  349.                   ticly, which means there is no difference between
  350.                   XMODEM and XMODEM1K for receive sessions.
  351. YMODEM            Ymodem with optionally 1024 bytes block length. 
  352.                   This is the same as Xmodem, but the file name, and
  353.                   some other parameters are sent to the receiver.
  354. YMODEMB           Ymodem batch, is the same as YMODEM, but a batch
  355.                   file transfer protocol, making it possible to send
  356.                   several files in a session.
  357. YMODEMG           Ymodem-G, is the same as YMODEM, but the protocol
  358.                   does not wait for ACK/NAK between the data blocks. 
  359.                   This protocol should only be used with modems using
  360.                   error correction, because it can't recover any
  361.                   transmission errors.
  362. YMODEMGB          The same as Ymodem-G, but a batch protocol.
  363. BBS               By specifying this parameter, you put M2Z in server
  364.                   mode (BBS protocol driver).  See more about this
  365.                   below.
  366.  
  367.    When not using batch protocols, only the FIRST found file, if you
  368. specify a wild card file specification, is sent.
  369.  
  370.    The Ymodem-G protocol is not recommended for receiving files in
  371. high speeds when not running the program in foreground, because this
  372. protocol does not support error recovery.  There will be a risk of
  373. overruns, making the whole transfer abort.  Generally the ZModem
  374. protocol is the best, and the therefore the effort has been con-
  375. centrated on evaluating a good implementation of this protocol.
  376.  
  377.  
  378. BBS PROTOCOL DRIVER
  379. ===================
  380.    By specifying the option "-prot BBS" you put M2Z in server mode. 
  381. M2Z will display a menu with available protocols on the remote
  382. system, and ask the user to select one of these.
  383.    Then M2Z will ask for which files to up/download.  If the user
  384. specified a batch file transfer protocol, it is possible to use
  385. wildcards and/or specify multiple files, separated by spaces.  After
  386. this, the user will be asked to start his/her file transfer proce-
  387. dure.
  388.    This interface is suitable if you want to install M2Z to handle
  389. up and downloads in your BBS.  The parameters to the "-r" and "-s"
  390. options, should only contain valid path names in this case, and NOT
  391. filenames (it is not necessary to specify any pathname at all).  A
  392. path name is terminated with a backslash.  An example is showed
  393. below:
  394.  
  395. M2ZMODEM -l COM1 -b 19200 -s C:\TXTFILES\ -prot BBS -h
  396.  
  397.    This command line will start M2Zmodem for the COM1 device, 19200
  398. baud, and start the BBS protocol driver, and only pick files from the
  399. C:\TXTFILES\ directory.  Hardware handshaking will be used.
  400.  
  401. M2ZMODEM -l COM1 -b 19200 -r C:\UPLOAD\ -prot BBS
  402.  
  403.    This line will start the BBS protocol driver and put all uploaded
  404. files in the C:\UPLOAD\ directory.
  405.  
  406.    If no action is taken within the BBS protocol driver for about 1
  407. minute, the program is terminated by itself, to prevent a user from
  408. hanging the BBS.
  409.  
  410.    To pass parameters to the BBS protocol driver, there is an
  411. environment string "M2ZBBS" you may set.  The string may contain
  412. several parameters, separated by spaces, or by ";".  Possible
  413. parameters are:
  414.  
  415.          BAUD.xxx Tells the protocol driver to user the baudrate
  416.                   "xxx" (decimal value) to estimate download time. 
  417.                   This parameter does NOT affect the real line
  418.                   characterstics.  If this parameter is not specified
  419.                   the protocol driver will read the real baudrate
  420.                   from the device used.  If "0" is specified, the
  421.                   parameter is ignored, and the real baudrate will
  422.                   be used.
  423.          MAX.xxx  Sets the download limit.  Replace "xxx" with a
  424.                   decimal value.  The string "MAX.512000" would set
  425.                   the download limit to 512000 bytes.  Default is no
  426.                   dwonload limit.
  427.          NODIR    This option disables listing of selected files,
  428.                   before a download.  Only a summary of how many
  429.                   files, and bytes are displayed.  Default is to
  430.                   display a directory.
  431.          PATH.xxx Sets the protocol driver to use the path names in
  432.                   the "xxx" environment string, as download direc-
  433.                   tories.  The "xxx"-environment should contain
  434.                   pathnames terminated by a backslash, separated by
  435.                   ";" or space.  If specified when starting when a
  436.                   user does an upload, only the first path in "xxx"
  437.                   will be acted on.  The environment string "xxx" is
  438.                   only acted on up to the 2048 first characters.
  439.          SHELL.xx Sets the password to access the SHELL command, to
  440.                   "xx".  "xx" may be any string, but only the first
  441.                   15 characters are checked.  The password should NOT
  442.                   contain the ";" character.  If the password is set
  443.                   to "YES", no password check is done at all.  If the
  444.                   password is set to "NO", the user will not be able
  445.                   to shell at all.  Default is to not let the user
  446.                   shell at all.
  447.          TERM.xxx There "xxx" is a terminal name. Available terminals
  448.                   are:
  449.                             ANSI     Sends ANSI-BBS sequences.
  450.                             TTY      Does not send any terminal
  451.                                      sequences at all, but CR, BS and
  452.                                      FF.
  453.                             0        The same as "TTY" above.
  454.                             1        The same as "ANSI" above.
  455.          TIME.xxx There "xxx" is replaced by the amount of time left
  456.                   for the user in seconds.  Default is no time limit.
  457.  
  458.    Be careful with the SHELL option.  Only text applications may be
  459. run in the SHELL, and not even all of the text applications runs well
  460. in the SHELL.  OS/2 commands run well in the SHELL, and some other
  461. programs too.
  462.    If no input or output was made for the last five minutes, the
  463. SHELL will be automaticly closed, and you will be returned to the
  464. HOST menu.
  465.    You always close the SHELL manually by pressing the ESC-key twice
  466. while in the SHELL.  If a program hangs because it was not suitable
  467. to run in the SHELL, you should be able to kill this program by
  468. pressing the ESC-key.
  469.    Note that a SHELL user have a lot of power in your system.  He/she
  470. may delete any files, format disks, change your userlist.
  471.  
  472.    If you plan to use the BBS protocol driver, with the SHELL option,
  473. you should consider putting "AUTOFAIL=YES" in your CONFIG.SYS (for
  474. OS/2 1.2 or later).  This will disable the error pop-ups and give a
  475. error message instead.  This is necessary for the SHELL option,
  476. because error pop-ups can't be fetched by the BBS protocol driver. 
  477. If an hard error occurs while you run the SHELL option, and you have
  478. not enabled the AUTOFAIL option, the program will "hang" awaiting
  479. response from the "real" keyboard.
  480.  
  481.    A setup example is showed below:
  482.  
  483. SET NORMAL=C:\TWIT\;C:\NORMAL\;C:\SECRET\;D:\;
  484. SET EXTRA=%NORMAL%D:\EXTRA\;
  485. SET SYSOP=%EXTRA%D:\SYSOP\;D:\SECRET\;
  486. SET M2ZBBS=TERM.ANSI;MAX.512000;NODIR;PATH.NORMAL
  487. M2ZMODEM -l COM1 -b 19200 -prot BBS -s C:\TWIT\;
  488.  
  489.    This sequence will load the protocol driver, and the user will be
  490. able to download files from the paths specified in the "NORMAL"
  491. environment string.  If you replace the "PATH.NORMAL" string by 
  492. "PATH.SYSOP" the user will be able to download files from the paths
  493. specified in the "SYSOP" environment string instead.  If the argument
  494. passed with "PATH." is not valid like "PATH.UNKNOWN", the path
  495. specified on the command line will be used, in this example the 
  496. "C:\TWIT\" path.  If no path is specified on the command line, the
  497. current directory will be used.
  498.  
  499.    The same rules apply to uploads, but only the first path specified
  500. will be used.  If you load M2Z by:
  501.  
  502. M2ZMODEM -l COM1 -b 19200 -prot BBS -r C:\UPLOAD\
  503.  
  504.    If the "EXTRA" user uploads files, the files will be placed in the
  505. "C:\TWIT\" path.  If the "UNKNOWN" user uploads a file, it will be
  506. placed in the "C:\UPLOAD\" path.
  507.  
  508.    Upper or lower cases are not significant.  To pass parameters back
  509. from the BBS protocol driver, the environment string "M2ZBBSRC" is
  510. reserved.  Currently no parameters are returned from the BBS protocol
  511. driver.
  512.  
  513.    Yet another example on how you may use the BBS protocol driver. 
  514. Suppose you have a door in your BBS-system, that starts the CMD-file
  515. M2ZDOOR.CMD and passes the following parameters:
  516.  
  517.          %1       Download limit in Kbytes for download passed as a
  518.                   decimal value.
  519.          %2       Level for the user passed as a decimal value
  520.                   between 1 and 9.
  521.  
  522.    Before the BBS is started, the following environment strings are
  523. set:
  524.  
  525.          SET LEVEL1=C:\DISGRACE\;C:\TWIT\;
  526.          SET LEVEL2=%LEVEL1%C:\LIMITED\;
  527.          SET LEVEL3=%LEVEL2%C:\NORMAL\;
  528.          SET LEVEL4=%LEVEL3%C:\WORTHY\;
  529.          SET LEVEL5=%LEVEL4%C:\PRIVIL\;
  530.          SET LEVEL6=%LEVEL5%C:\FAVORED\;
  531.          SET LEVEL7=%LEVEL6%C:\CLERK\;
  532.          SET LEVEL8=%LEVEL7%C:\ASSTSYSOP\;
  533.          SET LEVEL9=%LEVEL8%C:\SYSOP\;
  534.  
  535.    The M2ZDOOR.CMD file could now look like:
  536.  
  537.          @ECHO OFF
  538.          SET M2ZBBS=TERM.ANSI;MAX.%1000;PATH.LEVEL%2;
  539.          M2ZMODEM -l COM1 -b 19200 -prot BBS -s C:\TWIT\;
  540.  
  541.  
  542. FILE SERVER PROGRAM
  543. ===================
  544.    A simple program to set up a file server is included, called
  545. M2ZSERV.  It is suitable primary for personal use, when you want to
  546. fetch files from your business machine, when you are at home, to just
  547. mention an example.  It is NOT a full featered BBS, but is much
  548. easier to setup.  You start the program by typing:
  549.  
  550.          M2ZSERV device
  551.  
  552.    Replace "device" with the device name you want to set up the
  553. server for, like "COM1".  You have to put your modem into auto
  554. answer, and the cabling must deliver the DCD line correctly (or set
  555. to constant high, but it is not recommended).  Dropping DTR should
  556. result in a hang up, but it is not necessary.
  557.  
  558.    When carrier is detected the program will ask for a "Enter"
  559. keystroke, and wait for one second to get this keystroke.  If the
  560. keystroke was not received, the program will alter the baudrate to
  561. the next lower, and try again.  The program cycles all baudrates
  562. around until the "Enter" keystroke is detected (or carrier lost). 
  563. The baudrates scanned is 19200, 9600, 2400, 1200 and 300 baud.  By
  564. this scanning, the program should be compatible with any modem
  565. supporting auto answer.
  566.  
  567.    After the program has fixed for a baudrate, it will ask for
  568. username and password, validate them by checking the USERLIST.BBS
  569. file, and fetch the user level.  The format for USERLIST.BBS is
  570. showed by the example file included (each entry MUST be followed by
  571. a CR/LF sequence).  There are four parameters defined (yet), each
  572. terminated by a ";".
  573.  
  574.          1.       User name (not case sensitive)
  575.          2.       Password (case sensitive)
  576.          3.       User level (not case sensitive)
  577.          4.       Shell password (case sensitive).  If this field
  578.                   contains the word "YES", no password check will be
  579.                   done.  If this field contains "NO", the user will
  580.                   not be able to shell at all.  All other combi-
  581.                   nations sets the password according to the field. 
  582.                   Only the first 15 characters are validated, and the
  583.                   password should not contain the ";" character.  Se
  584.                   more about the SHELL option above (BBS protocol
  585.                   driver).
  586.          5.       Complete callback string.  If this is empty, no
  587.                   callback processing will be used.
  588.  
  589.    An example:
  590.  
  591.          Mikael Wahlgren;secret;Sysop;shellpassword;ATDT1234567
  592.          Who knows;my secret;Twit;NO;;
  593.  
  594.    The program will ask if the user wants to download, upload or
  595. disconnect, and loads the appropriate BBS protocol driver interface. 
  596. The user will return to this menu after each file transfer request. 
  597. The user will be able to access directories for download, according
  598. to the environment string, complying with the user level you set. 
  599. If you set the user level to "SYSOP" for an user, the user will be
  600. able to access "C:\", "C:\SYSOP\", "C:\EXAMPLE\HELLO", if the
  601. environment string "SYSOP" is previously set to:
  602.  
  603.          SET SYSOP=C:\;C:\SYSOP\;C:\EXAMPLE\HELLO\;
  604.  
  605.    When the user has selected up or download, the M2ZSERV program
  606. will execute the M2ZBBS.CMD batch file (by calling "CMD /C M2ZBBS %1
  607. %2"), with the parameters:
  608.  
  609.          %1       Operation.  "-s" for download and "-r" for upload.
  610.          %2       User level.
  611.    
  612.    By altering the included M2ZBBS.CMD file, you may select different
  613. options in the M2ZMODEM BBS protocol driver.
  614.  
  615.    The only way to terminate the M2Z HOST mode, is by pressing CTRL-
  616. BREAK or CTRL-C when the session is in foreground.
  617.  
  618.  
  619. TERMINAL FEATURE
  620. ================
  621.    I simple but fast terminal feature is implemented in the program. 
  622. It emulates an ANSI terminal, and it is possible to execute scripts
  623. (automatic terminal sessions) and upload/download files with the
  624. ZModem protocol.
  625.    The terminal function has built in translate tables for different
  626. countries.  The correct translate table is automaticly activated by
  627. inspecting the COUNTRY-code specified in your CONFIG.SYS file (if no
  628. other translate table is specified by the "-p" option).  Currently
  629. only 001, 046 and 358 country tables are implemented.
  630.    The terminal session has AUTO ZModem Up/Download capability, which
  631. means it detects when you requested a ZModem file transfer from a BBS
  632. and automaticly invokes the Up/Download routines.  You may also
  633. request download or upload manually by pressing the PgDn or PgUp
  634. function keys.
  635.    You may execute a script file by pressing ALT-S and give the file
  636. name of the script.  The M2ZMODEM script language is a very simple
  637. way to automate terminal sessions.  The following commands are
  638. available:
  639.  
  640. INITIAL "string"                     Sends "string" to the remote at.
  641.  
  642. RESPOND "await" "string"             Whenever "await" is received
  643.                                      "string" is sent to the remote.
  644.  
  645. DELAYED RESPOND "await" "string" "n" Whenever "await" is received
  646.                                      "string" is sent to the remote,
  647.                                      after "n" seconds delay (n=deci-
  648.                                      mal value).
  649.  
  650. QUIT "await"                         Whenever "await" is received the
  651.                                      script execution is finishing and
  652.                                      you are back to normal terminal
  653.                                      operation.
  654.  
  655. EXIT                                 Marks end of script file.
  656.  
  657.    With scripting it is possible to perform redial, logon, download,
  658. logoff and much more, by just specifying a script file.  A sample
  659. script file, which will redial a BBS and then logon to the system
  660. is showed:
  661.  
  662. INITIAL "ATDT 12345678!"
  663. DELAYED RESPOND "BUSY" "ATDT 12345678!" "5"
  664. DELAYED RESPOND "NO DIALTONE" "ATDT 12345678!" "5"
  665. RESPOND "Press Escape twice to load BBS" "@@"
  666. RESPOND "Password: " "secret!"
  667. RESPOND "Name: " "My Name!"
  668. RESPOND "More (Y/N)" "N"
  669. QUIT "Main menu"
  670. QUIT "NO CARRIER"
  671. EXIT
  672.  
  673.    Note that it not is significant in which order you place your
  674. script instructions.  Each instruction is valid concurrently as long
  675. as the script is executed.  You abort a script execution by pressing
  676. the escape key.  In text strings "!" are replaced with <Enter> (03H)
  677. and "@" are replaced by <Esc> (1BH).  Only the first 100 instructions
  678. are acted on.  Upper and lower cases are significant.  It is still
  679. possible to use the terminal functions while executing a script file.
  680.  
  681.    By pressing ALT-D you will display the dialling directory.  The
  682. dialling directory is placed in a file called "M2ZMODEM.DIR", and
  683. has the following format:
  684.  
  685. Name;Number;Scriptfile;
  686. Mikael Wahlgren;4631196417;AutoDial;
  687. .
  688. .
  689. .
  690. Example;123;AutoDial;
  691.  
  692.    The first parameter is the name of the entry, the second parameter the
  693. phone number to use, and the third parameter is the script file used for
  694. dialling.  If you select an entry in the dialling directory, the program
  695. will load the associated script file, and replace all occurencies of "#"
  696. in the script file, by the phone number in the dialling entry, and then
  697. execute the script.  An example of a dialling script file is included and
  698. called AUTODIAL.
  699.  
  700.    You exit the terminal session (and the whole program) by pressing
  701. ALT-X.
  702.    Note, that it is impossible to abort the program with CTRL-C if
  703. running the terminal session.
  704.  
  705.  
  706. PRESENTATION MANAGER SUPPORT
  707. ============================
  708.    There is a limited support for Presentation Manager.  By speci-
  709. fying the "-pm" option on the command line, you can load a Presen-
  710. tation Manager ZModem file transfer status window.  This window
  711. displays the same information as the PopUp in text windows.
  712.    It is possible to interface with the communication program, in
  713. order to write an own status window, or monitor the file transfer
  714. status.  This is done by writing a Presentation Manager application,
  715. with the file name "M2ZPM.EXE", which opens a named pipe called
  716. "\PIPE\M2ZPM" in message mode (as client).  The message block is
  717. defined like:
  718.  
  719.          WORD     Message type
  720.          DWORD    Value 1
  721.          DWORD    Value 2
  722.          DB 40    40 character ASCIIZ
  723.  
  724.    Possible message types are:
  725.  
  726.          0        Send before each transfer session.  This message
  727.                   is sent only once per transmission, even if it is
  728.                   a batch transfer.
  729.          1        ASCIIZ contains file name.
  730.          2        Value 1 contains file size.
  731.          3        ASCIIZ contains file transfer message.
  732.          4        Value 1 contains ZModem frame type.
  733.          5        Value 1 contains throughput value, Value 2 contains
  734.                   file position, ASCIIZ contains calculated remaining
  735.                   file transfer time.
  736.          6        Value 1 contains amount of ZModem errors.
  737.  
  738.    The pipe is closed when the M2ZMODEM program exits.  Before the
  739. pipe is closed, it is reset, to ensure that the client has read all
  740. messages.  A non working client that won't read the pipe, could
  741. prevent M2ZMODEM from exiting successfully.  A buffer of 1024 bytes
  742. is allocated to the pipe.  If the buffer is full, M2ZMODEM won't
  743. write any messages to the buffer, until it clears.  The client should
  744. not assume that the whole message block is always transfered.  It is
  745. possible that the message is truncated to include only the valid part
  746. of the message block.
  747.  
  748.  
  749. RELEASE LOG
  750. ===========
  751.  
  752.  - Version 1.00 1989-12-11
  753. ==========================
  754.    First official release of M2ZMODEM.  All previous versions is just
  755. test shoots.
  756.  
  757.  - Version 1.01 1990-01-06
  758. ==========================
  759.    All source is packed in the .EXE file and no DLL's are used any
  760. more.
  761.  
  762.   The status reporting window is altered and irrelevant information
  763. removed.
  764.  
  765.   Filenames not complying with the 8+3 format is supported.
  766.  
  767.   File transfers greater than 64 Kb correctly closed.
  768.  
  769.  - Version 1.11 1990-01-09
  770. ==========================
  771.   Remaining transfer time deisplayed instead of total transfer time.
  772.  
  773.   Faster ZModem session shutdown (Over and Out operation improved).
  774.  
  775.   Keyboard scanning changed to improve compatibility with other
  776. programs calling M2ZMODEM.  A DosGetFocus is called before trying to
  777. access the keyboard.  M2ZMODEM locked if the calling program was
  778. blocked awaiting for characters from the keyboard in the previous
  779. versions.
  780.  
  781.   The VIO is switched to ANSI-mode and the cursor is hidden when
  782. M2ZMODEM starts, and restored to its previous state when exiting.
  783.  
  784.  - Version 2.00 1990-01-19
  785. ==========================
  786.   The full power of the 16550 extended hardware buffering is enabled
  787. by setting the receive trigger level at 8 characters and transmit
  788. buffer load count to 16 characters.  See more about this above.
  789.  
  790.   The parameters for the COM-port is restored to its previous condi-
  791. tion, when exiting the program.  This was not done correctly before.
  792.  
  793.   A simple terminal feature with scripting ability is implemented. 
  794. By specifying the "-i" option the program will go on line in ANSI
  795. terminal mode.  See more about the terminal feature above.
  796.  
  797.   The cursor and ANSI state is unaltered when starting the program
  798. without parameters.  Previously the program put the screen into ANSI
  799. off.
  800.  
  801.  - Version 2.01 1990-01-20
  802. ==========================
  803.    The terminal functions are enhanced with break signal, clear
  804. screen, help screen.
  805.  
  806.    The hang-up command has been altered to both lower DTR and send
  807. the AT-command for hang up.
  808.  
  809.    The license file system is introduced.
  810.  
  811.    The status reporting window is now designed as a "pop-up".  The
  812. screen is restored to its previous condition when exiting.  The
  813. colors are selected to be compatible with both color, black/white,
  814. monochrome display adapters.  When exiting the program, the color
  815. attributes are reset, regardless of the condition when entering the
  816. program.
  817.  
  818.    The log file is now incremented, if it already exists, and not
  819. overwritten.  Each log record is marked with date and time.
  820.  
  821.  - Version 2.02 1990-01-31
  822. ==========================
  823.    The status window is altered.  Instead of showing the block check
  824. status, the transfer rate is displayed.
  825.  
  826.    The possibility to set environment variables, and refer to these
  827. with the "-e" option is added.  It is possible to merge several
  828. environment variables together at the same command line.
  829.  
  830.    The file transfer time estimate is calculated in a smarter way. 
  831. The current CPS value is used for the calculation, instead of the
  832. baudrate.  This makes the time estimate more correct for modems with
  833. a higher DTE-DCE line speed, than the link speed.
  834.  
  835.  - Version 2.03 1990-02-01
  836. ==========================
  837.    When running at speeds of 9600 baud or higher, or using the
  838. default baud rate, the process priority is changed to class 3 (Time
  839. Critical).
  840.  
  841.    Some minor corrections have been made in the log file.
  842.  
  843.    The transfer time is displayed in minutes with only one decimal,
  844. to avoid the similarity with the mm:ss format (making you believe it
  845. is displaying minutes and seconds).
  846.  
  847.    A Presentation Manager status reporting window is now implemented. 
  848. This is loaded by specifying the "-pm" option.
  849.  
  850.    The program may now resume, rename or skip a file, if it already
  851. exists on the target system.  Which action to take, depends on the
  852. command line options.  Default is to rename the file.
  853.  
  854.    If file modification time was not specified in the ZFILE header,
  855. an incorrect (and abnormal) file time was set.  This is corrected,
  856. and the file time is set to the current time, if not specified.
  857.  
  858.    The XModem category file transfer protocols are added.  By using
  859. the option "-prot" you may select Xmodem, Xmodem/1K, Ymodem, Ymodem-
  860. Batch, Ymodem-G or Ymodem-G-Batch.  The protocols are called
  861. "XMODEM", "XMODEM1K", "YMODEM", "YMODEMB", "YMODEMG" and "YMODEMGB"
  862. resp.
  863.  
  864.  - Version 2.04, 1990-02-13
  865. ===========================
  866.    Some minor changes have been made in the log file, in respect to
  867. X/Ymodem file transfers.
  868.  
  869.    The BBS Protocol Driver is loaded.  This is a user interface for
  870. those who want to use the M2Z to handle up and download in the BBS. 
  871. This is loaded by specifying the option "-prot BBS".
  872.  
  873.    The Presentation Manager status window program M2ZPM, would cause
  874. a hang, if the stream of messages from M2Z was too active.  This
  875. should now be fixed.
  876.  
  877.    If an upload was requested, with a system just echoing back the
  878. characters, the system would circle around sending NAKs to itself.
  879. This is corrected, and now the system sends ZRQINITs every 10 second.
  880.  
  881.    It is now possible to abort transfers by pressing the left mouse
  882. button at the "<Abort>" field.
  883.  
  884.    Some corrections have been made in the Ymodem protocols.
  885.  
  886.    The program is now easily "translatable" to other languages, by
  887. putting almost all messages in a message file.
  888.  
  889.    Asynchronous write processing has been implemented in the Zmodem
  890. protocol, to increase the throughput.  A test seemed to indicate that
  891. the performance increased a little (but not much).
  892.  
  893.  - Version 2.05, 1990-02-19
  894. ===========================
  895.    The synonyms "0" for "TTY" and "1" for "ANSI" terminals in the BBS
  896. interface parameters are added.
  897.  
  898.    The parameter "TIME." is added in the BBS interface, and a simple
  899. time estimate is displayed before a transfer.  The time estimate,
  900. does not count with the overhead of different protocols.
  901.  
  902.    Hang when unathorized user logged into the M2Z HOST, removed.
  903.  
  904.    The remaining time in the file transfer status window is now back
  905. to the "mm:ss" format, but now really displays minutes:seconds.
  906.  
  907.    New registration information.
  908.  
  909.    SHELL function in M2Z HOST program.
  910.  
  911.  - Version 2.06, 1990-04-27
  912. ===========================
  913.    The screen dump fature is altered to append CR/LF at end of each
  914. row, to allow text editing.
  915.  
  916.    The redisplay feature is added (see "-his" option above).
  917.  
  918.    The treatment of upper/lower cases in filenames is altered, to be
  919. more automatic.  Now M2Zmodem will makes its very best to determ if
  920. it is a "long" filename, and if upper/lower case characters should
  921. be kept.  The only case when M2Zmodem will fail to keep the same
  922. format of the filename is if the filename contains ONLY lower case
  923. characters and conforms to the 8+3 character old DOS naming conven-
  924. tion, in which case the filename will be converted to all upper
  925. cases.  This conversion may be overrided by the "-t" option.
  926.  
  927.    Some cosmetical changes in menus and messages.  M2Zmodem now uses
  928. window popups.
  929.  
  930.    The keyboard handling is altered, to also enable the arrow keys
  931. on the numerical part of the keyboard (if not in NumLock mode).  The
  932. separate arrow keys are treated the same way as before.
  933.  
  934.    The SHELL to OS/2 option in the BBS protocol driver is fixed.  In
  935. previous version, you could get a protection error when exiting the
  936. SHELL mode.  This should now be fixed.
  937.  
  938.    It is now possible to alter the COM parameters (baudrate, parity,
  939. data and stop bits) in the terminal session by pressing ALT-P.
  940.  
  941.    The mouse is now used in the terminal session.  The mouse button
  942. 1 (usually the left one) will send the character at the mouse pointer
  943. location, to the COM port.  Mouse button 2 (usually the right one)
  944. will send ANSI escape sequences to the COM port, to position the
  945. cursor at the same location as the mouse pointer.  It is possible to
  946. "drag" the mouse, when the left button is pressed, in order to send
  947. a string.
  948.  
  949. - Version 2.07, 1990-05-06
  950. ==========================
  951.  
  952.    The external program Os2You (also a MW-product) is used for
  953. shelling to OS/2.
  954.  
  955. - Version 2.08, 1990-07-29
  956. ==========================
  957.  
  958.    M2ZServ is capable of callback processing.
  959.  
  960.    M2Zmodem is altered to not conflict with Os2You if used concur-
  961. rently on the same communication port.
  962.  
  963. - Version 2.09, 1990-09-11
  964. ==========================
  965.  
  966.    Documentation corrected.  Script command INITIATE replaced with
  967. INITIAL (only in documentation, have always been INITIAL in program).
  968.  
  969.    Dialling directory added.
  970.  
  971.  
  972. - Version 2.10, 1991-02-17
  973. ==========================
  974.  
  975.    Changed compiler.  Changed behaviour of some keys, like Ctrl-P,
  976.    grey Enter.
  977.  
  978.  
  979. - Version 2.11, 1991-08-26
  980.  
  981.    Changed compiler, and fixed file date.  This version is also
  982.    compatible with PMTERM.
  983.  
  984.    Zmodem file transfer now works with named pipes to use the protocol
  985.    via the asynchronous network gateway implemented by Os2You.
  986.  
  987.    Zmodem file transfers would hang in certain situations (ZCRC header).
  988.    This is now fixed.
  989.  
  990.  
  991.  
  992.  
  993. - Planned enhancements
  994. ======================
  995. *        ASCII upload.
  996. *        Prestel emulation.
  997. *        Better redisplay function.
  998.  
  999. GUARANTEE
  1000. =========
  1001.    This software is released "as is".  I believe it works as
  1002. described in this documentation, but if it does not, I am not
  1003. responsible for any harm you may suffer from this.  I will try to
  1004. correct any bugs you report.  Even if you register the product this
  1005. will be true.
  1006.  
  1007.  
  1008. Important license information
  1009. =============================
  1010. It is illegal (or at least unethical) to patch the program in any way.
  1011. Any reverse engineering (disassembling or monitoring) is not an approved
  1012. use of the application.
  1013.  
  1014. If you register the software with 300 SEK (about $50), you will get a
  1015. license file and a copy of the most recent version of the program.  In
  1016. this case, you will also get rid of the registration screen during logon.
  1017.  
  1018. If you use the program on a regular basis, or in commercial use, you must
  1019. register with minimum the above mentioned sum for each machine running
  1020. the program.  For use in the Scandinavian countries (Sweden, Norway and
  1021. Denmark), I have the right to refuse registration of a user and prohibit
  1022. commercial use of the program, if I wish.  This will be the case, if the
  1023. use of the program conflicts with commercial interests related to me.
  1024.  
  1025. You are encouraged to spread this program (without registration file)
  1026. to anyone that might be interested.
  1027.  
  1028. If you want to register, send swedish banknotes, or let bank transfer
  1029. money to my account (note that you should send all money in swedish
  1030. currency), or pay by VISA or MC.  If you pay by VISA or MC, please
  1031. complete the ORDER.DOC form and mail or fax it to me.
  1032.  
  1033. My address is:
  1034.  
  1035. Mikael Wahlgren
  1036. Kransen 4E
  1037. S-416 72  GOTHENBURG
  1038. Sweden
  1039.  
  1040. Phone/FAX  +46 31 196417
  1041.  
  1042.  
  1043. ACKNOWLEDGMENTS
  1044. ===============
  1045.    J. R. Louvau's source code TPZSFZ for DOS, was "looked at" while
  1046. developing this source (which is completely different, and in another
  1047. language, but the Pascal source gave some useful hints).
  1048.  
  1049.    Joaquim Homrighausen's 32 bits CRC calculation was altered and
  1050. implemented in this source.
  1051.  
  1052.    Chuck Forsberg, Omen Technology and Telenet developed the ZModem
  1053. protocol.
  1054.  
  1055.    Jensen & Partners International developed the TopSpeed Modula-2
  1056. OS/2 compiler, which is a very powerful development environment for
  1057. OS/2 programming.
  1058.  
  1059.  
  1060.  
  1061. TRADEMARKS
  1062. ==========
  1063. OS/2     is a trademark of IBM Corporation.
  1064. PS/2     is a registered trademark of IBM Corporation.
  1065. PC/AT    is a registered trademark of IBM Corporation.
  1066. IBM      is a registered trademark of International Business Machines
  1067.          Corporation.
  1068. Omen     is a trademark of Omen Technology Incorporated.
  1069. 386/SX   might be a trademark of Intel Corporation.