karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (09/28/88)
This is xcomm 2.2, which I mentioned in alt.bbs a few days ago. It was written originally to do Xmodem transfers by one Eric Coe about 3 years ago. larry gensch got a hold of it and more or less took it over last year, and added numerous features to it, most importantly CompuServe's B Protocol, including Quick B support. It now supports numerous configuration parameters, supports a small scripting language, is capable of automatic response to CServe-ish ENQ xfer requests, creates and respects HDB UUCP-style LCK files. It can be installed setuid-UUCP because the entry module now includes a setuid(getuid()) call before anything more than outbound line initialization takes place. Suggestions, improvements, bug fixes -> to me and I'll relay them to the author. Note that there is a file doc/script.future which describes the author's intended improvements. The next version (2.3 or 2.4, not sure which) is anticipated around the first of the year. --Karl #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # doc # This archive created: Tue Sep 27 17:13:20 1988 # By: Karl Kleinpaste (OSU) export PATH; PATH=/bin:$PATH if test ! -d 'doc' then echo shar: creating directory "'doc'" mkdir 'doc' fi echo shar: entering directory "'doc'" cd 'doc' echo shar: extracting "'historical.doc'" '(1432 characters)' if test -f 'historical.doc' then echo shar: will not over-write existing file "'historical.doc'" else sed 's/^X//' << \SHAR_EOF > 'historical.doc' X X X C O M M R E V I S I O N H I S T O R Y X X XVersion 2.2 larry gensch 14 Dec 87 Major code restructure X Reduced program and command options X Added SET command for setting various parameters X Added HANGUP command for disconnecting modem X Modified xccisb.c code to support CIS "Quick B" Protocol X Added xcscrpt.c code for processing script files X Added SCRIPT= parameter to phonebook processing (auto-logon scripts) X Added CIS parameter for CIS <ENQ> auto transfers X Added NL parameter for newline translation X Added HANGUP command from terminal mode X Added SCRIPT command from terminal mode X XVersion 2.1b larry gensch 11 Nov 87 Bug Fix release X (no bugs in the code, just some portability fixes) X Changed "sigset" in xccisb to "signal" X Removed #include <setjmp.h> from xcxmdm X XVersion 2.1a larry gensch 28 Oct 87 General Update X Added CIS "B" Protocol (c, ct commands) X Added BAUD= & BITS= parameters to phonelist file. X Switched some command letters X Revised command line parsing to use getopt() X XVersion 2.0 larry gensch 19 Oct 87 Revisions for System V.3 X Changed <sgtty> references to <termio> (modified ioctl(2) calls) X Changed terminal mode function keys to <ESC> sequences; added getconchr() X XVersion 1.1 Eric E Coe 21 Jul 85 X Autodial for Hayes-compatible modem. X General rearranging of the code X XVersion 1.0 Eric E Coe 12 Apr 85 X Program created SHAR_EOF if test 1432 -ne "`wc -c < 'historical.doc'`" then echo shar: error transmitting "'historical.doc'" '(should have been 1432 characters)' fi fi # end of overwriting check echo shar: extracting "'phonelist.doc'" '(1475 characters)' if test -f 'phonelist.doc' then echo shar: will not over-write existing file "'phonelist.doc'" else sed 's/^X//' << \SHAR_EOF > 'phonelist.doc' XFormat of the .phonelist file: X X1. The .phonelist must exist with the file name ".phonelist" either in the X current directory, or your home directory as defined by the $HOME X environment variable. The name of the phonelist file can be changed X using the SET PFILE command. X X2. The .phonelist file is ASCII text (lines of text separated by newlines). X It can be created and maintained using emacs, vi, or even ed. X X3. The first field of data in each line (after any whitespace and up to the X next occurance of whitespace) is assumed to be a phone number in a valid X format for the modem being dialed. X X4. Any text may follow the phone number. X X5. Special strings within each line: X X BITS=x (x=7|8) - Set the terminal mode mask to 7/8 bits. X BAUD=nnnn (n=300|1200|2400|4800|9600) - Set the baud rate to the X specified value X SCRIPT=file Immediately after sending the autodial string, execute the X script file specified. (Note that the specified filename is X CASE SENSITIVE!) X X6. A sample entry is shown below: X X 687-0374 CompuServe BITS=7 BAUD=1200, SCRIPT=cis.cmd X X The above entry indicates that the number to be dialed is 687-0374; the X bit mask is to be set to seven bits (ignore high bits), the baud rate is X to be set to 1200 baud, and commands are to be taken from the file X "compusrv.cmd" in either the current or home directory. X X A sample .phonelist file is included in the XCOMM source code X distribution. SHAR_EOF if test 1475 -ne "`wc -c < 'phonelist.doc'`" then echo shar: error transmitting "'phonelist.doc'" '(should have been 1475 characters)' fi fi # end of overwriting check echo shar: extracting "'read.me'" '(1528 characters)' if test -f 'read.me' then echo shar: will not over-write existing file "'read.me'" else sed 's/^X//' << \SHAR_EOF > 'read.me' XXCOMM 2.2: X XNew in this release... X X* Modified XCOMM command line interface X* CIS "Quick B" Protocol support for faster up/downloads X* Brand new script processor with integration into the phonebook X* Some code cleanup X* Better "vanilla" Unix support (thanks to bug reports) X XRefer to "historical.doc" for a list of ALL new features. X XXCOMM is a PUBLIC DOMAIN (not shareware) communication program that works on XUnix System V.3. It probably works on other Unix systems with no Xmodification, since no machine specific coding was done. X XXCOMM is distributed in two bundles: X XXCM22DOC.SH All documentation for XCOMM XXCM22SRC.SH All source code, header files, and makefile. X XThis README manifest file is included in both packages. X XContents of XCM22DOC.SH: X Xreadme This manifest file Xscript.doc Quick reference to the XCOMM script language Xxcomm.doc Latest documentation for the XCOMM program Xhistorical.doc Historical information about versions 1.0 and 1.1 Xphonelist.doc Documentation on using XCOMM's phonelist X X XContents of XCM22SRC.SH: X Xreadme This manifest file Xinstall.doc Quick installation notes XMakefile Make file for compiling XCOMM Xxcomm.h XCOMM's header file Xxcomm.c XCOMM main program Xxccisb.c XCOMM CIS-B/QuickB protocol module Xxcport.c XCOMM Terminal I/O module Xxcscrpt.c XCOMM Script processor Xxcsubs.c XCOMM's subroutines Xxcterm.c XCOMM Terminal mode module Xxcxmdm.c XCOMM XMODEM protocol module Xcis.cmd A sample XCOMM script file for logging onto CompuServe. X.phonelist A sample Phone List file SHAR_EOF if test 1528 -ne "`wc -c < 'read.me'`" then echo shar: error transmitting "'read.me'" '(should have been 1528 characters)' fi fi # end of overwriting check echo shar: extracting "'script.doc'" '(7145 characters)' if test -f 'script.doc' then echo shar: will not over-write existing file "'script.doc'" else sed 's/^X//' << \SHAR_EOF > 'script.doc' X X XCOMM SCRIPT QUICK REFERENCE X XCOMM Release 2.2 X X X XIntroduction X X Script files can automate some tedious tasks such as logging into a X system. A script file is an Ascii text file and may be entered or X edited using any standard Unix text editor. X X The script file is read line by line. Empty lines (consisting of white X space only) are ignored. Comments are lines whose first non-space X character is a pound sign (#). X X The script processor reads each script line, ignoring leading white X space, into "words". A word is defined as either: X X - A sequence of characters delimited by white space; or X - A sequence of characters enclosed in single or double quotes. X X The first word of a script file is considered the "command word." X If the last character of the command word is a colon (:), the line is X considered to be a LABEL (the object of a GOTO statement). Otherwise, X it is assumed to be a script command and is interpreted as such. X Command words are case insensative. X X Some commands take one or more arguments. Each argument is parsed as a X single word as defined above. If blanks are required in an argument, X the argument MUST be quoted using single or double quotes. X X Enclosed in the XCOMM distribution is the file "compusrv.cmd". This is X an example script file (No, that is not really my user ID or my X password in that file!), and shows the use of most of the available X script commands. The script commands are self explanatory for the most X part. X X XStartup Scripts X X When XCOMM is started up, it looks for the file ".xcomm" in the current X or $HOME directory. If it is found, it is executed. This is useful for X setting your "basic" parameters without having to recompile XCOMM. For X example, your startup file may turn CIS <ENQ> mode off, set your baud X rate to 9600, and set 7BIT translation. X X XScript Command List X X Below is the description of all commands that may be used in the XCOMM X script language: X X XCAPTURE ON|OFF X X The command CAPTURE ON will open the capture command; all characters X received during WAITFOR processing will be appended to the capture file. X The command CAPTURE OFF will close the capture file. X X This setting does NOT currently extend to terminal mode. This may be X offered in a later release (probably through the SET command). X X XDIAL <number> X X Dial the specified number. XCOMM supports generic "Hayes" compatible X modems for dialing. Note that this command requires an actual phone X number; the phonebook is not used for this function. X X XECHO ON|OFF X X If the argument to the ECHO command is ON, all subsequent command lines X that are processed will be displayed on the local screen. The exception X to this is lines containing a TRANSMIT command. These lines will just X print "TRANSMIT ...", so that passwords, etc. can be protected. X X If the argument to the ECHO command is OFF, scripts will execute X quietly (this is the default setting). X X XEXIT X X Terminate the script file prior to the end of file. Returns to terminal X mode. X X XGOTO <label> X X Go to the specified label in the script file and continue execution from X that point. The label may either precede or follow the actual GOTO X statement. X X XIF <condition> X <statements> X[ ELSE X statements ] XENDIf X X Conditionally execute statements based on specified condition. XCOMM X supports the following conditions: X X WAITFOR TRUE if the last WAITFOR command was successful X LINKED TRUE if this script was executed from the phonebook X X Conditions may be negated using the prefix NOT or the character "!": X X !WAITFOR TRUE If the last WAITFOR command timed out X NOT WAITFOR Same as !WAITFOR above X X The ELSE and ENDIF keywords must appear on their own lines. IF X statements may not be nested. X X XPAUSE <time> X X Suspend execution of the script for the specified number of seconds. X This is usually used for timing considerations; for example, waiting a X couple of seconds after receiving the CONNECT message and typing ^C to X CompuServe. X X XQUIT X X Terminate the script AND the XCOMM program (return to the shell). X X XREDIAL X X Redial the last number dialed using the DIAL command OR the phonebook. X X XSET <parameter> <value> X X Sets the specified parameter to the specified value. The SET parser X used in command mode is used, and the parameters/values are identical. X Refer to the main documentation for information on the SET command. X X During script processing, internal status messages are NOT displayed on X the local terminal (eg, SET 7BIT ON in a script file does not display X the new value on the terminal). This may be changed in the future X (probably tied to the ECHO setting). X X During script processing, specifying SET alone is an ERROR... there is X no way currently display the current status of the SET-able parameters X during script processing. X X XTRANSMIT <text> X X Transmit the specified text to the remote. The text argument should be X quoted (using single or double quotes) if there are spaces to be X transmitted. The text is transmitted AS IS (no case conversions are X performed). X X Prefix characters: X X ^ Control character prefix - The next character is made into a X control character. X For example: ^M = RETURN (0x0D); ^J = NEWLINE (0x0A). X X \ Quote prefix - The next character is transmitted verbatim. For X example, \^ would transmit a literal ^. X X XTTY ON|OFF X X The TTY command specifies whether or not characters received from the X modem will be displayed on the local terminal. Since the only time that X the script processor looks at the receive queue is during WAITFOR X processing, the displays may look a bit erratic. X X Use the TTY OFF command to disable local display of received characters X during script processing. X X XWAITFOR <text> [timeout] X X Wait for the specified text to appear from the modem. The text argument X should be quoted (using single or double quotes) if there are spaces to X be transmitted. X X Special characters are interpreted the same as for TRANSMIT. X X If the timeout argument is specified, XCOMM will wait that number of X seconds for the string to appear. If no timeout is given, XCOMM X defaults to 30 seconds. X X During WAITFOR processing, characters received (up to and including the X last character found in the text or in the timeout) can be captured to a X disk file (if CAPTURE ON was specified), and/or displayed to the screen X (if TTY ON was specified). X X XNotes to Next Release: X X In the next release (2.4?), the script processor will support ALL X command mode options, including xmodem send and receive, CIS transfers, X local dump to terminal mode and back to script, shell commands, PUT and X TAKE, plus a DIVERT command to transmit the contents of a data file X through the modem (similar to the terminal mode <ESC> F command). X X I am always open to reasonable suggestions for improvements to the XCOMM X program and its script language. SHAR_EOF if test 7145 -ne "`wc -c < 'script.doc'`" then echo shar: error transmitting "'script.doc'" '(should have been 7145 characters)' fi fi # end of overwriting check echo shar: extracting "'script.future'" '(8036 characters)' if test -f 'script.future' then echo shar: will not over-write existing file "'script.future'" else sed 's/^X//' << \SHAR_EOF > 'script.future' XI am currently working on a new release of my terminal program. It is Xbasically a script language that is able to pump data to and from the modem. XThe following grammar has been developed from most of the requests that I have Xgotten. X XNote that this is not a formal grammar, and "yacc" is not going to be used to Xgenerate the parser. This is basically due to the reason that yacc is a X"compiler-compiler" and not an "interpreter-compiler". X X----- XScript statements: X Xalias _token _string <-- Assign string to token Xassign _var _string <-- Assign string to variable Xbreak <-- Exit statement loop Xcontinue <-- Return to top of statement loop Xdefine _string _statement <-- Define terminal mode escape Xdial _phoneno <-- Dial specified phone number Xdownload _filelist <-- Download specified file(s) Xecho _string <-- Send _string to console Xeval _statement <-- Evaluate macro string and execute Xexecute _file <-- Execute named script file Xexit <-- Terminate script Xgoto _label <-- Goto label Xif _cond _statement X [else _statement] <-- Conditional execution of statments Xmessage _string <-- Put string into log file Xpipe _file <-- Execute shell script redirected Xpurge <-- Purge modem input buffer Xquit <-- Terminate xcterm Xredial <-- Redial last phone number Xrepeat _num _statement <-- Repeat macro num times Xsend _file <-- Send file through modem Xset _setcmd _value <-- Set specified setting Xshell _file <-- Execute shell script Xsleep _num <-- Pause num seconds Xstatus <-- Display status settings Xtransmit _string <-- Transmit string through modem Xunassign _var <-- Remove variable from memory Xupload _filelist <-- Upload specified file(s) Xwaitfor _string <-- Wait for string to arrive from modem Xwatchfor _string _statement <-- Perform macro asynchronously Xwhile _cond _statement <-- Perform macro while cond true X X----- XSet commands: X Xset arg _string <-- Set file xfer argument(s) Xset capture _onoff <-- Set capture to diskfile on/off Xset cfile _file <-- Capture file Xset conmsg _string <-- Connect message from modem Xset ctime _num <-- Number of secs to wait for connect Xset console _file <-- Set console device (appended) Xset dialp _string <-- Auto dial prefix Xset dials _string <-- Auto dial suffix Xset dribble _num <-- "send" delay (secs) after newline Xset inpfile _file <-- Set input file for inchar/input Xset lfile _file <-- Logging file Xset logging _onoff <-- Logging on/off Xset mask _onoff <-- 7bit mask on/off Xset modem _file <-- Modem device Xset nl _nlstr <-- Newline translation Xset parity _parstr <-- Parity Xset pfile _file <-- Phonelist file Xset protocol _code <-- Current protocol Xset terminal _onoff <-- Turn on/off terminal mode Xset tescape _num <-- Nbr of secs to wait for term escape Xset trace _onoff <-- Script debug tracing on/off Xset unattend _onoff <-- Unattended operation (no console) Xset word _num <-- Word size (5,6,7,8) Xset timeout _num <-- Number of seconds for WAITFOR Xset xlate _file <-- Defines a display translation file Xset xon _onoff <-- XON/XOFF on/off X X----- XVariables: Variables are allowed anywhere except as the first token in a Xstatement (use the "eval" command to evaluate commands in variables). The Xgetenv()/putenv() subroutines will be used to store/retrieve user-defined Xvariables, making them accessible to child shells. Due to their placement Xin the environment, it is encouraged that all user-defined variables be set Xto ALL CAPS. In addition to user-defined variables, the following variables Xare available (but will NOT be stored in the environment): X X$? <-- Last shell/protocol return code X$file <-- Current script file (- = console) X$lineno <-- Current line number (0 console) X$time <-- Current time X$_setcmd <-- Value of SET keyword (eg, $cfile) X X----- XFunctions: X Xsubstr(_var, _num, _subp2) <-- Substr of _var from p1 for p2 chars Xnum(_var) <-- Numeric equivalent of _var Xkbd(_num) <-- num chars from keyboard Xlength(_var) <-- Length of variable Xline <-- Chars from keyboard until newline X X----- XConditions: X X( _value _relop _value ) <-- True if relation true X! _cond <-- Negates condition Xattended <-- True if console == /dev/tty Xconnected <-- True if last dial successful Xexists _file <-- True if file exists Xnot _cond <-- Negates condition Xprotocol _code <-- True if protocol available Xwaitfor <-- True if last waitfor successful X X----- XToken values: X X_code <-- [a-z]* X_file <-- [^ ]* X_filelist <-- _file(,_file)* X_nlstr <-- OFF | CR | LF | CRLF X_num <-- [0-9]* X_onoff <-- ON | OFF X_parstr <-- EVEN | ODD | NONE | MARK | SPACE X_relop <-- == | < | <= | > | >= | != | <> X_string <-- \"[^\"]*\" X_statement <-- Valid statement X_phoneno <-- [-0-9]* X_value <-- _string | _num X_label <-- [a-z]*: X X----- X XNote that statements that refer to statements (eg, "if", "while"), allow Xstatements to be grouped as in the C programming language by using brackets {} Xaround the block of statements. X X----- XFile transfers: X XA new file, ".xfer" in the current or $HOME directory will be used to specify Xfile transfer agents used within the program. Basically, each available Xprotocol will be assigned an identifier, which will be made current using the X"set protocol" command. File transfer agents are separately compiled programs X(such as rz/sz) that use stdin/stdout to communicate with the remote system. X XValid statements within the .xfer file are: X Xassign _code _string <-- Assign name of an external protocol to _code Xrfile _code _string <-- Specify the command line to receive a file Xsfile _code _string <-- Specify the command line to transmit a file Xrtrig _code _string <-- Set a terminal "watchfor" receive trigger Xstrig _code _string <-- Set a terminal "watchfor" transmit trigger X XDuring program operation, a protocol is made current using the "set protocol X_code" command. X XSpecial note regarding file transfers: The occurance of the special character X"$" indicates the substitution of a variable. The value of the specified Xvariable will be substitued for the variable's reference (this will not occur Xif the "$" is quoted with a backslash). If no value of the variable is Xavailable and the "set unattend" has not been set on, the variable's value will Xbe requested interactively. If "set unattend" has been set on, no value will Xbe requested, and the variable's reference will be deleted from the string. X XFor example, assume the following .xfer file is used: X X assign zmodem "Zmodem File Transfer" X rfile zmodem "rz -y" X sfile zmodem "sz -y $FILES" X XThe action from the following commands is show below: X X set unattend off <-- defaul value X X download <-- The program "rz" is executed immediately X X upload <-- Program does not execute "sz" immediately X ** Enter FILES: _ <-- Value of $FILES is requested X <-- Program "sz" is then executed X X assign $FILES "file.1" <-- Assigns $FILES a value X upload <-- The program "sz" is executed immedately X XAlso note that when the new program is distributed, a new version of the CIS XQuick B protocol driver will be distributed as well (under its own name). The Xprogram will have a sample .xfer file that implements "rz/sz" and "quickb". X X----- XNote that this new script language is not exactly compatible with that used in XXCOMM 2.2. This was intentional, as more functionality was added. X XAlso note that this list is meant to be demonstrative and not exhaustive. XThere are probably some tokens that are not defined, and maybe a "type-o" or Xtwo. Basically, this is here to generate comments on things I may be missing Xor directions I may be heading. X XComments regarding this document are welcome. Send comments through Compuserve Xvia Unixforum or EASYPLEX to larry gensch at [72236,3516]. SHAR_EOF if test 8036 -ne "`wc -c < 'script.future'`" then echo shar: error transmitting "'script.future'" '(should have been 8036 characters)' fi fi # end of overwriting check echo shar: extracting "'xcomm.doc'" '(9420 characters)' if test -f 'xcomm.doc' then echo shar: will not over-write existing file "'xcomm.doc'" else sed 's/^X//' << \SHAR_EOF > 'xcomm.doc' XXCOMM is a public domain terminal program that currently features X Xo XMODEM and CIS "QuickB" file transfers with optional "text" translation Xo Hayes Modem dialing directory with BAUD and BIT parameters Xo Unix CU compatible PUT and TAKE commands Xo Simple HOST communication mode Xo Communication scripting with optional linkage from phone directory. X XXCOMM is offerred free of charge with NO requests for financial compensation Xreqested (this is public domain, not shareware). The source code may be Xused or modified by anyone, but this code, or derivations of this code, Xmay not be sold by anyone to anyone. X XDocumentation on the SCRIPT language and the XCOMM Phone directory is Xcontained in separate files. X X XXCOMM Command Summary X--------------------- X XXCOMM prompts for commands using the string: X X XCOMM> X XWith version 2.2, XCOMM supports the following commands: X X Xc X XInitiate CIS QuickB File Transfer. This command is used for both uploading and Xdownloading from CompuServe. X X Xg file X XExecute the XCOMM script file "file". Returns to terminal mode when the Xscript is complete. X X Xrb file Xrt file X XXMODEM receive (rb = binary mode; rt = text mode). Receive the specified Xfile from the remote system. X X Xsb file Xst file X XXMODEM transmit (sb = binary mode; st = text mode). Transmit the specified Xfile to the remote system. X X Xset X XDisplay or set the transmission parameters used by the XCOMM program. Refer Xto the SET section of this document. X X Xt X XEnter terminal mode. Refer to the TERMINAL section of this document. X X Xx X XExit program. Return to invoking program/shell. X X X! <cmd> X XExecute the specified command as a child process. If <cmd> is ommitted, Xexecute a local interactive shell. X X X!! X XRe-execute the last shell command string. X X X$ X XExecute a shell command with stdin and stdout redirected to the modem port. XThis effectively puts the computer into a "host" mode. X X X%p file X XTransmit a file (put) to a remote Unix system. This command uses standard Unix Xutilities on the other end. X X X%t file X XReceive a file (take) from a remote Unix system. This command uses standard XUnix utilities on the other end. X X X? X XPrint a short XCOMM command summary. X X X XFile Transfers - Text and Binary Modes X-------------------------------------- X XWhen transferring files using the XMODEM protocol, the file mode is Xspecified int the upload/download command. A "Text" file transfer enables Xspecial translation of the transmitted or received file to support CP/M and XMS-DOS end of line characters. When transmitting a file using text mode, Xall newlines are converted to carriage-return, newline sequences. When Xreceiving a file using text mode, all carriage-return, newline sequences are Xconverted to a single newline. A "binary" file transfer transmits the file X"as is" without any conversion. X XWhen transferring files using CompuServe QuickB protocol, the format of the Xfile is specified by the host. An "Ascii" file will force XCOMM to perform Xtext-mode translation; a "binary" file will turn off any translation. X X XUsing the SET Command X--------------------- X XThe SET command is used to display and set/reset XCOMM's tunable parameters. XThe usage is shown below: X X(1) set X X Display XCOMM's current parameters. X X X(2) set 7bit X set 8bit X set crc X set chk X set term X set cmd X set cr X set nl X X Set the indicated parameter: X X 7bit Modem high-bit masking. All characters received from the X modem are masked so their values are between 0 and 127. X This is useful for remote systems that transmit parity X characters (the parity is ignored). X X 8bit Disable Modem high-bit masking. All characters received X from the modem are displayed verbatim. X X crc Set XMODEM CRC protocol. All transferred blocks use a X 16-bit block check, which is more reliable than the older X "checksum" block check. X X chk Set XMODEM Checksum protocol. All transferred blocks use an X 8-bit block check, which is not as reliable as the CRC X block check, but is compatible with older programs using X XMODEM. X X term Set auto-jumpback to terminal mode after all file transfers. X X cr Set newline translation mode (in terminal mode, all newlines X will be translated to carriage returns). X X nl Set carriage return mode (in terminal mode, all newlines are X sent as newlines; carriage returns are sent as carriage X returns.) X X The above parameters are paired; that is, the "crc" parameter is X negated by the "chk" parameter. X X XMODEM Transfers: When using "crc" protocol on a transmit, the XCOMM X program will fall back to "checksum" block checks if the receiving X program does not support the special "crc" handshake. X X(3) set cis on|off X set mung on|off X set purge on|off X set xoff on|off X set baud <value> X set cfile name X set pfile name X X cis Set CompuServe <ENQ> file transfer requests. An "on" value X specifies that when in terminal mode, an <ENQ> character X will perform an automatic CIS QuickB protocol transfer. X This parameter should be set "off" when not connected to X CompuServe, as phone line noise may cause a bogus file X transfer request. X X mung Set file overwrite flag. If "on", files may be overwritten X when receiving data files. If "off", files will not be X overwritten (will cause an error message to be displayed). X X purge Set Bad Telephone Line Purge mode. If "on", removes X spurious characters received through the phone line due to X noise before listening for an acknowledgement. This X increases the amount of time spent transmitting each block, X but can improve throughput overall by reducing the number of X block retransmissions. X X xoff Set XON/XOFF flow control flag. If "on", the program will X honor the XOFF control character and wait until an XON X character is received before transmitting any more X information. If "off", the program will ignore XOFF/XON X requests. X X baud Set the desired baud rate. Supported baud rates are 300, X 1200, 2400, 4800, and 9600 baud. X X cfile Set the name of the terminal mode capture file to "name". X X pfile Set the name of the terminal mode phonelist file to "name". X X XA sample "set" command status display is shown below: X X Modem port is '/dev/tty00'. X Speed is 1200 baud. X Seven-bit communication mask enabled. X XMODEM CRC protocol enabled. X Extra bad telephone line purging enabled. X Capture save file is 'capture.log'. X Phone number file is '.phonelist'. X XON/XOFF Flow control is OFF. X CIS <ENQ> Auto Download is ON. X Newline translation mode is active. X X XTERMINAL Mode operation X----------------------- X XIn terminal mode, all characters typed at the keyboard are sent to the Xmodem; all characters received from the modem are displayed on the local Xterminal screen. X XNewline characters (0x0A) are translated to carriage returns (0x0D) when XNewline mode is active. X XWhen the ESC key is typed in terminal mode, the program will examine the Xnext key pressed. If it is a special command function, that function will Xbe performed; otherwise, the second character is sent to the modem. Thus, Xto send an ESC character through the modem, it is necessary to press the Xkey TWICE. X XSupported ESC commands: X XESC d Dial Select a phone number and dial it. X XESC f send File Send a file through the modem (ascii transfer). An X option is available for waiting after each line is X sent to avoid overrunning the remote systems input X buffer. X XESC g script (GO) Execute a script file. X XESC h Hangup Disconnect from the remote system. X XESC t Toggle capture Toggle capture file - If the file is not open, it is X opened in APPEND mode (text receive accumulates at X the end of the file). If the file is already open, X it is closed, instead. X XESC x eXit Exit terminal mode back to XCOMM command mode. X X X XXCOMM Command Line switches X--------------------------- X X-l device X X (Line option) Specifies the path name to be used for the modem device. X This overrides the value of the MODEM environment variable. X X Note that if the MODEM environment variable is not set, the -l Line option X is mandatory. X X The MODEM environment variable is used as the default path name to be used X for the modem device. If this environment variable is not set, the -l X Line option is mandatory. X X The MODEM variable is usually set in a shell profile. In the Bourne X shell, this is placed in the .profile file of your home directory with X statements similar to that shown below: X X export MODEM; set MODEM="/dev/tty00" X X (assuming your modem device is /dev/tty00). Using the C Shell, the X following statement may be place in .cshrc in your home directory: X X setenv MODEM "/dev/tty00" X X X-g file X X (GO option) Specifies a script to be executed as soon as XCOMM is finished X initializing. X X X-t X X (Terminal option) Directs XCOMM to jump directly into terminal mode after X initializing. X X XEntering XCOMM with an invalid option will display a summary of the valid Xoptions supported. X X XBUG REPORTS, ENHANCEMENTS, ETC... X--------------------------------- X XMy electronic addresses are: X XCompu$erve: [72236,3516] (UNIXFORUM) XDelphi: larryg XBix: lar3ry XAndover CNode: larry gensch X (This is a FIDO BBS dedicated to C Language X programming - phone number (617) 470-2548) SHAR_EOF if test 9420 -ne "`wc -c < 'xcomm.doc'`" then echo shar: error transmitting "'xcomm.doc'" '(should have been 9420 characters)' fi fi # end of overwriting check echo shar: done with directory "'doc'" cd .. # End of shell archive exit 0
gareth@ufnmr.UUCP (Gareth J. Barker) (10/01/88)
After compiling the recently posted 'xcomm' source I merged the 'xcomm' documentation into a NROFF/TROFF file suitable for accessing with the 'man' command, and thought this might be of use to others. (You will probably want to change the line about which port the modem is on. Search for the string 'GJB' to find the line I'm talking about). Gareth J. Barker, INTERNET : ufnmr!gareth@BIKINI.CIS.UFL.EDU UUCP : ...gatech!uflorida!ufnmr!gareth #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: /usr/man/manl/xcomm.l # Wrapped by gareth@ufnmr_1 on Fri Sep 30 14:55:01 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'xcomm.l' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xcomm.l'\" else echo shar: Extracting \"'xcomm.l'\" \(17103 characters\) sed "s/^X//" >'xcomm.l' <<'END_OF_FILE' X.TH XCOMM 1L "29 Oct 1988" Local LOCAL X.SH NAME Xxcomm \- X-modem communications program X.SH SYNOPSIS X.B xcomm X[ X.B \-options X] X.SH OPTIONS X.IP "-l device" X(Line option) Specifies the path name to be used for the modem device. XThis overrides the value of the MODEM environment variable. X.LP XNote that if the MODEM environment variable is not set, the -l Line option Xis mandatory. X.LP XThe MODEM environment variable is used as the default path name to be used Xfor the modem device. If this environment variable is not set, the -l XLine option is mandatory. (/dev/cua0 is the correct line for the Xmodem on "ufnmr" - GJB). X.LP XThe MODEM variable is usually set in a shell profile. In the Bourne Xshell, this is placed in the .profile file of your home directory with Xstatements similar to that shown below: X.sp X export MODEM; set MODEM="/dev/tty00" X.sp X(assuming your modem device is /dev/tty00). Using the C Shell, the Xfollowing statement may be place in .cshrc in your home directory: X.sp X setenv MODEM "/dev/tty00" X.IP "-g file" X(GO option) Specifies a script to be executed as soon as \fIxcomm\fP is finished Xinitializing. X.IP -t X(Terminal option) Directs \fIxcomm\fP to jump directly into terminal mode after Xinitializing. X.LP XEntering \fIxcomm\fP with an invalid option will display a summary of the valid Xoptions supported. X.SH DESCRIPTION X.LP X\fIXcomm\fP is a public domain terminal program that currently features X.sp Xo XMODEM and CIS "QuickB" file transfers with optional "text" translation X.br Xo Hayes Modem dialing directory with BAUD and BIT parameters X.br Xo Unix CU compatible PUT and TAKE commands X.br Xo Simple HOST communication mode X.br Xo Communication scripting with optional linkage from phone directory. X.LP X\fIXcomm\fP is offerred free of charge with NO requests for financial compensation Xreqested (this is public domain, not shareware). The source code may be Xused or modified by anyone, but this code, or derivations of this code, Xmay not be sold by anyone to anyone. X.SH "COMMAND SUMMARY" X.LP X\fIXcomm\fP prompts for commands using the string: X.sp X XCOMM> X.sp XWith version 2.2, \fIxcomm\fP supports the following commands: X.IP c XInitiate CIS QuickB File Transfer. This command is used for both uploading and Xdownloading from CompuServe. X.IP "g file" XExecute the \fIxcomm\fP script file "file". Returns to terminal mode when the Xscript is complete. X.IP "rb file" X.IP "rt file" XXMODEM receive (rb = binary mode; rt = text mode). Receive the specified Xfile from the remote system. X.IP "sb file" X.IP "st file" XXMODEM transmit (sb = binary mode; st = text mode). Transmit the specified Xfile to the remote system. X.IP set XDisplay or set the transmission parameters used by the \fIxcomm\fP program. Refer Xto the SET section of this document. X.IP t XEnter terminal mode. Refer to the TERMINAL section of this document. X.IP x XExit program. Return to invoking program/shell. X.IP "! <cmd>" XExecute the specified command as a child process. If <cmd> is ommitted, Xexecute a local interactive shell. X.IP "!!" XRe-execute the last shell command string. X.IP $ XExecute a shell command with stdin and stdout redirected to the modem port. XThis effectively puts the computer into a "host" mode. X.IP "%p file" XTransmit a file (put) to a remote Unix system. This command uses standard Unix Xutilities on the other end. X.IP "%t file" XReceive a file (take) from a remote Unix system. This command uses standard XUnix utilities on the other end. X.IP ? XPrint a short \fIxcomm\fP command summary. X.SH "FILE TRANSFERS - TEXT AND BINARY MODES" X.LP XWhen transferring files using the XMODEM protocol, the file mode is Xspecified int the upload/download command. A "Text" file transfer enables Xspecial translation of the transmitted or received file to support CP/M and XMS-DOS end of line characters. When transmitting a file using text mode, Xall newlines are converted to carriage-return, newline sequences. When Xreceiving a file using text mode, all carriage-return, newline sequences are Xconverted to a single newline. A "binary" file transfer transmits the file X"as is" without any conversion. X.LP XWhen transferring files using CompuServe QuickB protocol, the format of the Xfile is specified by the host. An "Ascii" file will force \fIxcomm\fP to perform Xtext-mode translation; a "binary" file will turn off any translation. X.SH "THE SET COMMAND" X.LP XThe SET command is used to display and set/reset \fIxcomm\fP's tunable parameters. XThe usage is shown below: X.IP (1) set XDisplay \fIxcomm\fP's current parameters. X.IP (2) Xset 7bit X.br Xset 8bit X.br Xset crc X.br Xset chk X.br Xset term X.br Xset cmd X.br Xset cr X.br Xset nl X.LP XSet the indicated parameter: X.RS +0.5i X.IP 7bit XModem high-bit masking. All characters received from the Xmodem are masked so their values are between 0 and 127. XThis is useful for remote systems that transmit parity Xcharacters (the parity is ignored). X.IP 8bit XDisable Modem high-bit masking. All characters received Xfrom the modem are displayed verbatim. X.IP crc XSet XMODEM CRC protocol. All transferred blocks use a X16-bit block check, which is more reliable than the older X"checksum" block check. X.IP chk XSet XMODEM Checksum protocol. All transferred blocks use an X8-bit block check, which is not as reliable as the CRC Xblock check, but is compatible with older programs using XXMODEM. X.IP term XSet auto-jumpback to terminal mode after all file transfers. X.IP cr XSet newline translation mode (in terminal mode, all newlines Xwill be translated to carriage returns). X.IP nl XSet carriage return mode (in terminal mode, all newlines are Xsent as newlines; carriage returns are sent as carriage Xreturns.) X.LP XThe above parameters are paired; that is, the "crc" parameter is Xnegated by the "chk" parameter. X.LP XXMODEM Transfers: When using "crc" protocol on a transmit, the \fIxcomm\fP Xprogram will fall back to "checksum" block checks if the receiving Xprogram does not support the special "crc" handshake. X.RS -0.5i X.IP (3) Xset cis on|off X.br Xset mung on|off X.br Xset purge on|off X.br Xset xoff on|off X.br Xset baud <value> X.br Xset cfile name X.br Xset pfile name X.RS +0.5i X.IP cis XSet CompuServe <ENQ> file transfer requests. An "on" value Xspecifies that when in terminal mode, an <ENQ> character Xwill perform an automatic CIS QuickB protocol transfer. XThis parameter should be set "off" when not connected to XCompuServe, as phone line noise may cause a bogus file Xtransfer request. X.IP mung XSet file overwrite flag. If "on", files may be overwritten Xwhen receiving data files. If "off", files will not be Xoverwritten (will cause an error message to be displayed). X.IP purge XSet Bad Telephone Line Purge mode. If "on", removes Xspurious characters received through the phone line due to Xnoise before listening for an acknowledgement. This Xincreases the amount of time spent transmitting each block, Xbut can improve throughput overall by reducing the number of Xblock retransmissions. X.IP xoff XSet XON/XOFF flow control flag. If "on", the program will Xhonor the XOFF control character and wait until an XON Xcharacter is received before transmitting any more Xinformation. If "off", the program will ignore XOFF/XON Xrequests. X.IP baud XSet the desired baud rate. Supported baud rates are 300, X1200, 2400, 4800, and 9600 baud. X.IP cfile XSet the name of the terminal mode capture file to "name". X.IP pfile XSet the name of the terminal mode phonelist file to "name". X.RS -0.5i X.LP XA sample "set" command status display is shown below: X.sp X.RS +0.5i XModem port is '/dev/tty00'. X.br XSpeed is 1200 baud. X.br XSeven-bit communication mask enabled. X.br XXMODEM CRC protocol enabled. X.br XExtra bad telephone line purging enabled. X.br XCapture save file is 'capture.log'. X.br XPhone number file is '.phonelist'. X.br XXON/XOFF Flow control is OFF. X.br XCIS <ENQ> Auto Download is ON. X.br XNewline translation mode is active. X.sp X.RS -0.5i X.SH "TERMINAL MODE" X.LP XIn terminal mode, all characters typed at the keyboard are sent to the Xmodem; all characters received from the modem are displayed on the local Xterminal screen. X.LP XNewline characters (0x0A) are translated to carriage returns (0x0D) when XNewline mode is active. X.LP XWhen the ESC key is typed in terminal mode, the program will examine the Xnext key pressed. If it is a special command function, that function will Xbe performed; otherwise, the second character is sent to the modem. Thus, Xto send an ESC character through the modem, it is necessary to press the Xkey TWICE. X.LP XSupported ESC commands: X.IP "ESC f send File" XSend a file through the modem (ascii transfer). An Xoption is available for waiting after each line is Xsent to avoid overrunning the remote systems input Xbuffer. X.IP "ESC g script (GO)" XExecute a script file. X.IP "ESC h Hangup" XDisconnect from the remote system. X.IP "ESC t Toggle capture" XToggle capture file - If the file is not open, it is Xopened in APPEND mode (text receive accumulates at Xthe end of the file). If the file is already open, Xit is closed, instead. X.IP "ESC x eXit" XExit terminal mode back to \fIxcomm\fP command mode. X.SH "PHONELIST" XThe .phonelist must exist with the file name ".phonelist" either in the Xcurrent directory, or your home directory as defined by the $HOME Xenvironment variable. The name of the phonelist file can be changed Xusing the SET PFILE command. X.LP XThe .phonelist file is ASCII text (lines of text separated by newlines). XIt can be created and maintained using emacs, vi, or even ed. XThe first field of data in each line (after any whitespace and up to the Xnext occurance of whitespace) is assumed to be a phone number in a valid Xformat for the modem being dialed. XAny text may follow the phone number. X.LP XSpecial strings within each line: X.br XBITS=x (x=7|8) - Set the terminal mode mask to 7/8 bits. X.b XrBAUD=nnnn (n=300|1200|2400|4800|9600) - Set the baud rate to the Xspecified value X.br XSCRIPT=file Immediately after sending the autodial string, execute the Xscript file specified. (Note that the specified filename is XCASE SENSITIVE!) X.sp XA sample entry is shown below: X.sp X687-0374 CompuServe BITS=7 BAUD=1200, SCRIPT=cis.cmd X.sp XThe above entry indicates that the number to be dialed is 687-0374; the Xbit mask is to be set to seven bits (ignore high bits), the baud rate is Xto be set to 1200 baud, and commands are to be taken from the file X"compusrv.cmd" in either the current or home directory. X.LP XA sample .phonelist file is included in the \fIxcomm\fP source code Xdistribution. X.SH "XCOMM SCRIPT LANGUAGE" X.LP XScript files can automate some tedious tasks such as logging into a Xsystem. A script file is an Ascii text file and may be entered or Xedited using any standard Unix text editor. X.LP XThe script file is read line by line. Empty lines (consisting of white Xspace only) are ignored. Comments are lines whose first non-space Xcharacter is a pound sign (#). X.LP XThe script processor reads each script line, ignoring leading white Xspace, into "words". A word is defined as either: X.sp X- A sequence of characters delimited by white space; or X.br X- A sequence of characters enclosed in single or double quotes. X.sp X.LP XThe first word of a script file is considered the "command word." XIf the last character of the command word is a colon (:), the line is Xconsidered to be a LABEL (the object of a GOTO statement). Otherwise, Xit is assumed to be a script command and is interpreted as such. XCommand words are case insensative. X.LP XSome commands take one or more arguments. Each argument is parsed as a Xsingle word as defined above. If blanks are required in an argument, Xthe argument MUST be quoted using single or double quotes. X.LP XEnclosed in the \fIxcomm\fP distribution is the file "compusrv.cmd". This is Xan example script file (No, that is not really my user ID or my Xpassword in that file!), and shows the use of most of the available Xscript commands. The script commands are self explanatory for the most Xpart. X.SH "STARTUP SCRIPTS" X.LP XWhen \fIxcomm\fP is started up, it looks for the file ".xcomm" in the current Xor $HOME directory. If it is found, it is executed. This is useful for Xsetting your "basic" parameters without having to recompile \fIxcomm\fP. For Xexample, your startup file may turn CIS <ENQ> mode off, set your baud Xrate to 9600, and set 7BIT translation. X.SH "SCRIPT COMMAND LIST" X.IP "CAPTURE ON|OFF" XThe command CAPTURE ON will open the capture command; all characters Xreceived during WAITFOR processing will be appended to the capture file. XThe command CAPTURE OFF will close the capture file. X.br XThis setting does NOT currently extend to terminal mode. This may be Xoffered in a later release (probably through the SET command). X.IP "DIAL <number>" XDial the specified number. \fIxcomm\fP supports generic "Hayes" compatible Xmodems for dialing. Note that this command requires an actual phone Xnumber; the phonebook is not used for this function. X.IP "ECHO ON|OFF" XIf the argument to the ECHO command is ON, all subsequent command lines Xthat are processed will be displayed on the local screen. The exception Xto this is lines containing a TRANSMIT command. These lines will just Xprint "TRANSMIT ...", so that passwords, etc. can be protected. X.br XIf the argument to the ECHO command is OFF, scripts will execute Xquietly (this is the default setting). X.IP EXIT XTerminate the script file prior to the end of file. Returns to terminal Xmode. X.IP "GOTO <label>" XGo to the specified label in the script file and continue execution from Xthat point. The label may either precede or follow the actual GOTO Xstatement. X.IP "IF <condition>" X.IP "<statements>" X.IP "[ ELSE" X.IP "statements ]" X.IP "ENDIf" XConditionally execute statements based on specified condition. \fIXcomm\fP Xsupports the following conditions: X.sp XWAITFOR TRUE if the last WAITFOR command was successful XLINKED TRUE if this script was executed from the phonebook X.sp XConditions may be negated using the prefix NOT or the character "!": X.sp X!WAITFOR TRUE If the last WAITFOR command timed out XNOT WAITFOR Same as !WAITFOR above X.sp XThe ELSE and ENDIF keywords must appear on their own lines. IF Xstatements may not be nested. X.IP "PAUSE <time>" XSuspend execution of the script for the specified number of seconds. XThis is usually used for timing considerations; for example, waiting a Xcouple of seconds after receiving the CONNECT message and typing ^C to XCompuServe. X.IP "QUIT" XTerminate the script AND the \fIxcomm\fP program (return to the shell). X.IP "REDIAL" XRedial the last number dialed using the DIAL command OR the phonebook. X.IP "SET <parameter> <value>" XSets the specified parameter to the specified value. The SET parser Xused in command mode is used, and the parameters/values are identical. X.br XDuring script processing, internal status messages are NOT displayed on Xthe local terminal (eg, SET 7BIT ON in a script file does not display Xthe new value on the terminal). This may be changed in the future X(probably tied to the ECHO setting). X.br XDuring script processing, specifying SET alone is an ERROR... there is Xno way currently display the current status of the SET-able parameters Xduring script processing. X.IP "TRANSMIT <text>" XTransmit the specified text to the remote. The text argument should be Xquoted (using single or double quotes) if there are spaces to be Xtransmitted. The text is transmitted AS IS (no case conversions are Xperformed). X.br XPrefix characters: X.sp X^ Control character prefix - The next character is made into a Xcontrol character. XFor example: ^M = RETURN (0x0D); ^J = NEWLINE (0x0A). X.sp X\ Quote prefix - The next character is transmitted verbatim. For Xexample, \^ would transmit a literal ^. X.IP "TTY ON|OFF" XThe TTY command specifies whether or not characters received from the Xmodem will be displayed on the local terminal. Since the only time that Xthe script processor looks at the receive queue is during WAITFOR Xprocessing, the displays may look a bit erratic. X.br XUse the TTY OFF command to disable local display of received characters Xduring script processing. X.IP "WAITFOR <text> [timeout]" XWait for the specified text to appear from the modem. The text argument Xshould be quoted (using single or double quotes) if there are spaces to Xbe transmitted. X.br XSpecial characters are interpreted the same as for TRANSMIT. X.br XIf the timeout argument is specified, \fIxcomm\fP will wait that number of Xseconds for the string to appear. If no timeout is given, \fIxcomm\fP Xdefaults to 30 seconds. X.br XDuring WAITFOR processing, characters received (up to and including the Xlast character found in the text or in the timeout) can be captured to a Xdisk file (if CAPTURE ON was specified), and/or displayed to the screen X(if TTY ON was specified). X.SH "BUGS" X.LP X\fIXcomm\fP does not support or respect uucp/tip LCK lock files. XCheck that the modem is free before trying to use \fIxcomm\fP. X.SH "AUTHOR" X.LP XMy electronic addresses are: X.sp XCompu$erve: [72236,3516] (UNIXFORUM) X.br XDelphi: larryg X.br XBix: lar3ry X.br XAndover CNode: larry gensch X(This is a FIDO BBS dedicated to C Language Xprogramming - phone number (617) 470-2548) END_OF_FILE if test 17103 -ne `wc -c <'/usr/man/manl/xcomm.l'`; then echo shar: \"'/usr/man/manl/xcomm.l'\" unpacked with wrong size! fi # end of '/usr/man/manl/xcomm.l' fi echo shar: End of shell archive. exit 0
karl@triceratops.cis.ohio-state.edu (Karl Kleinpaste) (10/01/88)
gareth@ufnmr.UUCP (Gareth J. Barker) writes:
X.SH "BUGS"
X.LP
X\fIXcomm\fP does not support or respect uucp/tip LCK lock files.
XCheck that the modem is free before trying to use \fIxcomm\fP.
Incorrect. I thought I posted on this, but maybe it didn't get
everywhere the first time...
I added HDB-style LCK files to xcomm a couple of weeks ago, but
managed to miss updating the docs before posting the source. Xcomm
respects and creates HDB-style LCK files, and can be safely installed
setuid-uucp if you wish.
BTW, I have had one report that the shars refused to unpack properly.
I can't reproduce it from the originally-posted articles on my host;
if anyone else is having such troubles, I'd appreciate a note.
Something may have become corrupted along the way.
--Karl