home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / misc / ck5a189 / ckuker.bwr < prev    next >
Text File  |  2020-01-01  |  48KB  |  1,088 lines

  1. CKUKER.BWR          "Beware File" for C-Kermit Version 5A        -*- text -*-
  2.  
  3.                  UNIX VERSION
  4.  
  5. Applies to 5A(189)
  6. Last update: Mon Jun 27 17:48:59 1994
  7.  
  8. Authors: Frank da Cruz, Christine M. Gianone, Columbia University.
  9.  
  10.   Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New
  11.   York.  Permission is granted to any individual or institution to use this
  12.   software as long as it is not sold for profit.  This copyright notice must be
  13.   retained.  This software may not be included in commercial products without
  14.   written permission of Columbia University.
  15.  
  16. Report problems, suggestions, fixes, etc, to Frank da Cruz:
  17.  
  18.  Internet: fdc@watsun.cc.columbia.edu  (or)  fdc@columbia.edu
  19.  BITNET/EARN: FDCCU@CUVMA
  20.  
  21. Columbia University Academic Information Systems
  22. 612 West 115th Street, New York, NY  10025  USA
  23.  
  24.  
  25. DOCUMENTATION
  26.  
  27. C-Kermit 5A is documented in the book "Using C-Kermit" by Frank da Cruz
  28. and Christine M. Gianone, Digital Press, Burlington, MA, USA.  Digital
  29. Press ISBN: 1-55558-108-0; Prentice-Hall ISBN: 0-13-037490-3.  Price: US
  30. $34.95.  In USA, call DECdirect at 1-800-344-4825, refer to order number
  31. EY-J896E-DP.
  32.  
  33.  
  34. FILES
  35.  
  36. File naming conventions are listed in ckaaaa.hlp.
  37.  
  38. UNIX installation instructions are in the make file (makefile or ckuker.mak),
  39. with further details in ckuins.doc and ckccfg.doc.
  40.  
  41. Updates to the software are listed in ckc*.upd.
  42.  
  43. BINARIES
  44.  
  45. Warning: It is often dangerous to run a binary C-Kermit (or any other)
  46. program built on a different computer.  Particularly if that computer had a
  47. different C compiler, libraries, operating system version, processor features,
  48. etc, and especially if the program was built with shared libraries.  
  49.  
  50. It is often OK to run a binary built on an earlier OS version, but it is
  51. rarely possible (or safe) to run a binary built on a later one, for example
  52. a to run binary built under SunOS 4.1.2 on a SunOS 4.1.1 system.
  53.  
  54. When in doubt, build C-Kermit from the source code on the system where it is
  55. to be run.
  56.  
  57.  
  58. KNOWN BUGS AND LIMITATIONS
  59.  
  60. Reportedly, "C-Kermit 188 or 189 ... causes a SPARCstation running Solaris 2.3
  61. to panic after the modem connects.  I have tried compiling C-Kermit with Sun's
  62. unbundled C compiler, with GCC Versions 2.4.5 and 2.5.3, with make targets
  63. 'sunos51', 'sunos51tcp', 'sunos51gcc', and even 'sys5r4', and each time it
  64. compiles and starts up cleanly, but without fail, as soon as I dial the number
  65. and get a 'CONNECT' message from the modem, I get:
  66.  
  67.   BAD TRAP
  68.   kermit: Data fault
  69.   kernel read fault at addr=0x45c, pme=0x0
  70.   Sync Error Reg 80 <INVALID>
  71.   ...
  72.   panic: Data Fault.
  73.   ...
  74.   Rebooting...
  75.  
  76. The same modem works fine for UUCP/tip calling."  Also (reportedly), this only
  77. happens if the dialout port is configured as in/out via admintool.  If it is
  78. configured as out-only, no problem.  This is the same dialing code that works
  79. on hundreds of other System-V based UNIX OS's.  Since it should be impossible
  80. for a user program to crash the operating system, this problem must be chalked
  81. up to a Solaris bug.  Even if you SET CARRIER OFF, CONNECT, and dial manually
  82. by typing ATDTnnnnnnn, the system panics as soon as the modem issues its
  83. CONNECT message.  (Clearly, when you are dialing manually, C-Kermit does not
  84. know a thing about the CONNECT message, and so the panic is almost certainly
  85. caused by the transition of the Carrier Detect (CD) line from off to on.)
  86. This problem was reported by many users, all of whom say that C-Kermit worked
  87. fine on Solaris 2.1 and 2.2.  If the speculation about CD is true, then a
  88. possible workaround might be to configure the modem to leave CD on all the
  89. time.
  90.  
  91. The following is from Karl S. Marsh, Systems & Networks Administrator,
  92. AMBIX Systems Corp, Rochester, NY (begin quote):
  93.  
  94. "Environment:
  95.   Solaris 2.3 Patch 101318-45
  96.   C-Kermit 5A(189) (and presumably this applies to 188 and 190 also)
  97.   eeprom setting:
  98.     ttya-rts-dtr-off=false
  99.     ttya-ignore-cd=false
  100.     ttya-mode=19200,8,n,8,-
  101.  
  102. "To use C-Kermit on a bidirectional port in this environment, do not use
  103. admintool to configure the port.  Use admintool to delete any services running
  104. on the port and then quit admintool and issue the following command:
  105.  
  106.   pmadm -a -p zsmon -s ttyb -i root -fu -v 1 -m "'ttyadm -b -d /dev/term/b \
  107.   -l conttyH -m ldterm,ttcompat -s /usr/bin/login -S n'"
  108.  
  109. [NOTE: This was copied from a fax, so please check it carefully.]  where:
  110.  
  111.   -a = Add service
  112.   -p = pmtag (zsmon)
  113.   -s = service tag (ttyb)
  114.   -i = id to be associated with service tag (root)
  115.   -fu = create utmp entry
  116.   -v = version of ttyadm
  117.   -m = port monitor-specific portion of the port monitor administrative file
  118.        entry for the service
  119.   -b = set up port for bidirectional use
  120.   -d = full path name of device
  121.   -l = which ttylabel in the /etc/ttydefs file to use
  122.   -m = a list of pushable STREAMS modules
  123.   -s = pathname of service to be invoked when connection request received
  124.   -S = software carrier detect on or off (n = off)
  125.  
  126. "This is exactly how I was able to get Kermit to work on a bi-directional
  127. port without crashing the system."  (End quote)
  128.  
  129. C-Kermit does not work correctly on certain UNIX workstations in certain
  130. environments:
  131.  
  132.  - On the NeXT when invoked directly from the NeXTSTEP File Viewer or Dock.
  133.    You must invoke Kermit from a "terminal", Stuart, or xterm window.
  134.  - On a NeXT with NeXTSTEP 3.0 to which you have established an rlogin
  135.    connection, due to a bug in NeXTSTEP 3.0, which has been reported to NeXT.
  136.  - On a SUN SPARCstation in an Open Windows window with scrolling enabled.
  137.    Disable scrolling, or else invoke Kermit in a terminal emulation window
  138.    (xterm, crttool, vttool) under SunView.
  139.  - On a remote UNIX system, when used through the GNU "screen" program.  In
  140.    this case, terminal connections to the remote UNIX system work, but
  141.    attempts to transfer files fail because the screen optimization (or at
  142.    least, line wrapping, control-character absorption) done by this package
  143.    interferes with Kermit's packets. 
  144.  
  145. The (first) problem on the NeXT is that terminal-oriented gtty, stty, & ioctl
  146. calls don't work on the little window that NeXTSTEP pops up for non-NeXTSTEP
  147. applications like Kermit.  CBREAK and No-ECHO settings do not take effect in
  148. the command parser -- commands are parsed strictly line at a time.  "set line
  149. /dev/cua" works.  During CONNECT mode, the console stays in cooked mode, so
  150. characters are not transmitted until carriage return or linefeed is typed, and
  151. you can't escape back.  If you want to run Kermit directly from the File
  152. Viewer, then launch it from a shell script that puts it in the desired kind of
  153. window, something like this (for "terminal"):
  154.  
  155.   Terminal -Lines 24 -Columns 80 -WinLocX 100 -WinLocY 100 $FONT $FONTSIZE \
  156.   -SourceDotLogin -Shell /usr/local/bin/kermit &
  157.  
  158. On the Sun with Open Windows, an additional symptom has been reported:
  159. outbound SunLink X.25 connections "magically" translate CR typed at the
  160. keyboard into LF before transmission to the remote host.  This doesn't happen
  161. under SunView.
  162.  
  163. On PCs with Linux, run C-Kermit in the regular console screen, which provides
  164. VT100 emulation via the "console" termcap entry, or under X-Windows in an
  165. xterm window.  Before starting C-Kermit in an xterm window, tell the xterm
  166. window's shell to "stty sane".
  167.  
  168. On UNIX workstations equipped with DOS simulators like SoftPC, watch out for
  169. what these simulators do to the serial port drivers.  After using a DOS
  170. simulator, particularly if you use it to run DOS communications software, you
  171. might have to reconfigure the serial ports for use by UNIX.
  172.  
  173. On AT&T 7300 (3B1) machines, you might have to "stty nl1" before starting
  174. C-Kermit.  Do this if characters are lost during C-Kermit operation.
  175.  
  176. Under the bash shell (versions prior to 1.07 from CWRU), "pushing" to an
  177. inferior shell and then exiting back to Kermit leaves Kermit in the background
  178. such that it must be explicitly fg'd.  This is reportedly fixed in version
  179. 1.07 of bash.
  180.  
  181. Interruption by Ctrl-Z makes UNIX C-Kermit try to suspend itself with
  182. kill(0,SIGSTOP), but only on systems that support job control, as determined
  183. by whether the symbol SIGTSTP is defined (or on POSIX or SVR4 systems, if
  184. syconf(_SC_JOB_CONTROL) or _POSIX_JOB_CONTROL in addition to SIGTSTP).
  185. However, if Kermit is running under a login shell (such as the original Bourne
  186. shell) that does not support job control, the user's session hangs and must be
  187. logged out from another terminal, or hung up on.  There is no way Kermit can
  188. defend itself against this.  If you use a non-job control shell on a computer
  189. that supports job control, give a command like "stty susp undef" to fix it so
  190. the suspend signal is not attached to any particular key, or give the command
  191. SET SUSPEND OFF to C-Kermit, or build C-Kermit with -DNOJC.
  192.  
  193. Reportedly, DEC ULTRIX 4.3 is immune to C-Kermit's disabling of SIGQUIT,
  194. that is the signal that is generated when the user types Ctrl-\, which kills
  195. the current process (i.e. C-Kermit) and dumps core.  Diagnosis and cure
  196. unknown.  Workaround: before starting C-Kermit -- or for that matter, when you
  197. first log in because this applies to all processes, not just Kermit -- give
  198. the following UNIX command:
  199.  
  200.   stty quit undef
  201.  
  202. The RS/6000 version does not do anything about SIGDANGER, an AIX-specific
  203. signal sent to all processes when system memory or swap space begins to run
  204. short.  To avoid being killed under these conditions, C-Kermit should catch
  205. SIGDANGER.  More info needed about how to do this.
  206.  
  207. Running sz or rz for Zmodem transfers under C-Kermit ("run rz", "run sz file")
  208. does not work on System V/386 R4, and perhaps also other System V UNIX
  209. implementations.  Reason unknown, no known workaround.  The same operation
  210. works OK in Berkeley-based UNIX versions, for example SunOS 4.x.
  211.  
  212. Reportedly, the UNIX C-Kermit server, under some conditions, on certain
  213. particular systems, fails to log out its login session upon receipt of a
  214. BYE command.  Before relying on the BYE command working, test it a few times
  215. to make sure it works on your system: there might be system configuration or
  216. security mechanisms to prevent an inferior process (like Kermit) from
  217. killing a superior one (like the login shell).
  218.  
  219. INITIALIZATION FILE
  220.  
  221. C-Kermit's initialization file for UNIX is .kermrc (lowercase, starts with
  222. period) in your home directory.  C-Kermit identifies your home directory based
  223. on the environment variable, HOME.  Most UNIX systems set this variable
  224. automatically when you log in.  If C-Kermit can't find your initialization
  225. file, check your HOME variable:
  226.  
  227.   echo $HOME      (at the UNIX prompt)
  228.  
  229. or:
  230.  
  231.   echo \$(HOME)   (at the C-Kermit prompt)
  232.  
  233. If HOME is not defined, or is defined incorrectly, add the appropriate
  234. definition to your UNIX .profile or .login file, depending on your shell:
  235.  
  236.   setenv HOME full-pathname-of-your-home-directory  (C-Shell, .login file)
  237.  
  238. or:
  239.  
  240.   HOME=full-pathname-of-your-home-directory     (sh, ksh, .profile file)
  241.   export HOME
  242.  
  243. NOTE: Various other operations depend on the correct definition of HOME.
  244. These include the "tilde-expansion" feature, which allows you to refer to
  245. your home directory as "~" in filenames used in C-Kermit commands, e.g.
  246.  
  247.   send ~/.kermrc
  248.  
  249. as well as the \v(home) variable.
  250.  
  251. The TAKE command does not search your UNIX PATH for command files.
  252.  
  253.  
  254. COMMUNICATION SPEED SELECTION
  255.  
  256. Version 7 based UNIX implementations, including 4.3 BSD and earlier and
  257. UNIX systems based upon BSD, use a 4-bit field to record a serial device's
  258. terminal speed.  This leaves room for 16 speeds, which are normally:
  259.  
  260.   0, 50, 75, 110, 134.5, 150, 200, 300, 600, 1200, 1800, 2400, 4800, and 9600
  261.  
  262. The remaining two are usually called EXTA and EXTB, and are defined by the
  263. particular UNIX implementation.  C-Kermit determines which speeds are
  264. available on your system based on whether symbols for them are defined in your
  265. terminal device header files.  EXTA is generally assumed to be 19200 and EXTB
  266. 38400, but these assumptions might be wrong, or they might not apply to a
  267. particular device that does not support these speeds.  Presumably, if you try
  268. to set a speed that is not legal on a particular device, the driver will
  269. return an error, but this can not be guaranteed.
  270.  
  271. On these systems, it is usually not possible to select a speed of 14400 bps
  272. for use with V.32bis modems.  In that case, use 19200 or 38400 bps, configure
  273. your modem to lock its interface speed and to use RTS/CTS flow control, and
  274. tell C-Kermit to SET SPEED RTS/CTS and SET DIAL SPEED-MATCHING OFF.
  275.  
  276. Reportedly some recent versions of UNIX, and/or terminal device drivers that
  277. come with certain third-party add-in high-speed serial communication
  278. interfaces, use the low "baud rates" to stand for higher ones.  For example,
  279. SET SPEED 50 gets you 57600 bps; SET SPEED 75 gets you 76800; SET SPEED 110
  280. gets 115200.
  281.  
  282. The situation is similar, but different, in System V.  SVID Third Edition
  283. lists the same speeds, 0 through 38400.
  284.  
  285.  
  286. COMMUNICATIONS AND DIALING
  287.  
  288. First, make sure your dialout line is correctly configured for dialing out
  289. (as opposed to login).  The method for doing this is different for each kind
  290. of UNIX system.  Consult your system documentation for configuring lines for
  291. dialing out (for example, SUN SparcStation IPC users should read the section
  292. "Setting up Modem Software" in the Desktop SPARC Sun System & Network
  293. Manager's Guide).
  294.  
  295. Certain operations driven by RS-232 modem signal do not work on DECstations or
  296. other DEC platforms whose serial interfaces use MMP connectors (DEC version of
  297. RJ45 telephone jack with with offset tab).  These connectors convey only the
  298. DSR and DTR modem signals, but not carrier (CD), RTS, CTS, or RI.  Use SET
  299. CARRIER OFF to enable communication, or "hotwire" DSR to CD.
  300.  
  301. Symptom: DIAL works, but a subsequent CONNECT command does not.  Diagnosis:
  302. the modem is not asserting Carrier Detect (CD) after the connection is made,
  303. or the cable does not convey the CD signal.  Cure: Reconfigure the modem,
  304. replace the cable.  Workaround: SET CARRIER OFF (at least in System-V based
  305. UNIX versions).
  306.  
  307. Kermit tries to use the 8th bit for data when parity is NONE, and this
  308. generally works on real UNIX terminal (tty) devices, but it often does not
  309. work when the UNIX system is accessed over a network via telnet or rlogin
  310. protocols, including (in many cases) through terminal servers.  For example,
  311. an Encore computer with Annex terminal servers only gives a 7-bit path if
  312. the rlogin protocol is selected in the terminal server but it gives the full
  313. 8 bits if the proprietary RDP protocol is used.
  314.  
  315. If file transfer does not work through a host to which you have rlogin'd,
  316. use "rlogin -8" rather than "rlogin".  If that doesn't work, tell both Kermit
  317. programs to "set parity space".
  318.  
  319. The Encore TELNET server does not allow long bursts of input.  When you have
  320. a TELNET connection to an Encore, tell C-Kermit on the Encore to SET RECEIVE
  321. PACKET-LENGTH 200 or thereabouts.
  322.  
  323. For Berkeley-UNIX-based systems (4.3BSD and earlier), Kermit includes code to
  324. use LPASS8 mode when parity is none, which is supposed to allow 8-bit data and
  325. Xon/Xoff flow control at the same time.  However, as of edit 174, this code is
  326. entirely disabled because it is unreliable: even though the host operating
  327. system might (or might not) support LPASS8 mode correctly, the host access
  328. protocols (terminal servers, telnet, rlogin, etc) generally have no way of
  329. finding out about it and therefore render it ineffective, causing file
  330. transfer failures.  So as of edit 174, Kermit once again uses rawmode for
  331. 8-bit data, and so there is no Xon/Xoff flow control during file transfer or
  332. terminal emulation.
  333.  
  334. Also on Berkeley-based systems (4.3 and earlier), there is apparently no way
  335. to configure a dialout line for proper carrier handling, i.e. ignore carrier
  336. during dialing, require carrier thereafter, get a fatal error on any attempt
  337. to read from the device after carrier drops (this is handled nicely in System
  338. V by manipulation of the CLOCAL flag).  The symptom is that carrier loss does
  339. not make C-Kermit pop back to the prompt automatically.  This is evident on
  340. the NeXT, for example, but not on SUNOS, which supports the CLOCAL flag.  This
  341. is not a Kermit problem, but a limitation of the underlying operating system.
  342. For example, the cu program on the NeXT doesn't notice carrier loss either,
  343. whereas cu on the SUN does.
  344.  
  345. DIAL might not work.  If it doesn't, try SET DIAL HANGUP OFF before the DIAL
  346. command.  Also, SET DIAL DISPLAY ON to watch what's happening.  See section 8
  347. of ckuins.doc.  As a last resort, don't use the DIAL command at all; SET
  348. CARRIER OFF and CONNECT to the modem and dial interactively, or write a script
  349. program to dial the modem.
  350.  
  351. On certain AT&T UNIX systems equipped with AT&T modems, DIAL and HANGUP don't
  352. work right.  Workarounds: (1) SET DIAL HANGUP OFF before attempting to dial;
  353. (2) If HANGUP doesn't work, SET LINE, and then SET LINE <device> to totally
  354. close and reopen the device.  If all else fails, SET CARRIER OFF.
  355.  
  356. C-Kermit does not contain any particular support for AT&T DataKit devices.
  357. You can use Kermit software to dial in to a DataKit line, but C-Kermit does
  358. not contain the specialized code required to dial out from a DataKit line.  If
  359. the UNIX system is connected to DataKit via serial ports, dialout should work
  360. normally (e.g. set line /dev/ttym1, set speed 19200, connect, and then see the
  361. DESTINATION: prompt, from which you can connect to another computer on the
  362. DataKit network or to an outgoing modem pool, etc).  But if the UNIX system
  363. is connected to the DataKit network through the special DataKit interface
  364. board, then SET LINE to a DataKit pseudodevice (such as /dev/dk031t) will not
  365. work (you must use the DataKit "dk" or "dkcu" program instead).
  366.  
  367. In some BSD-based UNIX C-Kermit versions, SET LINE to a port that has nothing
  368. plugged in to it with SET CARRIER ON will hang the program (as it should), but
  369. it can't be interrupted with Ctrl-C.  The interrupt trap is correctly armed,
  370. but apparently the UNIX open() call cannot be interrupted in this case.  When
  371. SET CARRIER is OFF or AUTO, the SET LINE will eventually return, but then the
  372. program hangs (uninterruptibly) when the EXIT or QUIT command (or, presumably,
  373. another SET LINE command) is given.  The latter is probably because of the
  374. attempt to hang up the modem.  (In edit 169, a timeout alarm was placed around
  375. this operation.)
  376.  
  377. SET CARRIER ON, when used on the SUNOS 4.1 version of C-Kermit (compiled in
  378. the BSD universe), causes the program to hang uninterruptibly when SET LINE
  379. is issued for a device that is not asserting carrier.  When Kermit is built
  380. in the Sys V universe on the same computer, there is no problem (it can be
  381. interrupted with Ctrl-C).  This is apparently a limitation of the BSD-style
  382. tty driver.
  383.  
  384. SunOS 4.1 C-Kermit has been observed to dump core when running a complicated
  385. script program under cron.  The dump invariably occurs in ttoc(), while trying
  386. to output a character to a TCP/IP TELNET connection.  ttoc() contains a
  387. write() call, and when the system or the network is very busy, the write()
  388. call can get stuck for long periods of time.  To break out of deadlocks caused
  389. by stuck write() calls, there is an alarm around the write().  It is possible
  390. that the core dump occurs when this alarm signal is caught.
  391.  
  392. One user of C-Kermit 5A(179) on an RS/6000 with AIX 3.2.0 reported that (at
  393. least on TCP/IP connections, i.e. SET HOST out of C-Kermit) escaping back
  394. works only once.  After connecting a second time, the escape character is
  395. ignored.  Other users of the AIX 3.2.0 report that this does not happen.  For
  396. now, a mystery.  This behavior is not observed on AIX 3.1 or AIX 3.2.1.
  397.  
  398. Many problems reported with bidirectional terminal lines on AIX 3.2.x on the
  399. RS/6000.  Workaround: don't use bidirectional terminal lines, or write some
  400. kind of shell script that turns getty off on the line before starting Kermit,
  401. or before Kermit attempts to do the SET LINE.
  402.  
  403. Or use vendor-provided utilities for switching the directionality of a modem
  404. line, such as SCO's "enable" and "disable" commands.  For example, to dial
  405. out on tty1a, which is normally set up for logins:
  406.  
  407.   disable tty1a
  408.   kermit -l /dev/tty1a
  409.   enable tty1a
  410.  
  411. In SCO Xenix, you must use SET CARRIER ON *and* use the upper-case tty device
  412. name in order to have carrier detection.  SET CARRIER OFF should work with
  413. either upper or lowercase tty devices.  SET CARRIER AUTO is the same as OFF.
  414.  
  415. With SET DIAL HANGUP OFF in effect, the DIAL command might work only once,
  416. but not again on the same device.  In that case, give a SET LINE command
  417. with no arguments to close the device, and then another SET LINE command for
  418. the desired device.  Or rebuild your version of Kermit with the -DCLSOPN
  419. compile-time switch (see ckuins.doc).
  420.  
  421. The DIAL command does not always seem to wait the full announced interval for
  422. the call to complete.  Probably something to do with alarms stomping over each
  423. other.  Try SET DIAL TIMEOUT <sec> to increase the interval.
  424.  
  425. The DIAL command says "To cancel: Type your interrupt character (normally
  426. Ctrl-C)."  This is just one example of where program messages and
  427. documentation assume your interrupt character is Ctrl-C.  But it might be
  428. something else.  In most (but not necessarily all) cases, the character
  429. referred to is the one that generates the SIGINT signal.  If Ctrl-C doesn't
  430. act as an interrupt character for you, type the Unix command "stty -a" or
  431. "stty all" or "stty everything" to see what your interrupt character is.
  432. (Kermit could be made to find out what the interrupt character is, but this
  433. would require a lot of system-dependent coding and #ifdefs, and a new routine
  434. and interface between the system-dependent and system-independent parts of the
  435. program.)
  436.  
  437. (On a similar note, Kermit could find out what your erase, line-delete,
  438. word-delete, etc, characters are and use them in the command parser instead of
  439. hardwired DEC-style editing characters.  This is on the list of things to do.)
  440.  
  441. Reportedly, all versions of IBM AIX use the same (undocumented) lockfile
  442. conventions as RTAIX.  If this is true, the "makes" for PS/2 AIX, AIX/370,
  443. and RS/6000 will have to be changed to use the RTAIX convention (it may be
  444. sufficient to simply add -DRTAIX to the make entry).
  445.  
  446. C-Kermit SET HOST or TELNET from AIX on an RS/6000 to another RS/6000 won't
  447. work right unless you set your local terminal type to something other than
  448. AIXTERM.  When your terminal type is AIXTERM, AIX TELNET sends two escapes
  449. whenever you type one, and the AIX telnet server swallows one of them.
  450. This has something to do with "hft" device.  This behavior is reportedly
  451. removed in AIX 3.2.
  452.  
  453. In general, the hangup operation on a serial communication device is prone
  454. to failure.  C-Kermit tries to support many, many different kinds of
  455. computers, and there seems to be no portable method for hanging up a modem
  456. connection (i.e. turning off the RS-232 DTR signal and then turning it back on
  457. again).  If HANGUP, DIAL, and/or Ctrl-\H do not work for you, and you are a
  458. programmer, look at the tthang() function in ckutio.c and see if you can add
  459. code to make it work correctly for your system, and send the code to the
  460. address above.
  461.  
  462. Even when Kermit's modem-control software is configured correctly for your
  463. computer, it can only work right if your modem is also configured to assert
  464. the CD signal when it is connected to the remote modem and to hang up the
  465. connection when your computer drops the DTR signal.  So before deciding Kermit
  466. doesn't work with your modem, check your modem configuration AND the cable
  467. connecting your modem to the computer -- it should be a straight-through modem
  468. cable conducting the signals FG, SG, TD, RD, RTS, CTS, DSR, DTR, CD, and RI.
  469.  
  470. Certain UNIX systems, such as SCO Xenix and UNIX, provide different names for
  471. the same device.  In Xenix, /dev/tty1a refers to a terminal device that has no
  472. modem control; open, read, write, and close operations do not depend on
  473. carrier.  On the other hand, /dev/tty1A (same name, but with final letter
  474. upper case), is the same device with modem control, in which carrier is
  475. required (the SET LINE command does not complete until carrier appears,
  476. read/write operations fail if there is no carrier, etc).  In the SCO case,
  477. C-Kermit always uses the lowercase name when creating the UUCP lockfile
  478. (this is, according to SCO experts, the proper behavior, but reportedly not
  479. all other communications applications found on SCO systems follow this rule).
  480.  
  481. The SET FLOW-CONTROL KEEP option should be given *before* any communication
  482. (dialing, terminal emulation, file transfer, INPUT/OUTPUT/TRANSMIT, etc) is
  483. attempted, if you want C-Kermit to use all of the device's preexisting
  484. flow-control related settings.  The default flow-control setting is XON/XOFF,
  485. and it will take effect when the first communication-related command is given,
  486. and a subsequent SET FLOW KEEP command will not necessarily know how to
  487. restore *all* of the device's original flow-control settings.
  488.  
  489. On the NeXT, Kermit reportedly (by TimeMon) causes the kernel to use a lot of
  490. CPU time when using a "set line" connection.  That's because there is no DMA
  491. channel for the NeXT serial port, so the port must interrupt the kernel for
  492. each character in or out.
  493.  
  494. Under BSD UNIX versions, it takes a long time to complete operations that
  495. involve changing TTY modes.  This is because the BSD stty calls do not wait
  496. for pending i/o to complete before returning, and so Kermit must sleep
  497. before invoking these functions.  System V versions don't have this problem.
  498.  
  499.  
  500. HARDWARE FLOW CONTROL
  501.  
  502. SET FLOW RTS/CTS is available in UNIX C-Kermit only when the underlying
  503. operating system provides an API for turning this feature on and off under
  504. program control, which turns out to be a rather rare feature among UNIX
  505. systems.  Other common situations include:
  506.  
  507. 1. The API is available, so "set flow rts/cts" appears as a valid C-Kermit
  508.    command, but it doesn't do anything because the device driver (part of
  509.    the operating system) was never coded to do hardware flow control.  This
  510.    is common among System V R4 implementations (details below).
  511.  
  512. 2. The API is not available, so "set flow rts/cts" does NOT appear as a valid
  513.    C-Kermit command, but you can still get RTS/CTS flow control by selecting
  514.    a specially named device in your SET LINE command.  Examples:
  515.  
  516.      NeXTSTEP: /dev/cufa instead of /dev/cua, /dev/cufb instead of /dev/cub.
  517.      IRIX: /dev/ttyf2 instead of /dev/ttyd2 or /dev/ttym2.
  518.  
  519. 3. The API is available, doesn't work, but a workaround as in (2) can be used.
  520.  
  521. 4. The API is available, but Kermit doesn't know about it.  In these cases,
  522.    you can usually use an stty command to enable RTS/CTS on the device, e.g.
  523.    "stty crtscts" or "stty ctsflow", "stty rtsflow".
  524.  
  525. 5. No API and no special device drivers.  Hardware flow control is completely
  526.    unavailable.
  527.  
  528. On Sun computers with SunOS 4.0 or 4.1, SET FLOW RTS/CTS works only if the
  529. carrier signal is present from the communication device at the time when
  530. C-Kermit enters packet mode or CONNECT mode.  If carrier is not sensed (e.g.
  531. when dialing), C-Kermit does not attempt to turn on RTS/CTS flow control.
  532. This is because the SunOS serial device driver does not allow characters to
  533. be output if RTS/CTS is set (CRTSCTS) but carrier (and DSR) are not present.
  534. Workaround (maybe):  SET CARRIER OFF before giving the SET LINE command,
  535. establish the connection, then SET FLOW RTS/CTS
  536.  
  537. It has also been reported that RTS/CTS flow control under SunOS 4.1 through
  538. 4.1.3 works only on INPUT, not on output, and that there is a patch from Sun
  539. to correct this problem: Patch-ID# T100513-04, 20 July 1993.
  540.  
  541. System V R4 based UNIXes are supposed to supply a <termiox.h> or
  542. <sys/termiox.h> file, which gives Kermit the necessary interface to command
  543. the terminal driver to enable/disable hardware flow control.  Thus if you
  544. build C-Kermit with any of the makefile entries that contain -DTERMIOX or
  545. -DSTERMIOX, C-Kermit will have "set flow rts/cts" and possibly other hardware
  546. flow-control related commands.  BUT...  That does not necessarily mean that
  547. they will work.  In some cases, the underlying functions are simply not coded
  548. into the operating system.
  549.  
  550.  
  551. TERMINAL CONNECTION
  552.  
  553. UNIX C-Kermit's SET KEY command currently can not be used with keys that
  554. generate "wide" scan codes or multibyte sequences, such as workstation 
  555. function or arrow keys.  More about this in CKCKER.BWR.
  556.  
  557. Many UNIX workstations and/or console drivers provide their own key mapping
  558. feature.  With xterm, for example, you can use 'xmodmap' ("man xmodmap" for
  559. details); here is an xterm mapping to map the Sun keyboard to DEC VT200 values
  560. for use with VT-terminal oriented applications like VMS EVE:
  561.  
  562.   keycode 101=KP_0
  563.   keycode 119=KP_1
  564.   keycode 120=KP_2
  565.   keycode 121=KP_3
  566.   keycode 98=KP_4
  567.   keycode 99=KP_5
  568.   keycode 100=KP_6
  569.   keycode 75=KP_7
  570.   keycode 76=KP_8
  571.   keycode 77=KP_9
  572.   keycode 52=KP_F1
  573.   keycode 53=KP_F2
  574.   keycode 54=KP_F3
  575.   keycode 57=KP_Decimal
  576.   keycode 28=Left
  577.   keycode 29=Right
  578.   keycode 30=KP_Separator
  579.   keycode 105=KP_F4
  580.   keycode 78=KP_Subtract
  581.   keycode 8=Left
  582.   keycode 10=Right
  583.   keycode 32=Up
  584.   keycode 33=Down
  585.   keycode 97=KP_Enter
  586.  
  587.  
  588. FILE TRANSFER
  589.  
  590. Optimum file transfer performance is a matter of tuning parameters like packet
  591. length and window size, and, on serial connections, of ensuring there is an
  592. effective flow control method, preferably hardware (such as RTS/CTS).  In
  593. C-Kermit 5A(189) and later, you can also use the new "control character
  594. unprefixing feature" to boost performance, particularly for binary and/or
  595. precompressed files (see CKCKER.UPD for details).
  596.  
  597. However, a fully-configured C-Kermit program can be slower than a minimally
  598. configured one simply because of its size.  A command-line-only version that
  599. is stripped of every conceivable feature not affecting file transfer (such as
  600. "sunos41m" for the Sun or "dellsys5r4m" for Dell) can move files faster than a
  601. full-featured one.  Thus, it might make sense to keep a minimal version
  602. available as well as a full-featured one.  See the files ckuins.doc and
  603. ckccfg.doc as well as the makefile for how to do this.
  604.  
  605. UNIX C-Kermit does not reject incoming files on the basis of size.  There
  606. appears to be no good (reliable, portable) way to determine in advance how
  607. much disk space is available.
  608.  
  609. File transfer will fail if the incoming file is bigger than your ULIMIT.
  610. Use the UNIX ulimit command to examine or change your ULIMIT (the number is
  611. in 512-byte blocks, i.e. 0.5K).
  612.  
  613. UNIX C-Kermit discards all carriage returns from incoming files when in text
  614. mode.
  615.  
  616. If you SET FILE DISPLAY FULLSCREEN, and C-Kermit complains "Sorry, terminal
  617. type not supported", it means that the terminal library (termcap or termlib)
  618. that C-Kermit was built for does not know about a terminal whose name is the
  619. current value of your TERM environment variable.  If this happens, EXIT from
  620. C-Kermit and set a UNIX terminal type from among the supported values that is
  621. also supported by your terminal emulator, or else have an entry for your
  622. terminal type added to the system termcap and/or terminfo database.
  623.  
  624. If you attempt to suspend C-Kermit during local-mode file transfer and then
  625. continue it in the background (via bg), it will block for "tty output" if
  626. you are using the FULLSCREEN file transfer display.  This is apparently
  627. a problem with curses.  Moving a local-mode file transfer back and forth
  628. between foreground and background works correctly, however, with the SERIAL,
  629. CRT, or NONE file transfer displays.
  630.  
  631. Reportedly, when using "MSEND *" from a 14-character filename UNIX system to
  632. another system (e.g. BSD) that allows longer names, with SET FILE NAMES
  633. LITERAL, any files with 14-character names will have a space added to the end
  634. of the name on the receiving machine.
  635.  
  636. One user of C-Kermit on SCO UNIX 3.2.4 reports that C-Kermit core dumps when
  637. receiving files in local mode.  The crash invariably occurs when the 16384th
  638. byte arrives, obviously indicating some kind of int/long, or short/int, or
  639. similar mismatch in argument-passing -- no doubt the byte count.  Other users
  640. of SCO UNIX 3.2.4, built using the same makefile entry, report that they can
  641. receive files much longer than 16384 with no problem at all.  Maybe it depends
  642. on which file transfer display is being used?  If this happens to you, try
  643. using a different file transfer display (SET FILE DISPLAY NONE, SERIAL, CRT,
  644. or FULLSCREEN).
  645.  
  646.  
  647. EXTERNAL FILE TRANSFER PROTOCOLS
  648.  
  649. UNIX C-Kermit can be used in conjunction with other communications software
  650. in various ways.  C-Kermit can be invoked from another communications program
  651. as an "external protocol", and C-Kermit can also invoke other communication
  652. software to perform external protocols.
  653.  
  654. This sort of operation makes sense only when you are dialing out from your
  655. UNIX system.  If the UNIX system is the one you have dialed in to, you don't
  656. need any of these tricks.  Just run the desired software on your UNIX system
  657. instead of Kermit.  When dialing out from a UNIX system, the difficulty is
  658. getting two programs to share the same communication device in spite of the
  659. UNIX UUCP lockfile mechanism, which would normally prevent any sharing.
  660.  
  661.   1. C-Kermit as an External Protocol
  662.  
  663. "pcomm" is a general-purpose terminal program that provides file transfer
  664. capabilities itself (X- and YMODEM variations) and the ability to call on
  665. external programs to do file transfers (ZMODEM and Kermit, for example).  You
  666. can tell pcomm the command to execute to send or receive a file with an
  667. external protocol:
  668.             send                receive
  669.     ZMODEM        sz <filename>            rz
  670.     Kermit        kermit -s <filename>        kermit -r
  671.  
  672. pcomm runs external programs for file transfer by making stdin and stdout
  673. point to the modem port, and then exec-ing "/bin/sh -c xxx" (where xxx is the
  674. appropriate command).  However, C-Kermit does not treat stdin and stdout as
  675. the communication device unless you instruct it:
  676.  
  677.             send                receive
  678.     Kermit        kermit -l 0 -s <filename>    kermit -l 0 -r
  679.  
  680. The "-l 0" option means to use file descriptor 0 for the communication device.
  681.  
  682. In general, any program can pass any open file descriptor to C-Kermit for the
  683. communication device in the "-l" command-line option.
  684.  
  685.   2. Invoking External Protocols from C-Kermit
  686.  
  687. After you have opened a communication link with C-Kermit's SET LINE (SET PORT)
  688. or SET HOST (TELNET) command, C-Kermit makes its file descriptor available to
  689. you in the \v(ttyfd) variable so you can make it available to other programs
  690. that you RUN from C-Kermit.  Here, for example, C-Kermit runs itself as an
  691. external protocol:
  692.  
  693.   C-Kermit>set modem hayes
  694.   C-Kermit>set line /dev/acu
  695.   C-Kermit>set speed 2400
  696.   C-Kermit>dial 7654321
  697.    Call complete.
  698.   C-Kermit>echo \v(ttyfd)
  699.    3
  700.   C-Kermit>run kermit -l \v(ttyfd)
  701.  
  702. Other programs that accept open file descriptors on the command line can be
  703. started in the same way.
  704.  
  705. You can also use your shell's i/o redirection facilities to assign C-Kermit's
  706. open file descriptor (ttyfd) to stdin or stdout.  For example, the UNIX ZMODEM
  707. programs, sz and rz, when invoked as external protocols, expect to find the
  708. communication device assigned to stdin and stdout with no option for
  709. specifying any other file descriptor on the sz or rz command line.  However,
  710. you can still invoke sz and rz as exterior protocols from C-Kermit if your
  711. current shell ($SHELL variable) is ksh (the Korn shell) or bash (the
  712. Bourne-Again shell), which allows assignment of arbitrary file descriptors to
  713. stdin and stdout:
  714.  
  715.   C-Kermit> run rz <&\v(ttyfd) >&\v(ttyfd)
  716.  
  717. Here are some macros from Rick Calder <rick@rick.att.com> for invoking
  718. external protocols from C-Kermit.  These assume your shell is ksh or bash, and
  719. that the sz, rz, sx, rx, etc, programs are in /usr/local/bin:
  720.  
  721. ; Send specified file(s) with ZMODEM
  722. ;
  723. define sz if = \v(argc) 1 FATAL {Send what file ?}, -
  724.   if not exist \%1 FATAL {File \%1 not found.}, -
  725.   run /usr/local/bin/sz -
  726.     \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 <&\v(ttyfd) >&\v(ttyfd), -
  727.   connect
  728.  
  729. ; Receive file or files with ZMODEM
  730. ;
  731. define rz run /usr/local/bin/rz <&\v(ttyfd) >&\v(ttyfd), connect
  732.  
  733. ; Send specified file(s) with YMODEM
  734. ;
  735. define sb if = \v(argc) 1 FATAL {Send what file ?}, -
  736.   if not exist \%1 FATAL {File \%1 not found.}, -
  737.   run /usr/local/bin/sb -
  738.     \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9 <&\v(ttyfd) >&\v(ttyfd), -
  739.   connect
  740.  
  741. ; Receive with YMODEM
  742. ;
  743. define rb run /usr/local/bin/rb <&\v(ttyfd) >&\v(ttyfd), connect
  744.  
  745. ; Send a single file with XMODEM
  746. ;
  747. define sx if = \v(argc) 1 FATAL {Send what file ?}, -
  748.   if not exist \%1 FATAL {File \%1 not found.}, -
  749.   run /usr/local/bin/sx \%1 \%2 \%3 \%4 \%5 \%6 \%7 \v(ttyfd) >&\v(ttyfd), -
  750.   connect
  751.  
  752. ; Receive with XMODEM (receiver must be told the filename too)
  753. ;
  754. define rx if = \v(argc) 1 FATAL {Receive what file ?}, -
  755.   run /usr/local/bin/rx \%1 <&\v(ttyfd) >&\v(ttyfd), -
  756.   connect
  757.  
  758. Put these definitions in your .mykermrc file and use them like this:
  759.  
  760.   C-Kermit>rz
  761.   C-Kermit>sz oofa.txt
  762.  
  763. etc.  As Rick says, "This now gives me one terminal emulator to use for both
  764. my UNIX and my MSDOS systems, with full file transfer protocol options,
  765. regardless of what the remote offers.  Finally, one size fits all!"  To that,
  766. we should add that X-, Y-, and ZMODEM need be used only when Kermit transfers
  767. are not available, since with long packets, sliding windows, and
  768. control-character unprefixing, Kermit is just as fast -- and almost always
  769. faster -- than X-, Y-, and ZMODEM.
  770.  
  771.  
  772. MISCELLANEOUS
  773.  
  774. One user reported trouble running C-Kermit on a NeXT from within NeXT's
  775. Subprocess class under NeXTstep 3.0, and/or when rlogin'd from one NeXT to
  776. another: Error opening /dev/tty:, congm: No such device or address.  Diagnosis:
  777. Bug in NeXTSTEP 3.0, cure unknown.
  778.  
  779. If C-Kermit has problems opening files in writable directories when it is
  780. installed setuid or setgid on BSD-based versions of UNIX such
  781. as NeXT Mach 3.0, it probably needs to be rebuild with the -DSW_ACC_ID
  782. comilation switch (see ckuins.doc).
  783.  
  784. Reportedly, when coming into a Sequent UNIX (DYNIX) system through an X.25
  785. connection, Kermit doesn't work right because the Sequent's FIONREAD ioctl
  786. returns incorrect data.  To work around, use the 1-character-at-a-time version
  787. of myread() in ckutio.c (i.e. undefine MYREAD in ckutio.c and rebuild the
  788. program).
  789.  
  790. There have been reports of file transfer failures on SUN 3 systems when using
  791. long packets and/or large window sizes.  One user says that when this happens,
  792. the console issues many copies of this message:
  793.  
  794.   chaos vmunix: zs1: ring buffer overflow
  795.  
  796. This means that SunOS (UNIX) is not scheduling Kermit frequently enough to
  797. service interrupts from the zs serial device (Zilog 8350 SCC serial
  798. communication port) before its input silo overflows.  Workaround: use smaller
  799. packets and/or a smaller window size, or use "nice" to increase Kermit's
  800. priority.  Use hardware flow control if available, or remove other active
  801. processes before running Kermit.
  802.  
  803. ------------------------------
  804.  
  805. USER REPORTS -
  806.  
  807. Date: Thu, 12 Mar 92 1:59:25 MEZ
  808. From: Walter Mecky <walter@rent-a-guru.de>
  809. Subject: Help.Unix.sw
  810. To: svr4@pcsbst.pcs.com, source@usl.com
  811.  
  812. PRODUCT:    Unix
  813. RELEASE:    Dell SVR4 V2.1 (is USL V3.0)
  814. MACHINE:    AT-386
  815. PATHNAME:    /usr/lib/libc.so.1
  816.         /usr/ccs/lib/libc.a
  817. ABSTRACT:    Function ttyname() does not close its file descriptor
  818. DESCRIPTION:
  819.     ttyname(3C) opens /dev but never closes it. So if it is called
  820.     often enough the open(2) in ttyname() fails. Because the broken
  821.     ttyname() is in the shared lib too all programs using it can
  822.     fail if they call it often enough. One important program is
  823.     uucico which calls ttyname for every file it transfers.
  824.  
  825. Here is a little test program if your system has the bug:
  826.  
  827. #include <stdlib.h>
  828. #include <stdio.h>
  829. main() {
  830.     int i = 0;
  831.     while (ttyname(0) != NULL)
  832.       i++;
  833.     perror("ttyname");
  834.     printf("i=%d\n", i);
  835. }
  836.  
  837. If this program runs longer than some seconds you don't have the bug.
  838.  
  839. WORKAROUND:
  840.     None
  841. FIX:
  842.     Very easy if you have source code.
  843.  
  844. Another user reports some more explicit symptoms and recoveries:
  845.  
  846. > What happens is when invoking ckermit we get one of the following
  847. > error messages:
  848. >   You must set line
  849. >   Not a tty
  850. >   No more processes.
  851. > One of the following three actions clears the peoblem:
  852. >   shutdown -y -g0 -i6
  853. >   kill -9 the ttymon with the highest PID
  854. >   Invoke sysadm and disable then enable the line you want to use.
  855. > Turning off respawn of sac -t 300 and going to getty's and uugetty's 
  856. > does not help.
  857. > Also C-Kermit reports "?timed out closing /dev/ttyxx".
  858. > If this happens all is well.
  859.  
  860. ------------------------------
  861.  
  862. Date: Wed, 6 Jun 90 23:51:10 PDT
  863. From: dunlap@apl-em.apl.washington.edu (John Dunlap)
  864. To: fdc@watsun.cc.columbia.edu
  865. Subject: Re:  C-Kermit 5A Edit 144
  866.  
  867. I should mention that I have discovered a bug in C-Kermit using HP-UX version
  868. 5.21 on the HP-9000 series 500 computers.  This bug seems to have been present
  869. at least as far back as version 095.  It only occurs when the controlling
  870. terminal is using an HP-27140 six port modem mux.  The problem is not present
  871. if the controlling terminal is logged into an HP-27130 eight port mux.  The
  872. symptom is that just after dialing successfully and connecting Kermit locks up
  873. and the port is unusable until both forks of Kermit and the login shell are
  874. killed.
  875.  
  876. This may be why some people are saying that Kermit won't work for them on the
  877. series 800 HP computers -- the 27140 6 port modem mux is used on that computer
  878. while the 27140 8 port mux cannot be used.
  879.  
  880. One of these months I may be able to test this a bit more, but for the time
  881. being I just moved my terminal port to the 8 port mux!
  882.  
  883. ------------------------------
  884.  
  885. Date: Mon, 15 Jun 92 17:16:21 -0400
  886. From: fuller@wccs (Charles S. Fuller)
  887. Subject: kermit under HP-UX -- solved!
  888.  
  889. To make C-Kermit work on HP-UX 8.05 on an HP720, obtain and install HP-UX
  890. patch PHNE_0899.  This patch deals with a lot of driver issues, particularly
  891. related to communication at higher speeds.
  892.  
  893. ------------------------------
  894.  
  895. Date: Tue, 16 Oct 90 23:35:26 -0400
  896. From: wbader@scarecrow.csee.lehigh.edu (William Bader)
  897. To: fdc@watsun.cc.columbia.edu
  898. Subject: ckermit 159 notes
  899.  
  900. The changes to the update file mentioned something about putting alarms
  901. on some I/O calls to prevent flow control deadlocks.  Device drivers in
  902. Xenix (and possibly other ports of versions of AT&T Unix V.2 and V.3) have a
  903. higher priority than signals, which means that an alarm (or any signal
  904. including SIGKILL!) will not always interrupt a deadlocked read.
  905. When you turn off flow control on Xenix, there is a short window where an
  906. incoming ^S can get accepted, but no ^Q can be sent because flow control
  907. was turned off slightly after the ^S.
  908.  
  909. [C-Kermit 4C would sometimes hang for this reason, and we could kill
  910. the shell to use that terminal, but the kermit process itself would
  911. become a zombie.]
  912.  
  913. It might be possible (although not portable) to use select().
  914.  
  915. ------------------------------
  916.  
  917. (Note: the following problem also occurs on SGI and probably many other
  918. UNIX systems):
  919.  
  920. From: James Spath <spath@jhunix.hcf.jhu.edu>
  921. To: Info-Kermit-Request@cunixf.cc.columbia.edu
  922. Date: Wed, 9 Sep 1992 20:20:28 -0400
  923. Subject: C-Kermit vs uugetty (or init) on Sperry 5000
  924.  
  925. We have sucessfully compiled the above release on a Unisys/Sperry 5000/95.  We
  926. used the sys5r3 option, rather than sys5r2 since we have VR3 running on our
  927. system.  In order to allow dialout access to non-superusers, we had to do
  928. "chmod 666 /dev/tty###", where it had been -rw--w--w- (owned by uucp), and to
  929. do "chmod +w /usr/spool/locks".  We have done text and binary file transfers
  930. through local and remote connections.
  931.  
  932. The problem concerning uucp ownership and permissions is worse than I thought
  933. at first.  Apparently init or uugetty changes the file permissions after each
  934. session.  So I wrote the following C program to open a set of requested tty
  935. lines.  I run this for any required outgoing line prior to a Kermit session.
  936.  
  937.    ------ cut here -------
  938. /* opentty.c -- force allow read on tty lines for modem i/o */
  939. /* idea from: restrict.c -- Systsem 5 Admin book Thomas/Farrow p. 605 */
  940. /* /jes jim spath {spath@jhunix.hcj.jhu.edu } */
  941. /* 08-Sep-92 NO COPYRIGHT. */
  942. /* this must be suid to open other tty lines */
  943.  
  944. /* #define DEBUG */
  945. #define TTY "/dev/tty"
  946. #define LOK "/usr/spool/locks/LCK..tty"
  947. #include <stdio.h>
  948.  
  949. /* allowable lines: */
  950. #define TOTAL_LINES 3
  951. static char allowable[TOTAL_LINES][4] = { "200", "201", "300" };
  952. static int total=TOTAL_LINES;
  953. int allow;
  954.  
  955. /* states: */
  956. #define TTY_UNDEF 0
  957. #define TTY_LOCK  1
  958. #define TTY_OKAY  2
  959.  
  960. main(argc, argv)
  961. int argc; char *argv[]; {
  962.     char device[512];
  963.     char lockdev[512];
  964.     int i;
  965.     if (argc == 1) {
  966.     fprintf(stderr, "usage: open 200 [...]\n");
  967.     }
  968.     while (--argc > 0 && (*++argv) != NULL ) {
  969. #ifdef DEBUG
  970.     fprintf(stderr, "TRYING: %s%s\n", TTY, *argv);
  971. #endif
  972.     sprintf(device, "%s%s", TTY, *argv);
  973.     sprintf(lockdev, "%s%s", LOK, *argv);
  974.     allow = TTY_UNDEF; i = 0;
  975.     while (i <= total) { /* look at all defined lines */
  976. #ifdef DEBUG
  977.         fprintf(stderr, "LOCKFILE? %s?\n", lockdev);
  978. #endif
  979.         if (access(lockdev, 00) == 0) {
  980.         allow=TTY_LOCK;
  981.         break;
  982.         }
  983. #ifdef DEBUG
  984.         fprintf(stderr, "DOES:%s==%s?\n", allowable[i], *argv);
  985. #endif
  986.         if (strcmp(allowable[i], *argv) == 0)
  987.           allow=TTY_OKAY;
  988.         i++;
  989.     }
  990. #ifdef DEBUG
  991.     fprintf(stderr, "allow=%d\n", allow);
  992. #endif
  993.     switch (allow) {
  994.       case TTY_UNDEF:
  995.         fprintf (stderr, "open: not allowed on %s\n", *argv);
  996.         break;
  997.       case TTY_LOCK:
  998.         fprintf (stderr, "open: device locked: %s\n", lockdev);
  999.         break;
  1000.       case TTY_OKAY:
  1001.         /* attempt to change mode on device */
  1002.         if (chmod (device, 00666) < 0)
  1003.           fprintf (stderr, "open: cannot chmod on %s\n", device);
  1004.         break;
  1005.       default:
  1006.         fprintf (stderr, "open: FAULT\n");
  1007.     }
  1008.     }
  1009.     exit (0);
  1010. }
  1011.  
  1012. ------------------------------
  1013.  
  1014. Date: Fri, 30 Oct 92 10:59:51 +0100
  1015. From: fulvio@ssuxos.ICO.OLIVETTI.COM (Fulvio Marino)
  1016. To: fdc@watsun.cc.columbia.edu
  1017. Subject: Re: C-Kermit 5A(185) Ready for Testing
  1018.  
  1019. Some telnetd are broken (in some releases of Sun, Hitachi and X/OS Unixes):
  1020. byte BUFSIZ (i.e., buf[BUFSIZ-1]) is not passed to the attached processes.
  1021. Two side effects:
  1022.  
  1023.  a. if the receive packet-len (on remote server) is >= BUFSIZ, there is no way
  1024.     to send a packet of data (the BUFSIZ-th byte is always lost)
  1025.  
  1026.  b. if the receive packet-len (on remote server) is < BUFSIZ, then you can
  1027.     *hope* to send some packet of data: remote kernel could ``cat'' the
  1028.     received data so that to give telnetd a bigger input buffer (see "a.").
  1029.  
  1030. Possible solutions:
  1031.  
  1032.   - Patch telnetd -- the best way
  1033.  
  1034.   - Use *very* short packets (speed is slowing down) -- the middle way
  1035.  
  1036.   - Change ckutio.c.  I added code to ttol(); actually, the line:
  1037.  
  1038.         x = write(ttyfd,s,n);    /* Write string to device */
  1039.  
  1040.     is writing a full packet (or a piece of it, in case of partial writes).
  1041.     My idea is to split this up into many little writes, sleeping between
  1042.     them; I use an "extern int splitted_bsz" to know if a ``splitting'' is
  1043.     required or not; the msecs for msleep() are computed in a way that is
  1044.     giving good results on X/OS.  splitted_bsz (and, possibly, the msecs to
  1045.     sleep) should be set by the user only in our special case.  This code
  1046.     works.  I suggest to insert it in ckutio.c only if you know that this
  1047.     kind of problem is common.
  1048.  
  1049.     if (splitted_bsz == 0 || n <= splitted_bsz ) {
  1050.         x = write(ttyfd,s,n);    /* Write string to device */
  1051.     } else {
  1052.         extern int    wslots;
  1053.         char    *buf;
  1054.         int        thiswrite, remaining;
  1055.  
  1056.         buf = s;
  1057.         remaining = n;
  1058.         for ( ; ; ) {
  1059.         thiswrite = remaining > splitted_bsz ?
  1060.           splitted_bsz : remaining;
  1061.         if ((x = write(ttyfd, buf, thiswrite)) > 0)
  1062.           msleep(x/(wslots > 1 ? 5 : 10));
  1063.         debug(F101,"ttol splitted","",x);
  1064.         if (x != thiswrite) {
  1065.             if (x < 0 && remaining < n)
  1066.             x = 0; /* i.e. report error only on 1st write */
  1067.             if (x >= 0)
  1068.             x += n - remaining;
  1069.             break; /* error, or partial write */
  1070.         }
  1071.         buf += x;
  1072.         if ((remaining -= x) == 0) {
  1073.             x = n;
  1074.             break; /* success */
  1075.         }
  1076.         }
  1077.     }
  1078. -- 
  1079. Fulvio MARINO (Tel.#: +39-125-52-8493)
  1080. Ing. C. Olivetti & C.
  1081. OS&N/R&D/MV Progetto X/OS, n.ico 2p.
  1082. via Jervis 77
  1083. I-10015 Ivrea (TO)
  1084. ITALY
  1085.  
  1086. ------------------------------
  1087.