home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc190.zip / ckuins.doc < prev    next >
Text File  |  1996-03-21  |  82KB  |  1,641 lines

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