home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / old / ckermit60 / ckuins.doc < prev    next >
Text File  |  2020-01-01  |  80KB  |  1,661 lines

  1. C-KERMIT 6.0 INSTALLATION INSTRUCTIONS FOR UNIX                      -*-text-*-
  2.  
  3.   As of C-Kermit version:  6.0.192
  4.   This file last updated:  Fri Sep  6 23:23:24 1996
  5.  
  6.   Frank da Cruz, Columbia University
  7.  
  8.   Copyright (C) 1985, 1996, Trustees of Columbia University in the City of New
  9.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  10.   sold for profit as a software product itself, nor may it be included in or
  11.   distributed with commercial products or otherwise distributed by commercial
  12.   concerns to their clients or customers without written permission of the
  13.   Office of Kermit Development and Distribution, Columbia University.  This
  14.   copyright notice must not be removed, altered, or obscured.
  15.  
  16. DISCLAIMER:
  17.  
  18.   The C-Kermit software is provided in source code form by Kermit Development
  19.   and Distribution, Columbia University.  The software is provided "as is;" no
  20.   other warranty is provided, express or implied, including without
  21.   limitations, any implied warranty of merchantability or implied warranty of
  22.   fitness for a particular purpose.
  23.  
  24.   Neither Columbia University nor any of the contributors to the C-Kermit
  25.   development effort, including, but not limited to, AT&T, Digital Equipment
  26.   Corporation, Data General Corporation, Hewlett Packard Company, or
  27.   International Business Machines Corporation, warrant C-Kermit software or
  28.   documentation in any way.  In addition, neither the authors of any Kermit
  29.   programs, publications or documentation, nor Columbia University nor any
  30.   contributing institutions or individuals acknowledge any liability resulting
  31.   from program or documentation errors.
  32.  
  33. DOCUMENTATION
  34.  
  35.   Frank da Cruz and Christine M. Gianone, "Using C-Kermit", Second Edition,
  36.   Digital Press / Butterworth-Heinemann, Woburn, MA, 1997, ISBN 1-55558-164-1
  37.  
  38.   US single-copy price: $39.95; quantity discounts available.  Available in
  39.   computer bookstores or directly from Columbia University:
  40.  
  41.     Kermit Development and Distribution
  42.     Columbia University Academic Information Systems
  43.     612 West 115th Street
  44.     New York, NY  10025-7799  USA
  45.     Telephone: (USA) 212 854-3703
  46.  
  47.   Domestic and overseas orders accepted.  Price: $39.95 (US, Canada, and
  48.   Mexico), $50 elsewhere.  Orders may be paid by MasterCard or Visa, or
  49.   prepaid by check in US dollars.  Add $35 bank fee for checks not drawn on
  50.   a US bank.  Price includes shipping.  Do not include sales tax.
  51.   Inquire about quantity discounts.
  52.  
  53.   You can also order by phone from the publisher, Digital Press /
  54.   Butterworth-Heinemann, with MasterCard, Visa, or American Express:
  55.  
  56.     +1 800 366-2665   (Woburn, Massachusetts office for USA & Canada)
  57.     +44 1865 314627   (Oxford, England distribution centre for UK & Europe)
  58.     +61 03 9245 7111  (Melbourne, Vic, office for Australia & NZ)
  59.     +65 356-1968      (Singapore office for Asia) 
  60.     +27 (31) 2683111  (Durban office for South Africa)
  61.  
  62.   A German-language edition is also available:
  63.  
  64.     Frank da Cruz and Christine M. Gianone, "C-Kermit - Einfuehrung und
  65.     Referenz", Verlag Heinz Heise, Hannover, Germany (1994).
  66.     ISBN 3-88229-023-4.  Deutsch von Gisbert W. Selke.  Price: DM 90,00.  
  67.     Verlag Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover.
  68.     Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 53-1 29.
  69.  
  70. OVERVIEW
  71.  
  72. This file contains UNIX-specific information.  For a description of general
  73. (system-independent) configuration options for C-Kermit, please read the file
  74. CKCCFG.DOC.  For information about known limitations or bugs, and possible
  75. workarounds, see the files CKERMIT.BWR and CKUKER.BWR.
  76.  
  77.  
  78. BUILDING C-KERMIT FOR UNIX
  79.  
  80. UNIX C-Kermit is built using the "make" utility, which contains the rules for
  81. building the program for each of the hundreds of different kinds of UNIX
  82. systems that C-Kermit attempts to support.  "make" is driven by a file called
  83. "makefile".  If your distribution does not contain a file with this name, then
  84. rename the file called ckuker.mak to makefile:
  85.  
  86.   mv ckuker.mak makefile
  87.  
  88. and then you type "make xxx", where xxx is the system you want to build
  89. C-Kermit for.  These are listed in the comments at the top of the makefile.
  90. For example, to build C-Kermit for Berkeley UNIX 4.2, type:
  91.  
  92.   make bsd
  93.  
  94. Also check to see if there are comments about your particular version in its
  95. makefile entry itself.  In a text editor such as EMACS or VI, search for the
  96. make entry name followed by a colon, e.g. "linux:" (if you really are building
  97. C-Kermit for Linux, do this now).
  98.  
  99. If your compiler supports a compile-time option to treat ALL chars (and
  100. char *'s, etc) as unsigned, by all means use it -- and send me email to let
  101. me know what it is.
  102.  
  103. To add compilation options (which are explained later in this document) to
  104. your makefile entry without editing the makefile, include "KFLAGS=..." on the
  105. make command line, for example:
  106.  
  107.   make linux KFLAGS=-DNODEBUG
  108.   make bsd "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET"
  109.  
  110. Multiple options must be separated by spaces.  Quotes are necessary if the
  111. KFLAGS= clause includes spaces.  The KFLAGS are added to the end of the CFLAGS
  112. that are defined in the selected makefile entry.  For example, the "bsd" entry
  113. includes -DBSD4 -DTCPSOCKET, so the second example above compiles Kermit with
  114. the following options:
  115.  
  116.   -DBSD4 -DTCPSOCKET -DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET
  117.  
  118. (Notice how "-UTCPSOCKET" is used to negate the effect of the "-DTCPSOCKET"
  119. option that is included in the makefile entry.)
  120.  
  121. WARNING: Be careful with KFLAGS.  If you build C-Kermit, change some files,
  122. and then run make again using the same make entry but specifying different
  123. KFLAGS than last time, make won't detect it and you could easily wind up with
  124. inconsistent object modules, e.g. some of them built with a certain option,
  125. others not.  When in doubt, "make clean" first to make sure all your object
  126. files are consistent.  Similarly, if you change CFLAGS, LIBS, or any other
  127. items in the makefile, or you rebuild using a different makefile entry, "make
  128. clean" first.
  129.  
  130. 2.10 and 2.11 BSD
  131.  
  132. Use the separate makefile ckubs2.mak.  Read the instructions in that file.
  133.  
  134. PLAN 9
  135.  
  136. Use the separate makefile ckpker.mk.
  137.  
  138. SYSTEM-WIDE INITIALIZATION FILE
  139.  
  140. If you want to define a system-wide initialization file for C-Kermit, rather
  141. than making each user have her/his own copy, define the symbol CK_SYSINI to be
  142. the full pathname of the file, e.g.:
  143.  
  144.   -DCK_SYSINI=\\\"/usr/local/lib/kermit/ckermit.ini\\\"
  145.  
  146. You'll have to edit the makefile to add this, because there is no good method
  147. for putting it on the 'make' command line with KFLAGS -- the number of escapes
  148. (\\\\...) for the doublequotes would depend on how deeply the particular make
  149. entry is nested; each level of nesting strips off another layer of escapes.
  150.  
  151. Or, you can define CK_DSYSINI (note "D") to build C-Kermit with its built-in
  152. default name for a system-wide init file, /usr/local/bin/ckermit.ini, or
  153. /usr/share/lib/kermit/ckermit.ini, depending on which version of UNIX it is.
  154. Since no quoting is needed, this one works with KFLAGS, e.g.:
  155.  
  156.   make sunos41c KFLAGS=-DCK_DSYSINI
  157.  
  158. The question arises: if you want C-Kermit to have a system-wide initialization
  159. file, should it take precedence over the user's own?  There are valid reasons
  160. for answering yes or no.  By default, if you build C-Kermit with a system-wide
  161. initialization file, it will take precedence over the user's -- that is, it
  162. will be executed instead of the user's, if the user has one.  You might also
  163. want to set things up so the user's init file is executed if she has one, but
  164. if she doesn't, the system-wide one will be.  Either setup is possible.
  165. Assuming CK_SYSINI is defined, then the following symbols determine the order:
  166.  
  167.   CK_INI_A
  168.     This means the system-wide init file is looked for first; if found, it
  169.     is executed.  If not found, the user's init file is executed.
  170.  
  171.   CK_INI_B
  172.     This means the user's init file is looked for first; if found, it is
  173.     executed.  If not found, the system-wide init file is executed.
  174.  
  175. If CK_SYSINI is defined, but neither CK_INI_A nor CK_INI_B are defined (or
  176. both of them are), then CK_INI_A is assumed.
  177.  
  178. If you build Kermit with CK_SYSINI and CK_INI_A, you can "chain" to the user's
  179. own initialization file (if any) by ending (or starting, depending on the
  180. desired precedence) the system-wide init file with a command like:
  181.  
  182.   if exist \v(home).kermrc take \v(home).kermrc
  183.  
  184. INSTALLING THE KERMIT FILES
  185.  
  186. There is an "install" entry in the makefile, but since every site has its
  187. own layout and requirements, it is better to install the Kermit files by hand.
  188.  
  189. After you have built and tested the C-Kermit program successfully, you can
  190. discard the object (ck*.o) files, which are no longer needed.  Use "make
  191. clean" to do this.  If you don't need the source files (ck[cuw]*.[cwh]), you
  192. can remove them too.
  193.  
  194. You should install the C-Kermit program in a directory that is in the users'
  195. PATH, but that is not likely to be overwritten when you install a new version
  196. of the operating system.  A good candidate would be the /usr/local/bin/
  197. directory.  Example:
  198.  
  199.   mv wermit /usr/local/bin/kermit
  200.   chmod 775 /usr/local/bin/kermit
  201.  
  202. You should also install the man page, which is called ckuker.nr, in the
  203. man page directory for local commands, such as /usr/man/manl/, renamed
  204. appropriately, e.g. to kermit.l.
  205.  
  206. Several text files should be placed in a publicly readable directory, and the
  207. man page should be altered, if necessary (in the FILES section), to point to
  208. that directory.  Suggested directory names are:
  209.  
  210.   /usr/local/lib/kermit
  211.   /usr/share/lib/kermit
  212.  
  213. The files are:
  214.  
  215.   READ.ME
  216.     Explanation of the following files.  Create this file by clipping
  217.     out the following file list.
  218.  
  219.   ckermit.ini
  220.     The standard initialization file.  Users should copy this to
  221.     their home directories and rename it to .kermrc.  (In C-Kermit 5A(190)
  222.     and later, you can designate a single copy as the system-wide
  223.     initialization file; details above).
  224.  
  225.   ckermod.ini
  226.     A sample customization file.  Users should copy this file to
  227.     their home directories, make any desired modifications (user- or
  228.     site-specific customizations), and rename it to .mykermrc.
  229.  
  230.   ckermit.kdd
  231.     A sample dialing directory file.
  232.  
  233.   ckermit.knd
  234.     A sample network directory.
  235.  
  236.   ckermit.ksd
  237.     A sample services directory.
  238.  
  239.   ckedemo.ksc
  240.     Macro definitions from "Using C-Kermit".
  241.  
  242.   ckevt.ksc
  243.     Command file to demonstrate special screen effects from "Using C-Kermit".
  244.  
  245.   ckepage.ksc
  246.     A sample script for sending alphanumeric pages.
  247.  
  248.   ckurzsz.ini
  249.     Macros for using rz and sz as external protocols.
  250.  
  251.   ckermit.upd
  252.     A file listing the updates, changes, and corrections made to C-Kermit
  253.     since publication of "Using C-Kermit".
  254.  
  255.   ckermit.bwr
  256.     The general C-Kermit "beware" file.
  257.  
  258.   ckuker.bwr
  259.     The UNIX-specific C-Kermit beware file.
  260.  
  261. THE INITIALIZATION FILE
  262.  
  263. We recommend that the C-Kermit initialization file, named ckermit.ini in the
  264. distribution, be executed by all users, since it defines and sets up certain
  265. important features, such as the dialing directory, services directory,
  266. commonly-used macros, etc.  On multiuser systems, it can be put in a common
  267. place and shared by all users, but this requires building C-Kermit from source
  268. in a special way, which embeds the full path of common initialization file in
  269. the program binary, described above.
  270.  
  271. Alternatively, each user can copy the ckermit.ini file into her login
  272. directory and rename it to .kermrc.
  273.  
  274. The user's private "customization file" goes in the login directory and is
  275. called .mykermrc.
  276.  
  277. UNIX MAKEFILE
  278.  
  279. The makefile is quite long, and at least two versions of UNIX, SCO Xenix/286
  280. and 2.x BSD, cannot cope with its length.  An attempt to "make sco286" gives
  281. the message "Make: Cannot alloc mem for env..  Stop".  Solution: edit away
  282. some or all of the nonrelevant material from the makefile.   (A separate
  283. version of the makefile is provided for BSD 2.x: ckubs2.mak.)
  284.  
  285. Some make programs reportedly cannot handle continued lines (lines ending
  286. in backslash (\)).  If you have a problem with the makefile, try editing the
  287. makefile to join the continued lines (remove the backslashes and the following
  288. linefeed).
  289.  
  290. Other makefile troubles may occur because tabs in the makefile have somehow
  291. been converted to spaces.  Spaces and tabs are distinct in UNIX makefiles.
  292.  
  293. Similarly, carriage returns might have been added to the end of each line,
  294. which also proves confusing to most UNIX versions of make.
  295.  
  296. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES
  297.  
  298. If you received a DOS-format diskette containing a binary executable C-Kermit
  299. program plus supporting text files, be sure to chmod +x the executable before
  300. attempting to run it.
  301.  
  302. In version 5A(190) and later, all the text files on the C-Kermit DOS-format
  303. diskettes are in UNIX format: LF at the end of each line rather than CRLF.
  304. This means that no conversions are necessary when copying to your UNIX file
  305. system, and that all the files on the diskette, text and binary, can be copied
  306. together.  The following comments apply to the DOS-format diskettes furnished
  307. with version 5A(189) and earlier or to other DOS-format diskettes you might
  308. have obtained from other sources.
  309.  
  310. If you have received C-Kermit on MS-DOS format diskettes (such as those
  311. distributed by Columbia University), you should make sure that your
  312. DOS-to-UNIX conversion utility (such as "dosread") both: (1) changes line
  313. terminators in all files from carriage-return linefeed (CRLF) to just linefeed
  314. (LF) (such as "dosread -a") and remove any Ctrl-Z's, and (2) that all
  315. filenames are converted from uppercase to lowercase.  If these conversions
  316. were not done, you can use the following shell script on your UNIX system to
  317. do them:
  318. ---(cut here)---
  319. #!/bin/sh
  320. #
  321. # Shell script to convert C-Kermit DOS-format files into UNIX format.
  322. # Lowercases the filenames, strips out carriage returns and Ctrl-Z's.
  323. #
  324. x=$1 # the name of the source directory
  325. y=$2 # the name of the target directory if [ $# -lt 2 ]; then
  326.   echo "usage: $0 source-directory target-directory"
  327.   exit 1
  328. fi
  329. if cd $1 ; then
  330.   echo "Converting files from $1 to $2"
  331. else
  332.   echo "$0: cannot cd to $1"
  333.   exit 1
  334. fi
  335. for i in *; do
  336.   j=`echo $i | tr 'A-Z' 'a-z'`
  337.   echo $x/$i =\> $y/$j
  338.   tr -d '\015\032' < $i > $y/$j
  339. done
  340. ---(cut here)---
  341. Cut out this shell script, save it as "convert.sh" (or any other name you
  342. prefer), then "chmod +x convert.sh".  Then, create a new, empty directory
  343. to put the converted files in, and then "convert.sh /xxx /yyy" where /xxx
  344. is the name of the directory where the PC-format files are, and /yyy is the
  345. name of the new, empty directory.  The converted files will appear in the
  346. new directory.
  347.  
  348. CHECKING THE RESULTS
  349.  
  350. Here are several quick checks you can run to tell whether your version of
  351. C-Kermit was built correctly for your UNIX system.
  352.  
  353.  0. Start C-Kermit (usually by typing "./wermit" in the directory where you ran
  354.     the makefile).  Do you see the C-Kermit> prompt?  If not, C-Kermit
  355.     incorrectly deduced that it was running in the background.  The test is in
  356.     conbgt() in ckutio.c.  If you can fix it for your system, please send in
  357.     the fix (Hint: read about "PID_T" below).  Otherwise, you can force
  358.     C-Kermit to foreground mode by starting it with the -z command line option,
  359.     as in "kermit -z", or giving the interactive command SET BACKGROUND OFF.
  360.  
  361.  1. When you type characters at the C-Kermit prompt, do they echo immediately?
  362.     If not, something is wrong with concb() and probably the other terminal
  363.     mode settings routines in ckutio.c.  Be sure you have used the most
  364.     appropriate make entry.
  365.  
  366.  2. At the C-Kermit> prompt, type "send *?".  C-Kermit should list all the
  367.     files in the current directory.  If not, it was built for the wrong type of
  368.     UNIX file system.  Details below.  In the meantime, try SET
  369.     WILDCARD-EXPANSION SHELL as a workaround.
  370.  
  371.  3. Create a file with a long name in your current directory, e.g.:
  372.  
  373.     % touch thisisafilewithaveryveryveryveryveryveryveryverylooooooooongname
  374.  
  375.     Check with ls to see if your version of UNIX truncated the name.  Now start
  376.     C-Kermit and type "send thisis<ESC>".  Does Kermit complete the name,
  377.     showing the same name as ls did?  If not, wrong filesystem.  Read on.
  378.  
  379.  3.5 - Make sure that Kermit has the maximum path length right.  Just type
  380.     SHOW FILE and see what it says about this.  If it is too short, there
  381.     could be some problems at runtime.  To correct, look in ckcdeb.h to see
  382.     how the symbol CKMAXPATH is set and make any needed adjustments.
  383.  
  384.  4. Type Ctrl-C (or whatever your UNIX interrupt character is) at the prompt.
  385.     Do you get "^C..." and a new prompt?  If instead, you get a core dump
  386.     (this shouldn't happen any more) "rm core" and then rebuild with
  387.     -DNOCCTRAP added to your CFLAGS.  If it did work, then type another
  388.     Ctrl-C.  If this does the same thing as the first one, then Ctrl-C
  389.     handling is OK.  Otherwise, the SIGINT signal is either not getting
  390.     re-armed (shouldn't happen) or is being masked off after the first time it
  391.     is caught, in which case, if your UNIX is POSIX-based, try rebuilding
  392.     C-Kermit with -DCK_POSIX_SIG.
  393.  
  394.  5. Type Ctrl-Z (or whatever your UNIX suspend character is) to put C-Kermit
  395.     in the background.  Did it work?  If nothing happened, then (a) your
  396.     version of UNIX does not support job control, or (b) your version of
  397.     C-Kermit was probably built with -DNOJC.  If your session became totally
  398.     frozen, then you are probably running C-Kermit on a UNIX version that
  399.     supports job control, but under a shell that doesn't.  If that's not the
  400.     case, look in the congm() and psuspend() routines in ckutio.c and see if
  401.     you can figure out what's wrong.  If you can't, rebuild with -DNOJC.
  402.  
  403.  6. Try dialing out: SET MODEM TYPE <whatever>, SET LINE <whatever>, SET 
  404.     SPEED <whatever>, DIAL <phone-number>.  If it doesn't work, keep reading.
  405.     After dialing, can you REDIAL?
  406.  
  407.  7. If your version was built with TCP/IP network support, try the TELNET
  408.     command.
  409.  
  410.  8. Transfer some files in remote mode on incoming asynchronous serial (direct
  411.     or modem) connections, and on incoming network (telnet, rlogin, terminal
  412.     server) connections.
  413.  
  414.  9. Establish a serial connection from C-Kermit to another computer (direct
  415.     or dialed) and transfer some files.  If you have network support, do the
  416.     same with a network connection.
  417.  
  418. 10. If your version was built with fullscreen file transfer display support,
  419.     check that it works during local-mode file transfer.  Also, check
  420.     C-Kermit's operation afterwards: is the echoing funny?  etc etc.  If there
  421.     are problems, see the section THE FULLSCREEN FILE TRANSFER DISPLAY below.
  422.  
  423. 11. If your version was built with script programming language support,
  424.     TAKE the ckedemo.ksc file to give it a workout.
  425.  
  426. 12. Does C-Kermit interlock correctly with UUCP-family programs (cu, tip,
  427.     uucp, etc)?  If not, read the section DIALING OUT AND COORDINATING WITH
  428.     UUCP below.
  429.  
  430. 13. Modem signals...  Give a SET LINE command to a serial device and then type
  431.     the SHOW MODEM command.  If it says "Modem signals unavailable in this
  432.     version of Kermit", then you might want to look at the ttgmdm() routine in
  433.     ckutio.c and add the needed code -- if indeed your version of UNIX
  434.     provides a way to get modem signals (many don't).
  435.  
  436.     If it says "Modem signals unavailable", then it is likely that the API
  437.     for getting modem signals is provided, but it doesn't actually do
  438.     anything (e.g. ioctl(ttyfd,TIOCMGET,&x) returns EINVAL).
  439.  
  440.     In any case, it still should be able to manipulate the DTR signal.  To
  441.     test, SET LINE <name-of-dialout-device>, SET MODEM NONE, and HANGUP.
  442.     The DTR light should go out momentarily.  If it doesn't, see if you can
  443.     add the needed code for your system to the tthang() routine in ckutio.c.
  444.  
  445.     If your version of Kermit has the SET FLOW RTS/CTS command, check to
  446.     see if it works: give Kermit this command, set your modem for RTS/CTS,
  447.     transfer some files (using big packet and window sizes) and watch the
  448.     RTS and CTS lights on the modem.  If they go on and off (and Kermit does
  449.     not get packet errors), then it works.  If your version of Kermit does
  450.     not have this command, but your version of UNIX does support hardware
  451.     flow control, take a look at the tthflow() command in ckutio.c and see
  452.     if you can add the needed code (see the section on HARDWARE FLOW
  453.     CONTROL below).
  454.  
  455.     (And please send back any added code to the author, so that others can 
  456.     benefit from it and it can be carried forward into future releases.)
  457.  
  458. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE
  459.  
  460. 1. Many of C-Kermit's options and features can be deselected at compile time.
  461.    The greatest savings at the least sacrifice in functionality is to disable
  462.    the logging of debug information by defining NODEBUG during compilation.
  463.    See the ckccfg.doc file for further information.
  464.  
  465. 2. Use shared libraries rather than static linking.  This is the default on
  466.    many UNIX systems anyway.  However, executables built for dynamic linking
  467.    with shared libraries are generally not portable away from the machine they
  468.    were built on.
  469.  
  470. 3. Most UNIX systems have a "strip" command to remove symbol table information
  471.    from an executable program image.  "man strip" for further information.
  472.    The same effect can be achieved by including "-s" among the link flags when
  473.    building C-Kermit.
  474.  
  475. 4. SCO, Interactive, and some other UNIX versions have an "mcs" command.
  476.    "mcs -d wermit" can be used to delete the contents of the ".comment"
  477.    section from the executable program image.
  478.  
  479. 5. Many modern optimizers can be instructed to optimize for space rather than
  480.    execution efficiency.  Check the CFLAGS in the makefile entry, adjust as
  481.    desired.
  482.  
  483. DYNAMIC MEMORY ALLOCATION
  484.  
  485. If the makefile entry for your version of C-Kermit does not include -DDYNAMIC,
  486. try adding it.  This should make the program image smaller, and it will
  487. allow you to use much longer packets and bigger window sizes.  If this works
  488. on your system, please notify the author at the address above.  In general,
  489. there is no reason not to use this feature if it works.
  490.  
  491. TCP/IP NETWORKING
  492.  
  493. If the makefile entry for your version of C-Kermit does not include TCP/IP
  494. support, but your UNIX system does support TCP/IP using the Berkeley sockets
  495. library, or some variation of it, try adding -DTCPSOCKET to your makefile
  496. entry.  If it "almost works", there are some other switches you can add to
  497. force recognition of the various slightly-incompatible TCP/IP implementations
  498. (-DWOLLONGONG, -DEXCELAN, -DINTERLAN, etc).
  499.  
  500. Reportedly, even some of these are not consistent within themselves.  For
  501. example, Wollongong reportedly puts header files in different directories for
  502. different UNIX versions:
  503.  
  504.   in.h can be in either /usr/include/sys or /user/include/netinet.
  505.   telnet.h can be in either /usr/include/arpa or /user/include/netinet.
  506.   inet.h can be in either /usr/include/arpa or /user/include/sys.
  507.  
  508. In cases like this, it's better to make links in the file system than it
  509. is to hack up the C-Kermit source code.  Suppose, for example, Kermit is
  510. looking for telnet.h in /usr/include/arpa, but on your system it is in
  511. /usr/include/netinet.  Do this (as root, or get the system manager to do it):
  512.  
  513.   cd /usr/include/arpa
  514.   ln /usr/include/netinet/telnet.h telnet.h
  515.  
  516. ("man ln" for details about links.)
  517.  
  518. THE FULLSCREEN FILE TRANSFER DISPLAY
  519.  
  520. For fullscreen file transfer display support, add -DCK_CURSES to your makefile
  521. entry (if necessary; many entries already have it, generally the ones ending
  522. in "c", for example "make sunos41c").  The screen handling is accomplished in
  523. UNIX using the curses library.  If you are creating a new makefile entry to
  524. include the fullscreen display, you must add one of the following to your UNIX
  525. makefile entry (whatever works):
  526.  
  527.   "LIBS= -lcurses -ltermcap"
  528.   "LIBS= -lcurses -ltermlib"
  529.   "LIBS= -lcurses"
  530.   "LIBS= -ltermlib"
  531.  
  532. to pull in the required libraries.  "man curses" for further information, and
  533. search through the makefile for "CK_CURSES" to see many examples.
  534.  
  535. In System V, there might be a complication.  Apparently System V curses (or at
  536. least some implementations of it) reserve the right to alter the buffering on
  537. the output file without restoring it afterwards, which can leave Kermit's
  538. command processing in a mess when the prompt comes back after a fullscreen
  539. file transfer display.  If you experience problems such as these, try adding
  540.  
  541.   -DCK_NEWTERM
  542.  
  543. to your makefile entry (see comments in screenc() in ckuusx.c for an
  544. explanation).
  545.  
  546. In SCO Xenix and SCO UNIX, there are two separate curses libraries, one based
  547. on termcap and the other based on terminfo.  The default library, usually
  548. terminfo, is established when the development system is installed.  To
  549. manually select terminfo (at compile time):
  550.  
  551.   compile -DM_TERMINFO and link -ltinfo
  552.  
  553. and to manually select termcap:
  554.  
  555.   compile -DM_TERMCAP and link -ltcap -ltermlib
  556.  
  557. <curses.h> looks at M_TERMINFO and M_TERMCAP to decide which header files to
  558. use.  /usr/lib/libcurses.a is a link to either libtinfo.a or libtcap.a.  The
  559. C-Kermit compilation options must agree with the version of the curses library
  560. that is actually installed.
  561.  
  562. NOTE: If you are doing an ANSI-C compilation and you get compile time warnings
  563. like the following:
  564.  
  565.   Warning: function not declared in ckuusx.c: wmove, printw, wclrtoeol,
  566.   wclear, wrefresh, endwin, etc...
  567.  
  568. it means that your <curses.h> file does not contain prototypes for these
  569. functions.  The warnings should be harmless.
  570.  
  571. Screen refresh capability (to repaint a file transfer display that was messed
  572. up because of a broadcast message or similar interference) was added in
  573. C-Kermit 5A(190).  A totally satisfactory repainting job can be done only if
  574. the screen management library includes clearok() and wrefresh() functions or
  575. the equivalent.  To enable the use of these functions, add the following
  576. definition to your CFLAGS:
  577.  
  578.   -DCK_WREFRESH
  579.  
  580. or "#define CK_REFRESH" in ckcdeb.h file.  If this symbol is not defined,
  581. the screen can be only partially refreshed, because some of the information
  582. (such as the filename) has already passed by.
  583.  
  584. UNIX VERSIONS
  585.  
  586. There are several major varieties of UNIX: Bell Laboratories Seventh Edition,
  587. AT&T System V, Berkeley Standard Distribution (BSD), and POSIX.  Each has
  588. many, many subvarieties and descendents, and there are also hybrids that
  589. exhibit symptoms of two or more varieties, plus special quirks of their own.
  590.  
  591. Seventh edition versions of C-Kermit include the compile-time option -DV7 in
  592. the CFLAGS string in the makefile entry.  Various V7-based implementations are
  593. also supported: -DCOHERENT, -DMINIX, etc.
  594.  
  595. AT&T-based versions of UNIX Kermit include the compile-time option -DATTSV
  596. (standing for AT&T UNIX System V).  This applies to System III and to System V
  597. up to and including Release 2.  For System V Release 3, the flag -DSVR3 should
  598. be used instead (which also implies -DATTSV).  This is because the data type
  599. of signal() and several other functions was changed between SVR2 and SVR3.
  600. For System V Release 4, include -DSVR4 because of changes in UUCP lockfile
  601. conventions; this also implies -DSVR3 and -DATTSV.
  602.  
  603. For BSD, the flag -BSDxx must be included, where xx is the BSD version
  604. number, for example BSD4 (for version 4.2 or later, using only 4.2 features),
  605. -DBSD41 (for BSD 4.1 only), -DBSD43 (for 4.3 or later), -DBSD29 (BSD 2.9
  606. for DEC PDP-11s).
  607.  
  608. For POSIX, include the flag -DPOSIX.  POSIX defines a whole new set of
  609. terminal i/o functions that are not found in traditional AT&T or Berkeley
  610. implementations, and also defines the symbol _POSIX_SOURCE, which is used
  611. in many system and library header files, mainly to disable non-POSIX features.
  612.  
  613. There is a tendency for UNIX implementations to be neither pure AT&T nor pure
  614. BSD nor pure POSIX, but a mixture of two or more of these, with "compatibility
  615. features" allowing different varieties of programs to be built on the same
  616. computer.  In general, Kermit tries not to mix & match but to keep a
  617. consistent repertoire throughout.  However, there are certain UNIX
  618. implementations that only work when you mix and match.  For example, the
  619. Silicon Graphics Iris workstation IRIX operating system (prior to version 3.3)
  620. is an AT&T UNIX but with a BSD file system.  The only way you can build Kermit
  621. successfully for this configuration is to include -DSVR3 plus the special
  622. option -DLONGFN, meaning "pretend I was built with -DBSDxx when it's time to
  623. compile directory-related code".  See the "iris" makefile entry.
  624.  
  625. STANDARDS
  626.  
  627. In edits 166-167, C-Kermit was heavily modified to try to keep abreast of new
  628. standards while still remaining compatible with old versions of C and UNIX.
  629. There are two new standards of interest: ANSI C (as described in Kernighan and
  630. Ritchie, "The C Programming Language", Second Edition, Prentice Hall, 1988)
  631. and POSIX.1 (IEEE Standard 1003.1 and ISO/IEC 9945-1, 1990, "Portable
  632. Operating System Interface").  These two standards have nothing to do with
  633. each other: you can build C-Kermit with a non-ANSI compiler for a POSIX
  634. system, or for a non-POSIX system with with an ANSI compiler.
  635.  
  636. (a) POSIX
  637.  
  638. POSIX.1 defines a repertoire of system functions and header files for use by C
  639. language programs.  Most notably, the ioctl() function is not allowed in
  640. POSIX; all ioctl() functions have been replaced by device-specific functions
  641. like tcsetattr(), tcsendbreak(), etc.
  642.  
  643. Computer systems (UNIX, and reportedly also forthcoming versions of VAX/VMS)
  644. that claim some degree of POSIX compliance have made some attempt to put their
  645. header files in the right places and give them the right names, and to provide
  646. system library functions with the right names and calling conventions.  Within
  647. the header files, POSIX-compliant functions are supposed to be within #ifdef
  648. _POSIX_SOURCE..#endif conditionals, and non-POSIX items are not within these
  649. conditionals.
  650.  
  651. If C-Kermit is built with the -DPOSIX flag, it attempts to configure itself
  652. for a pure POSIX environment.  It defines _POSIX_SOURCE, it calls only
  653. POSIX-defined functions, and it includes POSIX-defined header files.
  654.  
  655. If Kermit is built with _D_POSIX_SOURCE but not -DPOSIX, C-Kermit must be
  656. built with one of the -DBSD or -DATTSV flags (or one that implies them), but
  657. still uses only the POSIX features in the system header files.  This allows
  658. C-Kermit to be built on BSD or AT&T systems that have some degree of POSIX
  659. compliance, but still use BSD or AT&T specific features.
  660.  
  661. If Kermit is built with neither _D_POSIX_SOURCE nor -DPOSIX, the functions and
  662. header files of the selected version of UNIX (or VMS, etc) are used according
  663. to the CFLAGS Kermit was built with.
  664.  
  665. The POSIX standard does not define anything about uucp lockfiles.  "make
  666. posix" uses NO (repeat, NO) lockfile conventions.  If your POSIX-compliant
  667. UNIX version uses a lockfile convention such as HDBUUCP (see below), use
  668. the "posix" entry, but include the appropriate lockfile option in your KFLAGS
  669. on the "make" command line, for example:
  670.  
  671.    make posix "KFLAGS=-DHDBUUCP"
  672.  
  673. POSIX.1 also lacks certain other features that Kermit needs.  For example:
  674.  
  675.  - There is no defined way for an application to do wildcard matching of
  676.    filenames.  Kermit uses the inode in the directory structure, but POSIX
  677.    does not include this concept.  POSIX.2 will include functions for this,
  678.    named (I think) glob() and fnmatch(), but these functions are not yet in
  679.    Kermit.
  680.  
  681.  - There is no POSIX mechanism for dealing with modem signals, nor to enable
  682.    RTS/CTS or other hardware flow control.
  683.  
  684.  - There is no way to check if characters are waiting in a communications
  685.    device (or console) input buffer, short of trying to read them -- no
  686.    select(), ioctl(fd,FIONREAD,blah), rdchk(), etc.  This is bad for CONNECT
  687.    mode and bad for sliding windows.
  688.  
  689.  - No way to do a millisecond sleep (no nap(), usleep(), select(), etc).
  690.  
  691.  - There is no popen().
  692.  
  693. So at this point, there cannot be one single fully functional POSIX form of
  694. C-Kermit unless it also has "extensions", as do Linux, QNX, etc.
  695.  
  696. (b) ANSI C
  697.  
  698. The major difference between ANSI C and earlier C compilers is function
  699. prototyping.  ANSI C allows function arguments to be checked for type
  700. agreement, and (when possible) type coercion in the event of a mismatch.  For
  701. this to work, functions and their arguments must be declared before they are
  702. called.  The form for function declarations is different in ANSI C and
  703. non-ANSI C (ANSI C also accepts the earlier form, but then does not do type
  704. checking).
  705.  
  706. As of edit 167, C-Kermit tries to take full advantage of ANSI C features,
  707. especially function prototyping.  This removes many bugs introduced by
  708. differing data types used or returned by the same functions on different
  709. computers.  ANSI C features are automatically enabled when the symbol __STDC__
  710. is defined.  Most ANSI C compilers, such as GNU CC and the new DEC C compiler
  711. define this symbol internally.
  712.  
  713. To force use of ANSI C prototypes, include -DCK_ANSIC on the cc command line.
  714. To disable the use of ANSI prototypes, include -DNOANSI.
  715.  
  716. UNIX MAKE FAILURES
  717.  
  718. First, be sure the source files are stored on your current disk and directory
  719. with the right names (in lowercase).  Second, make sure that the makefile
  720. itself does not contain any lines with leading spaces: indented lines must all
  721. start with horizontal TAB, and no spaces.
  722.  
  723. Then make sure that your UNIX PATH is defined to find the appropriate compiler
  724. for your makefile entry.  For example, on SunOS systems, "make sunos41" builds
  725. C-Kermit for the BSD environment, and assumes that /usr/ucb/cc will be used
  726. for compilation and linking.  If your PATH has /usr/5bin ahead of /usr/ucb,
  727. you can have problems at compile or link time (a commonly reported symptom is
  728. the inability to fine "ftime" during linking).  Fix such problems by
  729. redefining your UNIX PATH, or by specifying the appropriate "cc" in CC=
  730. and CC2= statements in your makefile entry.
  731.  
  732. During edits 166-167, considerable effort went into making C-Kermit compilable
  733. by ANSI C compilers.  This includes prototyping all of C-Kermit's functions,
  734. and including the ANSI-defined system header files for system and library
  735. functions, as defined in K & R, second edition: <string.h>, <stdlib.h>,
  736. <unistd.h> (except in NeXTSTEP this is <libc.h>), and <sys/stdtypes.h>.  If
  737. you get warnings about any of these header files not being found, or about
  738. argument mismatches involving pid_t, uid_t, or gid_t, look in ckcdeb.h and
  739. make amendments.  C-Kermit assumes it is being compiled by an ANSI-compliant C
  740. compiler if __STDC__ is defined, normally defined by the compiler itself.  You
  741. can force ANSI compilation without defining __STDC__ (which some compilers
  742. won't let you define) by including -DCK_ANSIC on the cc command line.
  743.  
  744. On the other hand, if your compiler defines __STDC__ but still complains about
  745. the syntax of Kermit's function prototypes, you can disable the ANSI-style
  746. function prototyping by including -DNOANSI on the command line.
  747.  
  748. For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick the
  749. most appropriate makefile entry, and be sure you have installed an SCO
  750. development system that is keyed to your exact SCO operating system release,
  751. down to the minor version (like 2.3.1).
  752.  
  753. Also note that SCO distributes some of its libraries in encrypted form, and
  754. they must be decrypted before C-Kermit can be linked with them.  If not, you
  755. might see a message like:
  756.  
  757.   ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365
  758.  
  759. To decrypt, you must supply a key (password) that came with your license.
  760. Call SCO for further info.
  761.  
  762. If your compiler uses something other than int for the pid (process id) data
  763. type, put -DPID_T=pid_t or whatever in your CFLAGS.
  764.  
  765. If you get complaints about unknown data types uid_t and gid_t, put
  766. -DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the appropriate
  767. types.
  768.  
  769. If your compilation fails because of conflicting or duplicate declarations for
  770. sys_errlist, add -DNDSYSERRLIST to CFLAGS.
  771.  
  772. If your compilation dies because getpwnam() is being redeclared (or because
  773. of "conflicting types for getwpnam"), add -DNDGPWNAM to your CFLAGS.
  774. If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see ckufio.c around
  775. line 440).
  776.  
  777. If the compiler complains about the declaration of getpwnam() during an ANSI C
  778. compilation, remove the declaration from ckufio.c or change the argument in
  779. the prototype from (char *) to (const char *).
  780.  
  781. If you get complaints that getpwuid() is being called with an improper type,
  782. put -DPWID_T=xx in your CFLAGS.
  783.  
  784. If you get compile-time warnings that t_brkc or t_eofc (tchars structure
  785. members, used in BSD-based versions) are undefined, or structure-member-
  786. related warnings that might be traced to this fact, add -DNOBRKC to CFLAGS.
  787.  
  788. If you get a linker message to the effect that _setreuid or _setregid is not
  789. defined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=<blah> to CFLAGS to make
  790. C-Kermit read the right <types.h>-kind-of-file to pick up these definitions.
  791.  
  792. If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS.
  793.  
  794. If you get a complaint at compile time about an illegal pointer-integer
  795. combination in ckufio.c involving popen(), or at link time that _popen is an
  796. undefined symbol, add the declaration "FILE *popen();" to the function zxcmd()
  797. in ckufio.c (this declaration is supposed to be in <stdio.h>).  If making this
  798. change does not help, then apparently your UNIX does not have the popen()
  799. function, so you should add -DNOPOPEN to your make entry, in which case
  800. certain functions involving "file" i/o to the standard input and output of
  801. subprocesses will not be available.
  802.  
  803. If your linker complains that _getcwd is undefined, you can add a getcwd()
  804. function to ckufio.c, or add it to your libc.a library using ar:
  805.  
  806. #include <stdio.h>
  807.  
  808. char *
  809. getcwd(buf,size) char *buf; int size; {
  810. #ifndef NOPOPEN
  811. #ifdef DCLPOPEN
  812.     FILE *popen();
  813. #endif
  814.     FILE *pfp;
  815.  
  816.     if (!buf) return(NULL);
  817.     if (!(pfp = popen("pwd","r"))) return(NULL);
  818.     fgets(buf,size-2,pfp);
  819.     pclose(pfp);
  820.     buf[strlen(buf)-1] = '\0';
  821.     return((char *)buf);
  822. #else
  823.     buf[0] = '\0';
  824.     return(NULL);
  825. #endif /* NOPOPEN */
  826. }
  827.  
  828. #ifdef NOPOPEN
  829. FILE *popen(s,t) char *s,*t; {
  830.     return(NULL);
  831. }
  832. #endif /* NOPOPEN */
  833.  
  834. If you get complaints about NPROC having an invalid value, add a valid
  835. definition for it (depends on your system), as in the cray entry.
  836.  
  837. If you get some symbol that's multiply defined, it probably means that a
  838. variable name used by Kermit is also used in one of your system libraries that
  839. Kermit is linked with.  For example, under PC/IX some library has a variable
  840. or function called "data", and the variable "data" is also used extensively by
  841. Kermit.  Rather than edit the Kermit source files, just put a -D in the make
  842. entry CFLAGS to change the Kermit symbol at compile time.  In this example, it
  843. might be -Ddata=datax.
  844.  
  845. Some symbol is defined in your system's header files, but it produces
  846. conflicts with, or undesired results from, Kermit.  Try undefining the symbol
  847. in the makefile entry's CFLAGS, for example -UFIONREAD.
  848.  
  849. Some well-known symbol is missing from your system header files.  Try defining
  850. in the makefile entry's CFLAGS, for example -DFREAD=1.
  851.  
  852. You get many warnings about pointer mismatches.  This probably means that
  853. Kermit is assuming an int type for signal() when it should be void, or
  854. vice-versa.  Try adding -DSIG_I (for integer signal()) or -DSIG_V (for void)
  855. to CFLAGS.  Or just include KFLAGS=-DSIG_V (or whatever) in your "make"
  856. command, for example:
  857.  
  858.   make bsd KFLAGS=-DSIG_V
  859.  
  860. You get many messages about variables that are declared and/or set but never
  861. used.  It is difficult to avoid these because of all the conditional
  862. compilation in the program.  Ignore these messages.
  863.  
  864. Some of C-Kermit's modules are so large, or contain so many character string
  865. constants, or are so offensive in some other way, that some C compilers give
  866. up and refuse to compile them.  This is usually because the -O (optimize)
  867. option is included in the make entry.  If this happens to you, you can
  868. (a) remove the -O option from the make entry, which will turn off the
  869. optimizer for ALL modules; or (b) compile the offending module(s) by hand,
  870. including all the switches from make entry except for -O, and then give the
  871. appropriate "make" command again; or (c) increase the value of the -Olimit
  872. option, if your compiler supports this option; or (d) change the makefile
  873. entry to first compile each offending module explicitly without optimization,
  874. then compile the others normally (with optimization), for example:
  875.  
  876. #Fortune 32:16, For:Pro 2.1 (mostly like 4.1bsd)
  877. ft21:
  878.     @echo 'Making C-Kermit $(CKVER) for Fortune 32:16 For:Pro 2.1...'
  879.     $(MAKE) ckuusx.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  880.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  881.     $(MAKE) ckuxla.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  882.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  883.     $(MAKE) ckudia.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  884.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  885.     $(MAKE) wermit "CFLAGS= -O -DNODEBUG -DBSD4 -DFT21 -DNOFILEH -SYM 800 \
  886.     -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" \
  887.     "LNKFLAGS= -n -s" "LIBS= -lcurses -ltermcap -lv -lnet"
  888.  
  889. As an extreme example, some compilers (e.g. gcc on the DG AViiON) have been
  890. known to dump core when trying to compile ckwart.c with optimization.  So just
  891. do this one "by hand":
  892.  
  893.   cc -o wart ckwart.c
  894.  
  895. or:
  896.  
  897.   touch ckcpro.c
  898.  
  899. and then give the "make" command again.
  900.  
  901. Speaking of wart, it is unavoidable that some picky compilers might generate
  902. "statement unreachable" messages when compiling ckcpro.c.  Unreachable
  903. statements can be generated by the wart program, which generates ckcpro.c
  904. automatically from ckcpro.w, which translates lex-like state/input
  905. constructions into a big switch/case construction.
  906.  
  907. Some function in Kermit wreaks havoc when it is called.  Change all
  908. invocations of the function into a macro that evaluates to the appropriate
  909. return code that would have been returned by the function had it been called
  910. and failed, for example: -Dzkself()=0.  Obviously not a good idea if the
  911. function is really needed.
  912.  
  913. If you have just installed SunOS 4.1.2 or 4.1.3, you might find that C-Kermit
  914. (and any other C program) fails to link because of unresolved references from
  915. within libc.  This is because of a mistake in Sun's /usr/lib/shlib.etc files
  916. for building the new libc.  Change the libc Makefile so that the "ld" lines
  917. have "-ldl" at the end.  Change the README file to say "mv xccs.multibyte.
  918. xccs.multibyte.o" and follow that instruction.
  919.  
  920. UNIX FILE SYSTEM PECULIARITIES
  921.  
  922. Normally, including a BSD, System-V, POSIX, or DIRENT flag in the make entry
  923. selects the right file system code.  But more recent versions of UNIX are
  924. inconsistent in this regard, and building in the normal way either gives
  925. compiler or linker errors, or results in problems at runtime, typically
  926. failure to properly expand wildcard file specifications when you do something
  927. like "send *.*", or failure to recognize long filenames, as in "send
  928. filewithaverylongname".
  929.  
  930. File creation dates: C-Kermit attempts to set the creation date/time of an
  931. incoming file according to the date/time given in the file's attribute
  932. packet, if any.  If you find that the dates are set incorrectly, you might
  933. need to build Kermit with the -DSYSUTIMEH flag, to tell it to include
  934. <sys/utime.h>.
  935.  
  936. C-Kermit is supposed to know about all the various styles of UNIX file
  937. systems, but it has to be told which one to use when you build it, usually in
  938. the makefile entry CFLAGS as shown below, but you might also have to add
  939. something like -I/usr/include/bsd to CFLAGS, or something like -lbsd to LIBS.
  940.  
  941. C-Kermit gives you the following CFLAGS switches to adapt to your file system's
  942. peculiarities:
  943.  
  944.   -DDIRENT   - #include <dirent.h>
  945.   -DSDIRENT  - #include <sys/dirent.h>
  946.   -DNDIR     - #include <ndir.h>
  947.   -DXNDIR    - #include <sys/ndir.h>
  948.   -DRTU      - #include "/usr/lib/ndir.h", only if NDIR and XNDIR not defined.
  949.   -DSYSUTIMH - #include <sys/utime.h> for setting file creation dates.
  950.   
  951. (Note, RTU should only be used for Masscomp RTU systems, because it also
  952. selects certain other RTU-specific features.)
  953.  
  954. If none of these is defined, then <sys/dir.h> is used, which is (currently)
  955. the most common case.  IMPORTANT: If your system has the file
  956. /usr/include/dirent.h then be sure to add -DDIRENT to your makefile entry's
  957. CFLAGS.  "dirent" should be used in preference to any of the others, because
  958. it supports all the features of your file system, and the others probably
  959. don't.
  960.  
  961. Having selected the appropriate directory header file, you might also need to
  962. tell Kermit how to declare the routines and variables it needs to read the
  963. directory.  This happens most commonly on AT&T System-V based UNIXes,
  964. particularly System V R3 and earlier, that provide long file and directory
  965. names (longer than 14 characters).  Examples include certain releases of
  966. HP-UX, DIAB DNIX, older versions of Silicon Graphics IRIX, and perhaps also
  967. MIPS.  In this case, try adding -DLONGFN to your makefile entry.
  968.  
  969. Another problem child is <sys/file.h>.  Most UNIX C-Kermit versions need to
  970. #include this file from within ckutio.c and ckufio.c, but some not only do not
  971. need to include it, but MUST not include it because (a) it doesn't exist, or
  972. (b) it has already been included by some other header file and it doesn't
  973. protect itself against multiple inclusion, or (c) some other reason that
  974. prevents successful compilation.  If you have compilation problems that seem
  975. to stem from including this file, then add the following switch to CFLAGS in
  976. your makefile entry:
  977.  
  978.   -DNOFILEH
  979.  
  980. There are a few odd cases where <sys/file.h> must be included in one of the
  981. cku[ft]io.c files, but not the other.  In that case, add the aforementioned
  982. switch, but go into the file that needs <sys/file.h> and add something like
  983. this:
  984.  
  985.   #ifdef XXX       /* (where XXX is a symbol unique to your system) */
  986.   #undef NOFILEH
  987.   #endif /* XXX */
  988.  
  989. before the section that includes <sys/file.h>.
  990.  
  991. Kermit's SEND command expands wildcard characters "?" and "*" itself.  Before
  992. version 5A, commands like "send *" would send all regular (non-directory)
  993. files, including "hidden files" (whose names start with ".").  In version 5A,
  994. the default behavior is to match like the Bourne shell or the ls command, and
  995. not include files whose names start with dot.  Such files can still be sent if
  996. the dot is included explicitly in the SEND command: "send .oofa, send .*".  To
  997. change back to the old way and let leading wildcard characters match dot
  998. files, include the following in your CFLAGS:
  999.  
  1000.   -DMATCHDOT
  1001.  
  1002. If you get compile-time complaints about data type mismatches for process-ID
  1003. related functions like getpid(), add -DPID_T=pid_t.
  1004.  
  1005. If you get compile-time complaints about data type mismatches for user ID
  1006. related functions like getuid(), add -DUID_T=uid_t.
  1007.  
  1008. If you get compile-time complaints about data type mismatches for user-ID
  1009. related functions like getgid(), add -DGID_T=gid_t.
  1010.  
  1011. If you get compile-time complaints about data type mismatches for getpwuid(),
  1012. add -DPWID_T=uid_t (or whatever it should be).
  1013.  
  1014. HARDWARE FLOW CONTROL
  1015.  
  1016. Hardware flow control is a problematic concept in many popular UNIX
  1017. implementations.  Often it is lacking altogether, and when available, the
  1018. application program interface (API) to it is inconsistent from system to
  1019. system.  Here are some examples:
  1020.  
  1021. 1. POSIX does not support hardware flow control.
  1022.  
  1023. 2. RTS/CTS flow control support MIGHT be available for System V R3 and later
  1024.    if /usr/include/termiox.h exists (its successful operation also depends on
  1025.    the device driver, and the device itself, not to mention the cable, etc,
  1026.    actually supporting it).  If your SVR3-or-later UNIX system does have this
  1027.    file, add:
  1028.  
  1029.      -DTERMIOX
  1030.  
  1031.    to your CFLAGS.  If the file is in /usr/include/sys instead, add:
  1032.  
  1033.      -DSTERMIOX
  1034.  
  1035.    Note that the presence of this file does not guarantee that RTS/CTS will
  1036.    actually work -- that depends on the device-driver implementation
  1037.    (reportedly, many UNIX versions treat hardware-flow-control related ioctl's
  1038.    as no-ops).
  1039.  
  1040. 3. Search ("grep -i") through /usr/include/*.h and /usr/include/sys/*.h for
  1041.    RTS or CTS and see what turns up.  For example, in SunOS 4.x we find
  1042.    "CRTSCTS".  Figuring out how to use it is another question entirely!
  1043.    In IBM AIX RS/6000 3.x, we have to "add" a new "line discipline" (and you
  1044.    won't find uppercase RTS or CTS symbols in the header files).
  1045.  
  1046. 4. NeXTSTEP and IRIX, and possibly others, support hardware flow control, but
  1047.    do not furnish an API to control it, and thus on these systems Kermit has
  1048.    no command to select it -- instead, a special device name must be used.
  1049.    (NeXTSTEP: /dev/cufa instead of /dev/cua; IRIX: /dev/ttyf00)
  1050.  
  1051. 5. RTS/CTS is available in Linux, but you have to place a line like:
  1052.  
  1053.      stty crtscts < /dev/modem
  1054.  
  1055.    in your /etc/rc.local file (where /dev/modem is the device name of
  1056.    any serial device that you want to have RTS/CTS flow control enabled).
  1057.  
  1058. See the routine tthflow() in ckutio.c for details.  If you find that your
  1059. system offers hardware flow control selection under program control, you can
  1060. add this capability to C-Kermit as follows:
  1061.  
  1062.  1. See if it agrees with one of the methods already used in tthflow().
  1063.     If not, add new code, appropriately #ifdef'd.
  1064.  
  1065.  2. Add -DCK_RTSCTS to the compiler CFLAGS in your makefile entry or define
  1066.     this symbol within the appropriate #ifdef's in ckcdeb.h.
  1067.  
  1068. To illustrate the difficulties with RTS/CTS, here is a tale from Jamie Watson
  1069. <jw@adasoft.ch>, who added the RTS/CTS code for the RS/6000, about his
  1070. attempts to do the same for DEC ULTRIX:
  1071.  
  1072.    "The number and type of hardware signals available to/from a serial port
  1073.    vary between different machines and different types of serial interfaces on
  1074.    each machine.  This means that, for example, there are virtually no
  1075.    hardware signals in or out available on the DECsystem 3000/3100 series; on
  1076.    the DECsystem 5000/2xx series all modem signals in/out are present on both
  1077.    built-in serial ports; on the DECsystem 5100 some ports have all signals
  1078.    and some only have some; and so on...  It looks to me as if this pretty
  1079.    well rules out any attempt to use hardware flow control on these platforms,
  1080.    even if we could figure out how to do it.  The confusion on the user level
  1081.    about whether or not it should work for any given platform or port would be
  1082.    tremendous.  And then it isn't clear how to use the hardware signals even
  1083.    in the cases where the device supports them."
  1084.  
  1085. TERMINAL SPEEDS
  1086.  
  1087. The allowable speeds for the SET SPEED command are defined in ckcdeb.h.  If
  1088. your system supports speeds that are not listed in "set speed ?", you can
  1089. add definitions for them to ckcdeb.h.
  1090.  
  1091. MILLISECOND SLEEPS
  1092.  
  1093. There is no standard for millisecond sleeps, but at least three different
  1094. functions have appeared in various UNIX versions that can be used for this
  1095. purpose: nap() (mostly in System V), usleep() (found at least in SunOS and
  1096. NeXT OS), and select() (found in 4.2BSD and later).  If you have any of these
  1097. available, pick one (in this order of preference, if you have more than one):
  1098.  
  1099.   -DSELECT: Include this in CFLAGS if your system has the select() function.
  1100.   -DNAP:    Include this in CFLAGS if your system has the nap() function.
  1101.   -USLEEP:  Include this in CFLAGS if your system has the usleep() function.
  1102.  
  1103. NOTE: The nap() function is assumed to be a function that puts the process
  1104. to sleep for the given number of milliseconds.  If your system's nap()
  1105. function does something else or uses some other units of time (like the NCR
  1106. Tower 32, which uses clock-ticks), do not include -DNAP.
  1107.  
  1108. Reportedly, all versions of System V R4 for Intel-based computers, and
  1109. possibly also SVR3.2, include nap() as a kernel call, but it's not in the
  1110. library.  To include code to use it via syscall(3112,x), without having to
  1111. include Xenix compatibility features, include the following compile-time
  1112. option:
  1113.  
  1114.   -DNAPHACK
  1115.  
  1116. NONDESTRUCTIVE INPUT BUFFER PEEKING
  1117.  
  1118. Some AT&T UNIX versions have no way to check if input is waiting on a tty
  1119. device, but this is a very important feature for Kermit.  Without it, sliding
  1120. windows might not work very well (or at all), and you also have to type your
  1121. escape character to get Kermit's attention in order to interrupt a local-mode
  1122. file transfer.  If your system offers an FIONREAD ioctl, the build procedure
  1123. should pick that up automatically and use it, which is ideal.
  1124.  
  1125. If your system lacks FIONREAD but has a select() function, this can be used
  1126. instead.  If the build procedure fails to include it (SHOW FEATURES will
  1127. list SELECT), then you can add it to your CFLAGS:
  1128.  
  1129.   -DSELECT
  1130.  
  1131. Conversely, if the build procedure tries to use select() when it really is
  1132. not there, add:
  1133.  
  1134.   -DNOSELECT
  1135.  
  1136. Note: select() is not part of System V nor of POSIX, but it has been added to
  1137. various System-V- and POSIX-based systems as an extension.
  1138.  
  1139. Some System-V variations (SCO Xenix/UNIX/ODT and DIAB DNIX) include a rdchk()
  1140. function that can be used for buffer peeking.  It returns 0 if no characters
  1141. are waiting and 1 if characters are waiting (but unlike FIONREAD, it does not
  1142. tell the actual number).  If your system has rdchk(), add:
  1143.  
  1144.   -DRDCHK:  Include this in CFLAGS if your system has the rdchk() function.
  1145.  
  1146. Otherwise, if your version of UNIX has the poll() function (and the
  1147. /usr/include/poll.h file) -- which appears to be a standard part of System V
  1148. going back to at least SVR3, include:
  1149.  
  1150.   -DCK_POLL
  1151.  
  1152. OTHER SYSTEM-DEPENDENT FEATURES
  1153.  
  1154. Systems with <termios.h> might have the symbol IEXTEN defined.  This is used
  1155. to turn "extended features" in the tty device driver on and off, such as
  1156. Ctrl-O to toggle output flushing, Ctrl-V to quote input characters, etc.
  1157.  
  1158. In most UNIX implementations, it should be turned off during Kermit operation,
  1159. so if ckutio.c finds this symbol, it uses it.  This is necessary, at least, on
  1160. BSDI.  On some systems, however, IEXTEN is either misdefined or
  1161. misimplemented.  The symptom is that CR, when typed to the command processor,
  1162. is echoed as LF, rather than CRLF.  This happens (at least) on Convex/OS 9.1.
  1163. The solution is to add the following symbol to the makefile entry's CFLACS:
  1164.  
  1165.   -DNOIEXTEN
  1166.  
  1167. However, in at least one UNIX implementation, QNX 4.21, IEXTEN must be set
  1168. before hardware flow control can be used.
  1169.  
  1170. In edits 177 and earlier, workstation users noticed a "slow screen writing"
  1171. phenomenon during interactive command parsing.  This was traced to a setbuf()
  1172. call in ckutio.c that made console (stdout) writes unbuffered.  This setbuf()
  1173. call has been there forever, and could not be removed without some risk.
  1174. Kermit's operation was tested on the NeXT in edit 178 with the setbuf() call
  1175. removed, and the slow-writing symptom was cured, and everything else (command
  1176. parsing, proper wakeup on ?, ESC, Ctrl-U, and other editing characters,
  1177. terminal emulation, remote-mode and local-mode file transfer, etc) seemed to
  1178. work as well as or better than before.  In subsequent edits, this change was
  1179. made to many other versions too, with no apparent ill effects.  To remove the
  1180. setbuf() call for your version of Kermit, add:
  1181.  
  1182.   -DNOSETBUF
  1183.  
  1184. Later reports indicate that adding -DNOSETBUF has other beneficial effects,
  1185. like cutting down on swapping when Kermit is run on workstations with small
  1186. memories.  But BEWARE: on certain small UNIX systems, notably the AT&T 6300
  1187. and 3B1 (the very same ones that benefit from NOSETBUF), NOSETBUF seems to
  1188. conflict with CK_CURSES.  The program builds and runs OK, but after once using
  1189. the curses display, echoing is messed up.  In this case, we use a System-V
  1190. specific variation in the curses code, using newterm() to prevent System V
  1191. from altering the buffering.  See makefile entries for AT&T 6300 and 3B1.
  1192.  
  1193. The UNIX version of C-Kermit includes code to switch to file descriptor zero
  1194. (stdin) for remote-mode file transfer.  This code is necessary to prevent
  1195. Kermit from giving the impression that it is "idle" during file transfers,
  1196. which, at some sites, can result in the job being logged out in the middle of
  1197. an active file transfer by idle-job monitors.
  1198.  
  1199. However, this feature can interfere with certain setups; for example, there is
  1200. a package which substitutes a pty/tty pair for /dev/tty and sets file
  1201. descriptor 0 to be read-only, preventing Kermit from sending packets.  Or...
  1202. When a UNIX shell is invoked under the PICK environment, file descriptor 0
  1203. is inoperative.
  1204.  
  1205. To remove this feature and allow Kermit to work in such environments, add the
  1206. compile-time option:
  1207.  
  1208.   -DNOFDZERO
  1209.  
  1210. On some versions of UNIX, earlier releases of C-Kermit were reported to render
  1211. a tty device unusable after a hangup operation.  Examples include IBM AIX on
  1212. the RT PC and RS/6000.  A typical symptom of this phenomenon is that the DIAL
  1213. command doesn't work, but CONNECTing to the device and dialing manually do
  1214. work.  A further test is to SET DIAL HANGUP OFF, which should make dialing
  1215. work once by skipping the pre-dial hangup.  However, after the connection is
  1216. broken, it can't be used any more: subsequent attempts to DIAL the same device
  1217. don't work.  The cure is usually to close and reopen the device as part of the
  1218. hangup operation.  To do this, include the following compile-time option:
  1219.  
  1220.   -DCLSOPN
  1221.  
  1222. Similarly, there is a section of code in ttopen(), which does another
  1223. close(open()) to force the O_NDELAY mode change.  On some systems, the
  1224. close(open()) is required to make the mode change take effect, and apparently
  1225. on most others it does no harm.  But reportedly on at least one System V R4
  1226. implementation, and on SCO Xenix 3.2, the close(open()) operation hangs
  1227. if the device lacks carrier, EVEN THOUGH the CLOCAL characteristic has just
  1228. been set to avoid this very problem.  If this happens to you, add this to
  1229. your CFLAGS:
  1230.  
  1231.   -DNOCOTFMC
  1232.  
  1233. or, equivalently, in your KFLAGS on the make command line.  It stands for
  1234. NO Close(Open()) To Force Mode Change.
  1235.  
  1236. C-Kermit renames files when you give a RENAME command and also according to
  1237. the current SET FILE COLLISION option when receiving files.  The normal UNIX
  1238. way to rename a file is via two system calls: link() and unlink().  But
  1239. this leaves open a window of vulnerability.  Some UNIX systems also offer an
  1240. atomic rename(oldname,newname) function.  If your version of UNIX has this
  1241. function, add the following to your CFLAGS:
  1242.  
  1243.   -DRENAME
  1244.  
  1245. C-Kermit predefines the RENAME for several UNIX versions in ckcdeb.h (SVR4,
  1246. SUNOS41, BSD44, AIXRS, etc).  You can tell if rename() is being used if the
  1247. SHOW FEATURES command includes RENAME in the compiler options list.  If the
  1248. predefined RENAME symbol causes trouble, then add NORENAME to your CFLAGS.
  1249. Trouble includes:
  1250.  
  1251.   1. Linker complains that _rename is an unresolved symbol.
  1252.  
  1253.   2. Linking works, but Kermit's RENAME command doesn't work (which happens
  1254.      because older versions of rename() might have their arguments reversed).
  1255.  
  1256. If rename() is not used, then Kermit uses link()/unlink(), which is equivalent
  1257. except it is not atomic: there is a tiny interval in which some other process
  1258. might "do something" to one of the files or links.
  1259.  
  1260. Some UNIX systems (Olivetti X/OS, Amdahl UTS/V, ICL SVR3, etc) define the
  1261. S_ISREG and S_ISDIR macros incorrectly.  This is compensated for automatically
  1262. in ckufio.c.  Other systems might have this same problem.  If you get a
  1263. compile-time error message regarding S_ISREG and/or S_ISDIR, add the following
  1264. to your CFLAGS:
  1265.  
  1266.   -DISDIRBUG
  1267.  
  1268. Finally, here's a symbol you should NEVER define:
  1269.  
  1270.   -DCOMMENT
  1271.  
  1272. It's used for commenting out blocks of code.  If for some reason you find
  1273. that your compiler has COMMENT defined, then add -UCOMMENT to CFLAGS or KFLAGS!
  1274. Similarly, some header files have been known to define COMMENT, in which case
  1275. you must add "#undef COMMENT" to each C-Kermit source module, after all the
  1276. #includes.
  1277.  
  1278. TERMINAL INTERRUPTION
  1279.  
  1280. When C-Kermit enters interactive command mode, it sets a Control-C (terminal
  1281. keyboard interrupt = SIGINT) trap to allow it to return to the command prompt
  1282. whenever the user types Control-C (or whatever is assigned to be the interrupt
  1283. character).  This is implemented using setjmp() and longjmp().  On some
  1284. systems, depending on the machine architecture and C compiler and who knows
  1285. what else, you might get "Memory fault (coredump)" or "longjmp botch" instead
  1286. of the desired effect (this should not happen in 5A(190) and later).  In that
  1287. case, add -DNOCCTRAP to your CFLAGS and rebuild the program.
  1288.  
  1289. Job control -- the ability to "suspend" C-Kermit on a UNIX system by typing
  1290. the "susp" character (normally Ctrl-Z) and then resume execution later (with
  1291. the "fg" command) -- is a tricky business.  C-Kermit must trap suspend signals
  1292. so it can put the terminal back into normal mode when you suspend it (Kermit
  1293. puts the terminal into various strange modes during interactive command
  1294. parsing, CONNECT, and file transfer).  Supporting code is compiled into
  1295. C-Kermit automatically if <signal.h> includes a definition for the SIGTSTP
  1296. signal.  HOWEVER... some systems define this signal without supporting
  1297. job control correctly.  You can build Kermit to ignore SIGTSTP signals by
  1298. including the -DNOJC option in CFLAGS.  (You can also do this at runtime by
  1299. giving the command SET SUSPEND OFF.)
  1300.  
  1301.   NOTE: As of version 5A(190), C-Kermit makes another safety check.
  1302.   Even if job control is available in the operating system (according to
  1303.   the numerous checks made in congm()), it will still disable the catching
  1304.   of SIGTSTP signals if SIGTSTP was set to SIG_IGN at the time C-Kermit
  1305.   was started.
  1306.  
  1307. System V R3 and earlier systems normally do not support job control.  If you
  1308. have an SVR3 system that does, include the following option in your CFLAGS:
  1309.  
  1310.   -DSVR3JC
  1311.  
  1312. On systems that correctly implement POSIX signal handling, signals can be
  1313. handled more reliably than in Bell, Berkeley, or AT&T UNIXes.  On systems
  1314. (such as QNX) that are "strictly POSIX", POSIX signal handling *must* be used,
  1315. otherwise no signal will work more than once.  If you have POSIX-based system
  1316. and you find that your version of Kermit responds to Ctrl-C (SIGINT) or Ctrl-Z
  1317. (SIGTSTP) only once, then you should add the following option to your CFLAGS:
  1318.  
  1319.   -DCK_POSIX_SIG
  1320.  
  1321. But be careful; some POSIX implementations, notably 4.4BSD, include POSIX
  1322. signal handling symbols and functions as "stubs" only, which do nothing.  Look
  1323. in <signal.h> for sigsetjmp and siglongjmp and read the comments.
  1324.  
  1325. DIALING OUT AND COORDINATING WITH UUCP
  1326.  
  1327. Make sure your dialout line is correctly configured for dialing out (as
  1328. opposed to login).  The method for doing this is different for each kind of
  1329. UNIX.  Consult your system documentation for configuring lines for dialing out
  1330. (for example, Sun SPARCstation IPC users should read the section "Setting up
  1331. Modem Software" in the Desktop SPARC Sun System & Network Manager's Guide, or
  1332. the Terminals and Modems section of the HP manual, "Configuring HP-UX for
  1333. Peripherals".
  1334.  
  1335. Unlike other operating systems, UNIX allows multiple processes to access the
  1336. same tty device at the same time, even though there is no earthly reason why
  1337. two processes would want to do this.  When they do, process A will read some
  1338. of the incoming characters, and process B will read the others.  In all
  1339. likelihood, neither process will see them all.  As you can imagine, this can
  1340. cause enormous difficulties for any communication program.
  1341.  
  1342. Rather than change UNIX to make exclusive access to tty devices be the
  1343. default, UNIX developers hit upon the idea of a "lock file".  Any process that
  1344. wants to open a tty device should first check and see if a file of a certain
  1345. name exists, and if so, not to open the device.  If the file does not exist,
  1346. the process creates the file and then opens the device.  When the process
  1347. closes the device, it destroys the lockfile.  This procedure was originated
  1348. for use with UNIX's UUCP, CU, and TIP programs, and so these lockfiles are
  1349. commonly called "UUCP lockfiles" (UUCP = UNIX-to-UNIX Copy Program).
  1350.  
  1351. As you can imagine, this method is riddled with pitfalls:
  1352.  
  1353.   - If a process does not observe the prevailing lockfile convention, then it
  1354.     can interfere with other "polite" processes.
  1355.  
  1356.   - If a process crashes while it has the device open, the lockfile is
  1357.     left behind, preventing further processes from using the device.
  1358.  
  1359.   - Various versions of UNIX use different names for the lockfiles, put
  1360.     them in different directories, and specify their contents differently.
  1361.  
  1362.   - On a given system, the lockfile conventions may change from one UNIX 
  1363.     release to the next (for example, SunOS 4.0 to 4.1).
  1364.  
  1365.   - The same tty device might have more than one name, and most lockfile
  1366.     conventions don't allow for this.
  1367.  
  1368. In order to fit in with UUCP and other UNIX-based communication software,
  1369. C-Kermit must have the same idea as your system's uucp, cu, and tip programs
  1370. about what the UUCP lock directory is called, what the lockfile itself is
  1371. called, and what its contents should be.  In most cases, Kermit tries to
  1372. figure this out automatically (see ckutio.c).  The following CFLAGS options
  1373. can be used to override C-Kermit's normal assumptions:
  1374.  
  1375.   -DLCKDIR:   Tells Kermit that the UUCP lock directory is /usr/spool/uucp/LCK.
  1376.  
  1377.   -DACUCNTRL: Tells Kermit to use the BSD 4.3 acucntrl() program to turn
  1378.               off getty (login) on the line before using it, and restore
  1379.               getty when done.
  1380.  
  1381.   -DHDBUUCP:  Include this if your system uses Honey DanBer UUCP.
  1382.  
  1383.   -DLOCK_DIR=\\\"/xxx/yyy\\\": Gives the lock directory name explicitly.
  1384.               The triple quoting is necessary.  For example: 
  1385.               "CFLAGS= -DBSD4 -DLOCK_DIR=\\\"/usr/local/locks\\\" -DNODEBUG"
  1386.               (NOTE: The triple quoting assumes this is a "top-level" make
  1387.               entry, and not a make entry that calls another one.)
  1388.  
  1389.   -DLFDEVNO   The lockfile name uses the tty device inode and major and minor
  1390.               numbers: LK.dev.maj.min, as in Sys V R4, e.g. LK.035.044.008.
  1391.  
  1392. Honey DanBer (HDB) UUCP, which is becoming increasingly popular, has two  
  1393. characteristics:
  1394.  
  1395.    a. Lockfiles are kept in /usr/spool/locks/.
  1396.    b. A lockfile contains the process id (pid) in ASCII, rather than as an int.
  1397.  
  1398. Non-HDB selections assume the lockfile contains the pid in int form (or,
  1399. more precisely, in PID_T form, where PID_T is either int or pid_t, depending
  1400. on your system's C library and header files).  (b), by the way, is subject
  1401. to interpretation: the numeric ASCII string may or may not be terminated by
  1402. a newline, it may or may not have leading spaces (or zeros), and the number
  1403. of leading spaces or zeros can differ, and the differences can be significant.
  1404.  
  1405. Even if you build the program with the right lockfile option, you can still
  1406. have problems when you try to open the device.  Here are the error messages
  1407. you can get from SET LINE, and what they mean:
  1408.  
  1409.    a. "Timed out, no carrier."  This one is not related to lockfiles.  It
  1410.       means that you have SET CARRIER ON xx, where xx is the number of seconds
  1411.       to wait for carrier, and carrier did not appear within xx seconds.
  1412.       Solution: SET CARRIER AUTO or OFF.
  1413.  
  1414.    b. "Sorry, access to lock denied."  Kermit has been configured to use
  1415.       lockfiles, but (a) the lockfile directory is write-protected against
  1416.       you, or (b) it does not exist.  The "access to lock denied" message will
  1417.       tell you the reason.  If the lockfile does not exist, check to make sure
  1418.       Kermit is using the right name.  Certain recent releases of UNIX have
  1419.       changed the location of the lockfile from /usr/spool/whatever to
  1420.       /var/spool/whatever.  In this case, ask the system manager install a
  1421.       symbolic link from the old name to the new name.
  1422.       Other solutions: (see below)
  1423.  
  1424.    c. "Sorry, access to tty device denied."  The tty device that you specified
  1425.       in your SET LINE command is read/write protected against you.
  1426.       Solution: (see below)
  1427.  
  1428.    d. "Sorry, device is in use."  The tty device you have specified is
  1429.       currently being used by another user.  A prefatory message gives you
  1430.       an "ls -l" listing of the lockfile, which should show the username of
  1431.       the person who created it, plus a message "pid = nnn" to show you the
  1432.       process id of the user's program.  Solutions: try another device,
  1433.       wait until the other user is finished, ask the other user to hurry up,
  1434.       or ask the system manager for help.
  1435.  
  1436.    e. "Sorry, can't open connection: <reason>".  The device cannot be opened
  1437.       for some other reason, which is listed.
  1438.  
  1439.    f. "sh: /usr/lib/uucp/acucntrl: not found".  This means your Kermit program
  1440.       was built with the -DACUCNTRL switch, but your computer system does not
  1441.       have the BSD 4.3 acucntrl program.  Solution: install the acucntrl
  1442.       program if you have it, or rebuild Kermit without the -DACUCNTRL switch.
  1443.  
  1444. There are two solutions for problems (b) and (c), both of which involve
  1445. intervention by the manager (superuser) of your UNIX system:
  1446.  
  1447.    a. Have the superuser change the permission of the lockfile directory and
  1448.       to the tty devices so that everyone on the system has read/write
  1449.       permission.
  1450.  
  1451.         su% chmod 777 /usr/spool/locks (or whatever the path is)
  1452.         su% chmod 666 /dev/ttyXX
  1453.  
  1454.       The risk here is that people can write lots of junk into the lockfile
  1455.       directory, delete other people's files in the lockfile directory, and
  1456.       intercept other people's data as it goes in and out of the tty device.
  1457.       The major danger here would be intercepting a privileged password.  Of
  1458.       course, any user could write a short, ordinary, unprivileged program to
  1459.       do exactly the same thing if the tty device was world read/writeable.
  1460.  
  1461.    b. Have the superuser change Kermit to run setuid or setgid to the owner of
  1462.       the lockfile directory (and the tty devices if necessary), typically
  1463.       uucp (see next section), but NOT root.  Example:
  1464.  
  1465.     su% chown uucp kermit          - or -  chgrp uucp kermit 
  1466.     su% chmod u+s kermit (setuid)  - or -  chmod g+s kermit (setgid)
  1467.  
  1468.       and then make sure the lockfile directory, and the tty devices, have
  1469.       owner (setuid) and/or group (setgid) write permission.  For example:
  1470.  
  1471.         su% chmod o+rwx /usr/spool/uucp
  1472.         su% chown uucp /dev/ttyXX ; chmod 600 /dev/ttyXX
  1473.  
  1474.       On the whole, the setuid option should be avoided whenever possible,
  1475.       because any loophole in this enormously complicated program could be
  1476.       exploited to grant the user the privileges of the user to whom the
  1477.       program is setuid'd or setgid'd to.
  1478.  
  1479. If you make C-Kermit setuid or setgid to root, it refuses to run:
  1480.  
  1481.   Fatal: C-Kermit setuid to root!
  1482.  
  1483. For the lockfile mechanism to achieve its desired purpose -- prevention of
  1484. access to the same tty device by more than one process at a time -- ALL
  1485. programs on a given computer that open, read or write, and close tty devices
  1486. must use the SAME lockfile conventions.  Unfortunately, this is often not the
  1487. case.  Here is a typical example of how this can go wrong: In SunOS 4.0 and
  1488. earler, the lockfile directory was /usr/spool/uucp; in 4.1 it was changed to
  1489. /var/spool/locks.  Therefore, any programs that were not modified to account
  1490. for this change, recompiled, and reinstalled, will not be using the same
  1491. lockfiles as uucp, tip, etc, and so the entire purpose of the lockfile is
  1492. defeated.
  1493.  
  1494. What if your UNIX system does not have UUCP installed?  For example, you have
  1495. a UNIX workstation, and you do not use uucp, cu, or tip, or UUCP was not even
  1496. supplied with your version of UNIX.  In this case, you have two choices:
  1497.  
  1498.    a. If there may be more than one person running Kermit at the same time,
  1499.       competing for the same tty device, then create a special lockfile
  1500.       directory just for Kermit, for example, /usr/spool/kermit, and make sure
  1501.       you have read/write access to it.  Then add the following to your
  1502.       makefile entry CFLAGS, as shown earlier:
  1503.  
  1504.            -DLOCK_DIR=\\\"/usr/spool/kermit\\\"
  1505.  
  1506.    b. If you are the only user on your workstation, and no other processes will
  1507.       ever be competing with Kermit for the dialout tty device, then add 
  1508.       -DNOUUCP to your makefile entry's CFLAGS and rebuild Kermit.
  1509.  
  1510. RUNNING UNIX C-KERMIT SETUID OR SETGID
  1511.  
  1512. Even if you don't intend to run C-Kermit setuid, somebody else might come
  1513. along and chown and chmod it after it has been built.  You should be sure that
  1514. it is built correctly to run setuid on your system.  For POSIX and AT&T UNIX
  1515. versions, you don't have to do anything special.
  1516.  
  1517. For 4.2 and 4.3 BSD-based UNIX versions, you normally need not add anything
  1518. special to the makefile.  The program assumes that the setreuid() and
  1519. setregid() functions are available, without which we cannot switch back &
  1520. forth between real & effective uids.  If "make" complains that _setreuid or
  1521. _setregid is/are not defined, add -DNOSETREU to CFLAGS.  In this case it is
  1522. very likely (but not certain) that you cannot protect ttys and lockfiles
  1523. against people and have them run Kermit setuid.
  1524.  
  1525. If make does not complain about this, you should find out whether your BSD
  1526. version (4.3 or other systems like SunOS 4.x that claim to include BSD 4.3
  1527. compatibility) includes the saved-setuid feature (see long notes under edit
  1528. 146 in ckc178.upd).  If it does, then add -DSAVEDUID to CFLAGS.
  1529.  
  1530.   IMPORTANT NOTE: Most UNIX system documentation will not give you the
  1531.   required information.  To determine whether your UNIX system supplies the
  1532.   the saved-original-effective-user/group-id feature, use the ckuuid.c
  1533.   program.  Read and follow the instructions in the comments at the beginning.
  1534.  
  1535. 4.4BSD systems automatically use sete[ug]id().  See ckutio.c.
  1536.  
  1537. If you have a version of UNIX that is not BSD-based, but which supplies the
  1538. setreuid() and setregid() functions, and these are the only way to switch
  1539. between real and effective uid, add -DSETREUID to your makefile entry.
  1540.  
  1541.   WARNING: There are two calls to access() in ckufio.c, by which Kermit checks
  1542.   to see if it can create an output file.  These calls will not work correctly
  1543.   when (a) you have installed C-Kermit setuid or setgid on a BSD-based UNIX
  1544.   system, and (b) the saved-original-effective-uid/gid feature is not present,
  1545.   and (c) the access() function always checks what it believes to be the real
  1546.   ID rather than the effective ID.  This is the case, for example, in Olivetti
  1547.   X/OS and in NeXTSTEP.  In such cases, you can force correct operation of
  1548.   access() calls by defining the symbol SW_ACC_ID at compile time in CFLAGS.
  1549.  
  1550. If you have a version of UNIX that does not allow a process to switch back and
  1551. forth between its effective and real user and group ids multiple times, you
  1552. probably should not attempt to run Kermit setuid, because once having given up
  1553. its effective uid or gid (which it must do in order to transfer files, fork a
  1554. shell, etc) it can never get it back, and so it can not use the original
  1555. effective uid or gid to create or delete uucp lockfiles.  In this case, you'll
  1556. either have to set the permissions on your lockfile directory to make them
  1557. publicly read/writable, or dispense with locking altogether.
  1558.  
  1559. CONFIGURING UNIX WORKSTATIONS
  1560.  
  1561. On desktop workstations that are used by only the user at the console
  1562. keyboard, C-Kermit is always used in local mode.  But as delivered, C-Kermit
  1563. runs in remote mode by default.  To put it in local mode at startup, you can
  1564. put a SET LINE command in your .kermrc.
  1565.  
  1566. You can also build C-Kermit to start up in local mode by default.  To do this,
  1567. include the following in the CFLAGS in your makefile entry:
  1568.  
  1569. -DDFTTY=\\\"/dev/ttyxx\\\"
  1570.  
  1571. where ttyxx is the name of the device you will be using for communications.
  1572. Presently there is no way of setting the default modem type at compile time,
  1573. so use this option only for direct lines.
  1574.  
  1575. C-Kermit does not work well on certain workstations if it is not run from
  1576. within a terminal window.  For example, you cannot start C-Kermit on a NeXT by
  1577. launching it directly from NeXTstep.  Similarly for Sun workstations in the
  1578. Open Windows environment.  Run Kermit in a terminal window.
  1579.  
  1580. BIZARRE BEHAVIOR AT RUNTIME
  1581.  
  1582. See the beware file, ckuker.bwr, for hints about runtime misbehavior.
  1583. This section lists some runtime problems that can be cured by rebuilding
  1584. C-Kermit.
  1585.  
  1586. The program starts, but there is no prompt, and certain operations don't work
  1587. (you see error messages like "Kermit command error in background execution").
  1588. This is because Kermit thinks it is running in the background.  See conbgt()
  1589. in ckutio.c.  Try rebuilding Kermit with:
  1590.  
  1591.  -DPID_T=pid_t
  1592.  
  1593. added to your CFLAGS.  If that doesn't help, find out the actual data type
  1594. for pids (look in types.h or similar file) and use it in place of "pid_t", 
  1595. for example:
  1596.  
  1597.  -DPID_T=short
  1598.  
  1599. Unexplainable and inappropriate error messages ("Sockets not supported on this
  1600. device", etc) have been traced in at least one case to a lack of agreement
  1601. between the system header files and the actual kernel.  This happened because
  1602. the GNU C compiler (gcc) was being used.  gcc wants to have ANSI-C-compliant
  1603. header files, and so part of the installation procedure for gcc is to run a
  1604. shell script called "fixincludes", which translates the system's header files
  1605. into a separate set of headers that gcc likes.  So far so good.  Later, a new
  1606. version of the operating system is installed and nobody remembers to run
  1607. fixincludes again.  From that point, any program compiled with gcc that makes
  1608. use of header files (particularly ioctl.h) is very likely to misbehave.
  1609. Solution: run fixincludes again, or use your system's regular C compiler,
  1610. libraries, and header files instead of gcc.
  1611.  
  1612. CRASHES AND CORE DUMPS
  1613.  
  1614. Total failure of the Kermit program can occur because of bad memory
  1615. references, bad system calls, or problems with dynamic memory allocation.
  1616. First, try to reproduce the problem with debugging turned on: run Kermit with
  1617. the -d command-line option (for example, "wermit -d") and then examine the
  1618. resulting debug.log file.  The last entry should be in the vicinity of the
  1619. crash.  In VAX/VMS, a crash automatically produces a "stack dump" which shows
  1620. the routine where the crash occurs.  In some versions of UNIX, you can get a
  1621. stack dump with "adb" -- just type "adb wermit core" and then give the command
  1622. "$c", then Ctrl-D to quit.  Or use gdb to get a backtrace, etc.
  1623.  
  1624. In edit 186, one implementation, UNISYS 5000/95 built with "make sys5r3", has
  1625. been reported to run out of memory very quickly (e.g. while executing a short
  1626. initialization file that contains a SET DIAL DIRECTORY command).  Debug logs
  1627. show that malloc calls are failing, reason unknown.  For this and any other
  1628. implementation that gives error messages about "malloc failure" or "memory
  1629. allocation failure", rebuild the program *without* the -DDYNAMIC CFLAGS
  1630. definition, for example:
  1631.  
  1632.   make sys5r3 KFLAGS=-UDYNAMIC
  1633.  
  1634. As of edit 169, C-Kermit includes a malloc() debugging package which you may
  1635. link with the Kermit program to catch runtime malloc errors.  See the makefile
  1636. entries for sunos41md and nextmd for examples of how to select malloc
  1637. debugging.  Once you have linked Kermit with the malloc debugger, it will halt
  1638. with an informative message if a malloc-related error occurs and, if possible,
  1639. dump core.  For this reason, malloc-debugging versions of Kermit should be
  1640. built without the "-s" link option (which removes symbols, preventing analysis
  1641. of the core dump).  You have several ways to track down the malloc error:
  1642. Analyze the core dump with adb.  Or reproduce the problem with "log debug" and
  1643. then look at the code around the last debug.log entry.  If you have gcc, build
  1644. the program with "-g" added to CFLAGS and then debug it with gdb, e.g.
  1645.  
  1646.   gdb wermit
  1647.   break main
  1648.   run
  1649.   .. set other breakpoints or watchpoints
  1650.   continue
  1651.   
  1652. Watchpoints are especially useful for finding memory leaks, but they make
  1653. the program run about a thousand times slower than usual, so don't set them
  1654. until the last possible moment.  When a watchpoint is hit, you can use the
  1655. "where" command to find out which C-Kermit source statement triggered it.
  1656.  
  1657. If you have the Pure Software Inc "Purify" product, see the sunos41cp makefile
  1658. entry for an example of how to use it to debug C-Kermit.
  1659.  
  1660. (End of CKUINS.DOC)
  1661.