Pete Cann's Communication Package Portions Copyright (C) 1992,1993,1994 Peter Edward Cann (Please see the file README for legal info) This is a set of programs and data files for communication between a PC and something external, possibly over a modem. In the case of certain modems, fax and voice are supported. This package is drastically different from most other communications programs, in that it is highly modular and generally requires the user to write batch files and/or scripts to make use of it. This is what you might call a "hacker style" paradigm (not to be confused with "cracker", generally an infantile individual who feels so insignificant that they screw other people in a desperate attempt to feel powerful). Hackers are people who are very comfortable with computers, and who like to have a lot of control and to know what's going on. Generally, they are good engineers, dedicated to the art. If you are a hacker, you may hate some of this stuff at first, like everything else. It isn't completely pretty; it hasn't been designed from the ground up for a long time, but if you use it enough to compare it to the that you'd otherwise be dealing with, you may find it adequate. If you are a novice, welcome to the world of hacking! This is not a consumer product, and you are not going to get support. I will give you one vital piece of advice: start very small, and get a simple system working. Write down which versions of all files you are using for your working system, and BACK THEM UP, at least under backup names, like .BSS for .SSC, .CBK for .C, etc. Do this every time before you start screwing around with something that works. Write down briefly what was good and bad about the backed-up version; otherwise you'll be utterly boggled as to what you had working when. The source code for all of these programs is included in the distribution, so if you know C you have all the information I do now. This C is MicroSoft QuickC, of which no endorsement should necessarily be inferred. Some of the style is pre-ANSI. The formatting style is that mandated by goD (which is odd 'cause I'm an Atheist). I apologize for all my lapses in rigor. It's amazing how much better a programmer you are at the end of your first 10,000-line project than at the beginning of it! Also, this package grew, rather than being designed, so it may be awkward in places. This phenomenon should be familiar to UNIX hackers. All of the programs give USAGE: information if invoked without arguments, except any that are supposed to be invoked without arguments. All of the programs that use a port can use COM 1 through 8, but COM 5 and 6 are only for AT and later machines and have not been tested. Speeds are given in units of 100 bps, such as: 24, 96, 384 or 576. All speeds that it is possible to specify thus are supported if the IBM can do them. The speed 0, although it shouldn't be meaningful, stuffs 0x0000 into the divisor latch, in case you want to do that. The environment variable PCCPPATH can be used to tell some of the programs where to find PCCP files, such as emu files and scripts. NOTE ON OPERATING SYSTEMS: These programs were developed under MS-DOS 3.31, and have been used fairly well under 5.0. If you're running any wierd stuff on top of DOS, i.e. desktops, Windows, etc., etc., this stuff may fail, possibly in a very nasty way. Of course, I'm not saying it won't do that anyway! Caveat usor! NOTE ON 16550 UARTS: I enable the FIFOs if present, with the receive threshold at one byte, then put them back the way I found them when done. I do NOT, however, gate 16 bytes for transmit every time the flag comes ready. (Icky, icky, icky! Take my PC, please!) This completely normal technique may highlight a timing bug in some internal modem virtual UARTS. In this case, use a higher speed. NOTE ON VIRUSES: I don't think I have a virus, but you never know. If these executables get irremediably infested, you should hopefully be able to compile the source on a clean system, unless of course some pathetic washout has stuck virus source into the source! The program TERM is a terminal emulator. It takes an emulation file, which you create or modify with EMUED. EMUED lets you specify strings to send for any programmable key, and lets you enter strings of characters and substitution tokens to invoke functions. These would be the "escape sequences", although they need not begin with Escape. The token codes are in EMU.H. The emulation facility also provides a graphics character substitution table for graphics character commands. TERM and EMUED look in the directory named by the PCCPPATH environment variable for emulation files, if PCCPPATH is set. The program CCODES types a hex listing of display character codes for use when assigning graphics characters in EMUED. TERM generates a CRLF in response to a Linefeed character, so it is often desirable to program an emulation to do a DOWN in response to a Linefeed. For LF insertion, the function CRLF can be performed in response to a CR. If the emulation file basename is prefixed with a plus sign (+), local echo is activated. The program TERMPLAY will step a file through an emulation. The program MASTERM invokes term with the three or four arguments, but if you exit TERM you get a menu for file transfers or beginning a dribble file. The file transfer programs are four variations on XMODEM in each direction, and have fairly clear names. Also, you can use mind-boggling port speeds without a 550, 'cause I only go out to disk between packets. On file transfer terminations, MASTERM does "Charge of the Light Brigade" or whatever you call that for success, and five descending adjacent semitones for error. I'm embarassed about this, but they're under a second, they tell you something, intuitively, and they're less annoying than the standard PC beep. If you want ZMODEM, *you* can write the thing, as soon as you come to after reading the spec! I *have* added my very own XMODEM CRC 16K protocol, which took me very nearly an entire half hour! It ought to do better than 95% at V.32bis/V.42 sending a zip. This is straight XMODEM CRC with a HI6 (0xb6, i.e. 0x80+'6') packet intro and double tail-end fallback. It's 16K so people won't burn me in effigy when 28.8 kbps arrives, which is about all she wrote for your basic POTS line. When ISDN happens, hopefully there will be a sensible standard. There are a lot of fairly sick interpretations of "automatic" XMODEM these days. One important trick is to nail your send in there *fast*, before the receiver stops offerring to do CRC. If you see a squiggle instead of a C it's too late; they want to do checksum (bleah!). My xmodem send programs, other than the 16k, take an optional /h flag for hit-and-run, which makes them not wait for an ACK after an EOT. Apparently, you don't ever get the ACK from rx on unix. The program SESSION is a simple host program, for use AFTER password validation by the script facility. It is hard-coded for 8n1 bits. It expects the modem to be in AT&C1 mode, that is, Carrier Detect conveys information. The last (optional) two arguments to SESSION are directories for download and upload. If they are given, they are prepended to the entered pathname in file transfer operations. If a directory is given, dot-dot (..) is prohibited in pathnames and the Shell option is not available. Session uses PCCPPATH to find executables, to speed up loading. The environment of any subschell contains REMOTE=YES, so you can do IF NOT "%REMOTE%"=="YES" THING in a batch file, where THING is something that would be bad to do from a comport, such as run a display editor. SESSION terminates if Carrier Detect goes false, unless it is running the shell. The program MESSIN accepts a message from the port and appends it to the specified file. This is for email to the sysop. The program MESSOUT asks for a filename in or below the specified directory and displays it with pagination. Security is achieved through sparse naming. The program COMSCRPT runs scripts. It is very powerful, with multiple branching look-fors, timeouts and retry limits. The program SCRCHK checks scripts for parsability and undefined label references. The USAGE: message for SCRCHK also tells you the script buffer capacity for both of these, which is a #define. The script file must have the extension ".SCR". If the PCCPPATH environment variable is set, the program looks for the script there. The program loads the script into RAM and then executes it. Lines are limited to 80 characters. String fields in a script start immediately after the delimiting space, even if that means they start with whitespace. Trailing whitespace is also included in a string field. If your editor gives you no way to tell if you have trailing whitespace, why are you using it? I'm quite partial to any good EMACS. (This should not be taken as an unqualified endorsement of RMS. Abolishing intellectual property altogether strikes me as being similar to communism, in that it's a nice idea and it might be workable in a few hundred years.) At parse time, a $1 through $9 will be replaced with the corresponding argument to COMSCRPT starting after the name of the script. $@ expands to the value of PCCPPATH followed by \ if PCCPPATH is set; otherwise it expands (to use the term loosely) into nothing, i.e. the $@ is simply diked out. $ on the other hand will bomb if the arg is not supplied. $ is an escape; to use it without expansion, use two of them and you'll end up with one. $ is expanded pretty much before any other parsing. The first line in a script file must be followed optionally by zero to turn off flow control. $ is permitted. The characters '|' and '~' are special. '|' means CR in <, > and k lines; and newline in ! lines. '~' means 0.4 second delay in < lines and bell in ! lines. (In > lines it means itself.) Also, in <, >, ! and k lines, `xx (backquote followed by two hex digits) expands to the specified character code. Letters in the hex number may be either case. There is no validity checking. `00 will terminate a > line. Also in < lines, ^ means break. To send a magic character, use its hex code with a backquote. The first line of the script file is the first three arguments as for TERM, space-delimited. In subsequent lines, the first character of each line is the command; the rest of the line (after the delimiting space) is argument(s). A final string argument may include spaces, and begins after the delimiting space. Blank lines are ignored. The command characters are as follows: ; Introduces comment; line ignored; space not required. : Label for conditional or unconditional goto. g