home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ck9197.zip / ckuins.txt < prev    next >
Text File  |  2000-02-20  |  122KB  |  2,484 lines

  1. C-KERMIT 7.0 INSTALLATION INSTRUCTIONS FOR UNIX
  2.  
  3.   As of C-Kermit version:  7.0.196
  4.   This file last updated:  Sat Jan  1 13:32:48 2000
  5.  
  6.   Author: Frank da Cruz, Columbia University
  7.  
  8.   Copyright (C) 1985, 2000,
  9.     Trustees of Columbia University in the City of New York.
  10.     All rights reserved.  See the C-Kermit COPYING.TXT file or the
  11.     copyright text in the ckcmai.c module for disclaimer and permissions.
  12.  
  13.  
  14. DOCUMENTATION
  15.  
  16.   Frank da Cruz and Christine M. Gianone, "Using C-Kermit", Second Edition,
  17.   1997, Digital Press / Butterworth-Heinemann, Woburn, MA, ISBN 1-55558-164-1
  18.   US single-copy price: $44.95; quantity discounts available.  Available in
  19.   computer bookstores or directly from Columbia University:
  20.  
  21.     The Kermit Project
  22.     Columbia University
  23.     612 West 115th Street
  24.     New York NY  10025-7799  USA
  25.     Telephone: +1 (212) 854-3703
  26.     Email: kermit-orders@columbia.edu
  27.     Web: http://www.columbia.edu/kermit/
  28.  
  29.   The CKERMIT2.TXT file contains supplementary info for C-Kermit 7.0 to be
  30.   used until the 3rd edition of the manual is ready.
  31.  
  32.  
  33. CONTENTS
  34.  
  35.  1. OVERVIEW
  36.  2. INSTALLING FROM PACKAGES
  37.  3. INSTALLING PREBUILT BINARIES
  38.  4. BUILDING FROM SOURCE CODE
  39.     4.0. Special Considerations for C-Kermit 7.0
  40.     4.1. The UNIX Makefile
  41.     4.2. The C-Kermit Initialization File
  42.     4.3. The 2.x BSD Makefile
  43.     4.4. The Plan 9 Makefile
  44.     4.5. Makefile Failures
  45.  5. INSTALLING THE KERMIT FILES
  46.  6. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES
  47.  7. CHECKING THE RESULTS
  48.  8. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE
  49.  9. UNIX VERSIONS
  50.     9.1. Standards
  51.     9.1.1. POSIX
  52.     9.1.2. ANSI C
  53.     9.1.3. Other Standards
  54.     9.2. Library Issues
  55.     9.3. UNIX File System Peculiarities
  56.     9.4. Hardware Flow Control
  57.     9.5. Terminal Speeds
  58.     9.6. Millisecond Sleeps
  59.     9.7. Nondestructive Input Buffer Peeking
  60.     9.8. Other System-Dependent Features
  61.     9.9. Terminal Interruption
  62. 10. DIALING OUT AND COORDINATING WITH UUCP
  63. 11. RUNNING UNIX C-KERMIT SETUID OR SETGID
  64. 12. CONFIGURING UNIX WORKSTATIONS
  65. 13. BIZARRE BEHAVIOR AT RUNTIME
  66. 14. CRASHES AND CORE DUMPS
  67. 15. SYSLOGGING
  68. 16. SECURITY OPTIONS
  69.  
  70.  
  71. 1. OVERVIEW
  72.  
  73. This file contains UNIX-specific information.  A lot of it.  Unlike most
  74. other packages, C-Kermit tries very hard to be portable to every UNIX variety
  75. (and every release of each one) known to exist, including many that are quite
  76. old, as well as to other platforms like VMS, AOS/VS, VOS, OS-9, the BeBox,
  77. the Amiga, etc.
  78.  
  79. Since C-Kermit gets so deeply into the file system, i/o system, and other
  80. areas that differ radically from one UNIX platform to the next, this means
  81. that a lot can go wrong when you try to install C-Kermit on (for example) a
  82. new release of a particular variety of UNIX, in which certain things might
  83. have changed that C-Kermit depended upon.
  84.  
  85. This file concentrates on installation.  For a description of general
  86. configuration options for C-Kermit, please read the file ckccfg.txt.  For
  87. troubleshooting after installation, see the files ckcbwr.txt and ckubwr.txt.
  88. The latter, in particular, contains lots of information on lots of specific
  89. UNIX platforms.  If you want to work on the source code, see the C-Kermit
  90. Program Logic Manual, ckcplm.txt.
  91.  
  92. You may install C-Kermit:
  93.  
  94.  . From an "install package", if one is available.
  95.  . As a prebuilt binary, if available, plus accompanying text files.
  96.  . By building from source code.
  97.  
  98.  
  99. 2. INSTALLING FROM PACKAGES
  100.  
  101. Various UNIX varieties -- Red Hat Linux, Solaris, etc -- now incorporate the
  102. idea of "install packages", and many users expect to find all new applications
  103. in this format.  A selection of install packages might be available for any
  104. given release of C-Kermit, but there is a tradeoff between convenience and
  105. safety.  UNIX presents several notable problems to the builder of install
  106. packages:
  107.  
  108.  a. Since C-Kermit is portable to many non-UNIX platforms (VMS, VOS, AOS/VS,
  109.     etc), some of the files in the C-Kermit distribution do not fit into the
  110.     UNIX application model.  In particular, C-Kermit includes some plain
  111.     text files (described in Section 5) and UNIX has no standard place to
  112.     put such files.  Typical UNIX package managers do not allow for them.
  113.     Where should they go, and how will the user know where to find them?
  114.  
  115.  b. Installation of any program that will be used to make modem calls requires
  116.     some important decisions from the installer regarded security and
  117.     privilege.
  118.  
  119. Item (b) is discussed at length in Section 10 of this document, but the
  120. package-related aspects are also given here.  The basic problem is that UNIX
  121. dialout devices and the UUCP "lock files" that regulate contention for them
  122. (described in Section 10) are protected against "world".  Therefore, the
  123. install procedure must either run as root in order to give the Kermit binary
  124. the required permissions, or else it must open up the permissions on the
  125. devices and lockfile directory.  Otherwise, the Kermit program just installed
  126. WILL NOT WORK for dialing out.
  127.  
  128. Thus, a well-crafted installation procedure should present the options and
  129. allow the installer to choose:
  130.  
  131.  a. Check the permissions of the lockfile directory and the dialout devices.
  132.     If they do not allow unprivileged R/W access, then:
  133.  
  134.  b. "Your UUCP lockfile directory and/or dialout devices require privilege
  135.     to access.  You must either change their permissions or install Kermit
  136.     with privileges."
  137.  
  138.  c. "If you wish to install Kermit with privileges, it will be given the
  139.     same owner, group, and permissions as the cu program so it can use the
  140.     dialout devices."
  141.  
  142.  d. If they choose (c) but the user is not root, give message that the
  143.     install procedure can be run only by root and then quit.
  144.  
  145. The Kermit Project does not necessarily have the resources or the expertise
  146. to make install packages for any (and certainly not all) UNIX (and other)
  147. platforms.  Most install packages, therefore, are contributed by others, and
  148. they do not necessarily follow the guidelines given above.
  149.  
  150. If you are an end user who has obtained a C-Kermit install package for a
  151. particular platform, you should be aware that some additional steps might
  152. needed.  Read Section 10 for details.
  153.  
  154.  
  155. 3. INSTALLING PREBUILT BINARIES
  156.  
  157. Hundreds of prebuilt C-Kermit binaries are available on the CDROM in the
  158. BINARY tree, and at our ftp site in the kermit/binaries area (with names
  159. starting with "ck").  To install a prebuilt binary:
  160.  
  161.  a. Rename the binary to "wermit".
  162.  
  163.  b. Follow steps (b) through (e) in Section 4.
  164.  
  165. But first...  Please heed the following cautions:
  166.  
  167.  a. If you pick the wrong one, it won't work (or worse).
  168.  
  169.  b. Even when you pick the appropriate binary, it still might not work due
  170.     to shared-library mismatches, etc. (see Section 4.0).
  171.  
  172.  c. Don't expect a binary built on or for version "n" of your OS to work
  173.     on version "m" (where m < n).  However, it is usually safe to run a
  174.     binary built on (or for) an older OS release on a newer one.
  175.  
  176.  
  177. 4. BUILDING FROM SOURCE CODE
  178.  
  179. C-Kermit is designed to be built and used on as many platforms as possible:
  180. UNIX and non-UNIX, old and new (and ancient), ANSI C and K&R.  The UNIX
  181. version does not use or depend on any external tools for building except the
  182. "make" utility, the C compiler, and the linker.  It does not use any automated
  183. configuration tools such as configure, autoconf, automake, libtool, etc.
  184. Everything in C-Kermit has been built by hand based on direct experience or
  185. reports from users.
  186.  
  187. The C-Kermit makefile contains the rules for building the program for each of
  188. the hundreds of different kinds of UNIX systems that C-Kermit attempts to
  189. support.  It covers all UNIX variations since about 1980 -- pretty much
  190. everything after UNIX V6.  Separate makefiles are used for Plan 9 and 2.x BSD.
  191.  
  192. Prerequisites:
  193.  
  194.  . The C compiler, linker, and make program must be installed.
  195.  . The C libraries and header files must be installed (*).
  196.  . The C-Kermit source code and makefile in your current directory.
  197.  . The C-Kermit text files (Section 5) in your current directory.
  198.  
  199. (*) This is becoming problematic in this new age of "selective installs"
  200.     e.g. of Linux packages.  C-Kermit builds will often fail because replying
  201.     "no" to some obscure Linux installation option will result in missing
  202.     libraries or header files.
  203.  
  204. Plus:
  205.  
  206.  . For TCP/IP networking support, the sockets library and related header
  207.    files must be installed.
  208.  
  209.  . For the curses-based fullscreen file-ransfer display, the curses or
  210.    ncurses header file(s) and library, and probably also the termcap and/or
  211.    termlib library.  Note that the names and locations of these files and
  212.    libraries are likely to change capriciously with every new release of your
  213.    UNIX product.  If you discover that the C-Kermit build procedure fails
  214.    because your curses and/or termxxx headers or libraries are not named or
  215.    located as expected, please let us know.  In the meantime, work around by
  216.    installing symlinks.
  217.  
  218.  . IMPORTANT: Modern Linux distributions might give you the choice during
  219.    installation of whether to install the "ncurses development package"
  220.    (perhaps called "ncurses-devel").  If you did not install it, you won't
  221.    be able to build C-Kermit with curses support included.  In this case,
  222.    either go back and install ncurses, or else choose (or create) a
  223.    non-curses makefile target for your platform.  To install the ncurses
  224.    developers tools in Red Hat Linux, do:
  225.  
  226.      mount redhat cdrom
  227.      goto RedHat/RPMS
  228.      rpm -ivh ncurses-devel*.rpm
  229.      or to have the exact name ls ncurse* and load as
  230.      rpm -ivh filename
  231.      then leave the cdrom and unmount it.
  232.  
  233. Directions:
  234.  
  235. The makefile might need to be renamed from ckuker.mak to makefile.
  236.  
  237.  a. Type "make xxx" where xxx is the name of the makefile target most
  238.     appropriate to your platform, e.g. "make linux", "make aix43", etc.  Read
  239.     the comments at the top of the makefile for a complete list of available
  240.     targets (it's a long list).
  241.  
  242.  b. Test the resulting 'wermit' file (see Section 7 for suggestions).
  243.     If it's OK, proceed; otherwise notify us.
  244.  
  245.  c. Rename the 'wermit' file to 'kermit', copy it to the desired binary
  246.     directory (such as /usr/local/bin or /opt/something), and if it is to be
  247.     used for dialing out, give it the same owner, group, and permissions as
  248.     the 'cu' program (IMPORTANT: read Sections 10 and 11 for details).
  249.  
  250.  d. Install the man page, ckuker.nr, with your local man pages.
  251.  
  252.  e. Install the accompanying text files (see Section 5).
  253.  
  254. Steps (c) through (e) can be accomplished using the 'install' target in the
  255. makefile.  Directories are specified by the following variables:
  256.  
  257.  Name        Default
  258.   BINDIR      /usr/local/bin
  259.   MANDIR      /usr/man/manl
  260.   MANEXT      l (that's letter "l" for "local", not digit 1)
  261.   INFODIR     /usr/local/doc/kermit
  262.  
  263. To use the defaults, just type "make install".  You can override any of the
  264. defaults on the 'make' command line, e.g.:
  265.  
  266.   make "INFODIR=/usr/share/lib/kermit" install
  267.  
  268. The 'install' target does not attempt to set Kermit's owner, group, and
  269. permissions to allow dialing out.  This requires privileges and open eyes.
  270. Please read Sections 10 and 11 below, make the necessary decisions, and then
  271. implement them by hand as described in those sections.
  272.  
  273.  
  274. 4.0. Special Considerations for C-Kermit 7.0
  275.  
  276. (Also see ckccfg.txt Section 8.)
  277.  
  278. Lots of new features have been added, requiring access to new symbols, APIs,
  279. libraries, etc, and this will no doubt cause problems in compiling, linking,
  280. or execution on platforms where 6.0 and earlier built without incident.  This
  281. section contains all we know as of the date of this file.
  282.  
  283. The first category concerns the new Kermit Service Daemon (IKSD; see separate
  284. iksd.txt file for details):
  285.  
  286. The wtmp File
  287.   When C-Kermit is started as an IKSD (under inetd), it makes syslog and wtmp
  288.   entries, and also keeps its own ftpd-like log.  The code assumes the wtmp
  289.   log is /var/log/wtmp on Linux and /usr/adm/wtmp elsewhere.  No doubt this
  290.   assumption will need adjustment.  Use -DWTMPFILE=path to override at compile
  291.   time (there is also a runtime override).  See iksd.txt for details.
  292.  
  293. UTMP, utsname(), etc.
  294.   C-Kermit 7.0 gets as much info as it can about its job -- mainly for IKSD
  295.   logging -- from utmp.  But of course utmp formats and fields differ, and
  296.   for that matter, there can be two different header files, <utmp.h> and
  297.   <utmpx.h>.  Look for HAVEUTMPX and HAVEUTHOST in ckufio.c, let me know of
  298.   any needed adjustments.
  299.  
  300. Password lookup
  301.   IKSD also needs to authenticate incoming users against the password list.
  302.   In some cases, this requires the addition of -lcrypt (e.g. in Unixware 2.x).
  303.   In most others, the crypt functions are in the regular C library.  If you
  304.   get "crypt" as an unresolved symbol at link time, add -lcrypt to LIBS.
  305.   If your site has local replacement libraries for authentication, you might
  306.   need a special LIBS clause such as "LIBS= -L/usr/local/lib -lpwent".
  307.  
  308. getusershell()
  309.   This is called by the IKSD at login time to see if a user has been
  310.   "turned off".  But many UNIX platforms lack this function.  In that case,
  311.   you will get unresolved symbol reports at link time for _getusershell,
  312.   _endusershell; to work around, add -DNOGETUSERSHELL.
  313.  
  314. initgroups()
  315.   This is called by IKSD after successful authentication.  But some platforms
  316.   do not have this function, so obviously it can't be called there, in which
  317.   case add -DNOINITGROUPS.
  318.  
  319. setreuid(), setregid() not found or "deprecated"
  320.   Find out what your UNIX variety wants you to use instead, and make
  321.   appropriate substitutions in routine zvpass(), module ckufio.c.
  322.  
  323. printf()
  324.   IKSD installs a printf() substitute to allow redirection of printf-like
  325.   output to the connection.  However, this can conflict with some curses
  326.   libraries.  In this case, separate binaries must be built for IKSD and
  327.   non-IKSD use.
  328.  
  329. If you encounter difficulties with any of the above, and you are not
  330. interested in running C-Kermit as an IKSD, then simply add NOIKSD to CFLAGS
  331. and rebuild.  Example:
  332.  
  333.   make sco286
  334.   (get lots of errors)
  335.   make clean
  336.   make sco286 "KFLAGS=-DNOIKSD"
  337.  
  338. Some non-IKSD things to watch out for:
  339.  
  340. Return type of main()
  341.   The main() routine is in ckcmai.c.  If you get complaints about "main:
  342.   return type is not blah", define MAINTYPE on the CC command line, e.g.
  343.   'make xxx "KFLAGS=-DMAINTYPE=blah"' (where "blah" is int, long, or whatever).
  344.   If the complaint is "Attempt to return a value from a function of type void"
  345.   then add -DMAINISVOID:  'make xxx "KFLAGS=-DMAINISVOID"'
  346.  
  347. DNS Service Records
  348.   This feature allows a remote host to redirect C-Kermit to the appropriate
  349.   socket for the requested service; e.g. if C-Kermit requests service
  350.   "telnet" and the host offers Telnet service on port 999 rather than the
  351.   customary port 23.  If you get compile-time complaints about not being
  352.   able to find <resolv.h>, <netdb.h>, or <arpa/nameser.h>, add -DNO_DNS_SRV
  353.   to CFLAGS.  If you get link-time complaints about unresolved symbols
  354.   res_search or dn_expand, try adding -lresolve to LIBS.
  355.  
  356. \v(ipaddress)
  357.   If "echo \v(ipaddress)" shows an empty string rather than your local
  358.   IP address, add -DCKGHNLHOST to CFLAGS and rebuild.
  359.  
  360. <sys/wait.h>
  361.   If this file can't be found at compile time, add -DNOREDIRECT to CFLAGS.
  362.   This disables the REDIRECT and PIPE commands and anything else that needs
  363.   the wait() system service.
  364.  
  365. syslog()
  366.   C-Kermit can now write syslog records.  Some older platforms might not have
  367.   the syslog facility.  In that case, add -DNOSYSLOG.  Others might have it,
  368.   but require addition of -lsocket to LIBS (SCO OSR5 is an example).  See
  369.   Section 15.
  370.  
  371. putenv()
  372.   If "_putenv" comes up as an undefined symbol, add -DNOPUTENV to CFLAGS
  373.   and rebuild.
  374.  
  375. "Passing arg1 of 'time' from incompatible pointer"
  376.   This is a mess.  See the mass of #ifdefs in the appropriate module,
  377.   ckutio.c or ckufio.c.
  378.  
  379. gettimeofday()
  380.   Wrong number of arguments.  On most platforms, gettimeofday() takes two
  381.   arguments, but on a handful of others (e.g. Motorola System V/88 V4,
  382.   SNI Reliant UNIX 5.43, etc) it takes one.  If your version of gettimeofday()
  383.   is being called with two args but wants one, add -DGTODONEARG.
  384.  
  385. "Assignment makes pointer from integer without a cast"
  386.   This warning might appear in ckufio.c or ckutio (or elsewhere), and usually
  387.   can be traced to the use of a system or library function that returns a
  388.   pointer but that is not declared in the system header files even though it
  389.   should be.  Several functions are commonly associated with this error:
  390.    . getcwd(): Add -DDCLGETCWD to CFLAGS and rebuild.
  391.    . popen():  Add -DDCLPOPEN  to CFLAGS and rebuild.
  392.    . fdopen(): Add -DDCLFDOPEN to CFLAGS and rebuild.
  393.  
  394. "Operands of = have incompatible types" (or "Incompatible types in assignment")
  395.   If this comes from ckcnet.c and comes from a statement involving inet_addr(),
  396.   try adding -DINADDRX to CFLAGS.  If that doesn't help, then try adding
  397.   -DNOMHHOST.
  398.  
  399. Complaints about args to get/setsockopt(), getpeername(), getsockname()
  400.   These are all in ckcnet.c.  Different platforms & OS's and versions of the
  401.   same OS change this all the time: int, size_t, unsigned long, etc.  All the
  402.   affected variables are declared according to #ifdefs within ckcnet.c, so
  403.   find the declarations and adjust the #ifdefs accordingly.
  404.  
  405. size_t
  406.   In case of complaints about "unknown type size_t", add -DSIZE_T=int (or
  407.   other appropriate type) to CFLAGS.
  408.  
  409. 'tz' undefined
  410. Use of undefined enum/struct/union 'timezone'
  411. Left of 'tv_sec' specifies undefined struct/union 'timeval'
  412.   And similar complaints in ckutio.c: Add -DNOGFTIMER and/or -DNOTIMEVAL.
  413.  
  414. Symlinks
  415.   The new built-in DIRECTORY command should show symlinks like "ls -l" does.
  416.   If it does not, check to see if your platform has the lstat() and
  417.   readlink() functions.  If so, add -DUSE_LSTAT and -DCKSYMLINK to CFLAGS
  418.   and rebuild.  On the other hand, if lstat() is unresolved at link time,
  419.   add -DNOLSTAT to CFLAGS.  If readlink() is also unresolved, add -DNOSYMLINK.
  420.  
  421. realpath()
  422.   Link-time complains about realpath() -- find the library in which it resides
  423.   and add it to LIBS (example for Unixware 7.1: "-lcudk70") or add
  424.   -DNOREALPATH to CFLAGS and rebuild.
  425.  
  426. Failure to locate header file <term.h>
  427.   Usually happens on Linux systems that have the C compiler installed,
  428.   but not the ncurses package (see comments about selective installs above).
  429.   Go back and install ncurses, or use "make linuxnc" (Linux No Curses).
  430.  
  431. "Can't find shared library libc.so.2.1"
  432. "Can't find shared library libncurses.so.3.0", etc...
  433.   You are trying to run a binary that was built on a computer that has
  434.   different library versions than your computer, and your computer's
  435.   loader is picky about library version numbers.  Rebuild from source
  436.   on your computer.
  437.  
  438. Time (struct tm) related difficulties:
  439.   Errors like the following:
  440.  
  441.     "ckutio.c", line 11994: incomplete struct/union/enum tm: _tm
  442.     "ckutio.c", line 11995: error: cannot dereference non-pointer type
  443.     "ckutio.c", line 11995: error: assignment type mismatch
  444.     "ckutio.c", line 11997: warning: using out of scope declaration: localtime
  445.     "ckutio.c", line 11997: error: unknown operand size: op "="
  446.     "ckutio.c", line 11997: error: assignment type mismatch
  447.     "ckutio.c", line 11998: error: undefined struct/union member: tm_year
  448.     "ckutio.c", line 12000: error: undefined struct/union member: tm_mon
  449.     "ckutio.c", line 12001: error: undefined struct/union member: tm_mday
  450.     "ckutio.c", line 12002: error: undefined struct/union member: tm_hour
  451.     "ckutio.c", line 12003: error: undefined struct/union member: tm_min
  452.     "ckutio.c", line 12004: error: undefined struct/union member: tm_sec
  453.  
  454.   are due to failure to include the appropriate time.h header files.  UNIX
  455.   platforms generally have one or more of the following: <time.h>,
  456.   <sys/time.h>, and <sys/timeb.h>.  Any combination of these might be
  457.   required.  Defaults are set up for each makefile target.  The defaults can
  458.   be corrected on the CC command line by adding the appropriate definition
  459.   from the following list to CFLAGS:
  460.  
  461.     -DTIMEH         Include <time.h>
  462.     -DNOTIMEH       Don't include <time.h>
  463.     -DSYSTIMEH      Include <sys/time.h>
  464.     -DNOSYSTIMEH    Don't include <sys/time.h>
  465.     -DSYSTIMEBH     Include <sys/timeb.h>
  466.     -DNOSYSTIMEBH   Don't include <sys/timeb.h>
  467.  
  468.   Note that <sys/timeb.h> is relatively scarce in the System V and POSIX
  469.   environments; the only platform of recent vintage where it is still used is
  470.   OSF/1 and its derivatives (Digital UNIX and Tru64 UNIX).
  471.  
  472. Struct timeval and/or timezone not declared:
  473.   In some cases, merely including the appropriate time.h header files is still
  474.   not enough.  POSIX.1 does not define the timeval struct, and so the items we
  475.   need from the header are protected against us by #ifndef _POSIX_SOURCE or
  476.   somesuch.  In this case, we have to declare the timeval (and timezone)
  477.   structs ourselves.  To force this, include -DDCLTIMEVAL in CFLAGS.
  478.  
  479. Warnings about dn_expand() Argument #4
  480.   WARNING: argument is incompatible with prototyp.  It's the old char versus
  481.   unsigned char stupidity again.  Try to find a compiler switch like GCC's
  482.   "-funsigned-char".  Failing that, add -DCKQUERYTYPE=xxx to CFLAGS, where
  483.   xxx is whatever 'man dn_expand' tells you the type of the 4th argument
  484.   should be (presumably either char or unsigned char; in the latter case use
  485.   CHAR to avoid confusion caused by multiple words.
  486.  
  487. Switch Table Overflow (in ckouni.c)
  488.   Add -DNOUNICODE to CFLAGS.
  489.  
  490. Compile-time warnings about ck_out() or tgetstr() or tputs():
  491.   Easy solution: Add -DNOTERMCAP to CFLAGS.  But then you lose the SCREEN
  492.   function.  Real solution:  Try all different combinations of the following
  493.   CFLAGS:
  494.          -DTPUTSARGTYPE=char    -DTPUTSFNTYPE=int
  495.          -DTPUTSARGTYPE=int     -DTPUTSFNTYPE=void
  496.  
  497.   Until the warnings go away, except maybe "ck_outc: return with a value in
  498.   a function returning void", and in that case also add -DTPUTSISVOID.
  499.  
  500. "Passing arg 1 of to tputs() makes pointer from integer without a cast":
  501.   Add -DTPUTSARG1CONST to CFLAGS.
  502.  
  503. "Undefined symbol: dup2"
  504.   Add -DNOZEXEC to CFLAGS.
  505.  
  506. "header file 'termcap.h' not found"
  507.   Add -DNOHTERMCAP to CFLAGS.
  508.  
  509. Other difficulties are generally of the "where is curses.h and what is it
  510. called this week?" variety (most easily solved by making symlinks in the
  511. include and lib directories), or overzealous complaints regarding type
  512. mismatches in function calls because of the totally needless and silly
  513. signed versus unsigned char conflict (*), etc.  In any case, please send any
  514. compilation or linking warnings or errors to the author, preferably along
  515. with fixes.
  516.  
  517. (*) C-Kermit does not use the signed property of chars at all anywhere,
  518.     ever.  So if all chars and char *'s can be made unsigned at compile
  519.     time, as they can in gcc with "-funsigned-char", they should be.
  520.  
  521. IMPORTANT: If you find any of these hints necessary for a particular make
  522. target (or you hit upon others not listed here), PLEASE SEND A REPORT TO:
  523.  
  524.   kermit-support@columbia.edu.
  525.  
  526. 4.1. The UNIX Makefile
  527.  
  528. If your distribution does not contain a file with this name, then
  529. rename the file called ckuker.mak to makefile:
  530.  
  531.   mv ckuker.mak makefile
  532.  
  533. and then you type "make xxx", where xxx is the system you want to build
  534. C-Kermit for.  These are listed in the comments at the top of the makefile.
  535. For example, to build C-Kermit for Linux, type:
  536.  
  537.   make linux
  538.  
  539. The makefile is quite long, and at least two versions of UNIX, SCO Xenix/286
  540. and 2.x BSD, cannot cope with its length.  An attempt to "make sco286" gives
  541. the message "Make: Cannot alloc mem for env..  Stop".  Solution: edit away
  542. some or all of the nonrelevant material from the makefile.   (A separate
  543. version of the makefile is provided for BSD 2.x: ckubs2.mak but C-Kermit 7.0
  544. can't be build for BSD 2.x -- it has simply grown too large.)
  545.  
  546. Some make programs reportedly cannot handle continued lines (lines ending
  547. in backslash (\)).  If you have a problem with the makefile, try editing the
  548. makefile to join the continued lines (remove the backslashes and the following
  549. linefeed).
  550.  
  551. Other makefile troubles may occur because tabs in the makefile have somehow
  552. been converted to spaces.  Spaces and tabs are distinct in UNIX makefiles.
  553.  
  554. Similarly, carriage returns might have been added to the end of each line,
  555. which also proves confusing to most UNIX versions of make.
  556.  
  557. Check to see if there are comments about your particular version in its
  558. makefile entry itself.  In a text editor such as EMACS or VI, search for the
  559. make entry name followed by a colon, e.g. "linux:" (if you really are building
  560. C-Kermit for Linux, do this now).
  561.  
  562. Check to see if there are comments about your particular version in the
  563. ckubwr.txt file.
  564.  
  565. If you have trouble with building ckwart.c, or running the resulting wart
  566. preprocessor program on ckcpro.w:
  567.  
  568.   1. Just "touch" the ckcpro.c file that comes in the distribution and
  569.      then give the "make" command again, or:
  570.  
  571.   2. Compile ckwart.c "by hand":  cc -o wart ckwart.c, or:
  572.  
  573.   3. Try various other tricks.  E.g. one Linux user reported that that adding
  574.      the "static" switch to the rule for building wart fixed everything:
  575.  
  576.      wart: ckwart.$(EXT)
  577.            $(CC) -static -o wart ckwart.$(EXT) $(LIBS)
  578.  
  579. If your compiler supports a compile-time option to treat ALL chars (and
  580. char *'s, etc) as unsigned, by all means use it -- and send me email to let
  581. me know what it is.
  582.  
  583. To add compilation options (which are explained later in this document) to
  584. your makefile entry without editing the makefile, include "KFLAGS=..." on the
  585. make command line, for example:
  586.  
  587.   make linux KFLAGS=-DNODEBUG
  588.   make bsd "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET"
  589.  
  590. Multiple options must be separated by spaces.  Quotes are necessary if the
  591. KFLAGS= clause includes spaces.  The KFLAGS are added to the end of the CFLAGS
  592. that are defined in the selected makefile entry.  For example, the "bsd" entry
  593. includes -DBSD4 -DTCPSOCKET, so the second example above compiles Kermit with
  594. the following options:
  595.  
  596.   -DBSD4 -DTCPSOCKET -DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET
  597.  
  598. (Notice how "-UTCPSOCKET" is used to negate the effect of the "-DTCPSOCKET"
  599. option that is included in the makefile entry.)
  600.  
  601. WARNING: Be careful with KFLAGS.  If you build C-Kermit, change some files,
  602. and then run make again using the same make entry but specifying different
  603. KFLAGS than last time, make won't detect it and you could easily wind up with
  604. inconsistent object modules, e.g. some of them built with a certain option,
  605. others not.  When in doubt, "make clean" first to make sure all your object
  606. files are consistent.  Similarly, if you change CFLAGS, LIBS, or any other
  607. items in the makefile, or you rebuild using a different makefile entry, "make
  608. clean" first.
  609.  
  610. If you create a new makefile entry, use static linking if possible.  Even
  611. though this makes your C-Kermit binary bigger, the resulting binary will be
  612. more portable.  Dynamically linked binaries tend to run only on the exact
  613. configuration and version where they were built; on others, invocation tends
  614. to fail with a message like:
  615.  
  616.   Can't find shared library "libc.so.2.1"
  617.  
  618. 4.2. The C-Kermit Initialization File
  619.  
  620. There are several choices for how to handle the C-Kermit initialization file.
  621.  
  622.  a. The default action is to execute ~/.kermrc (i.e. the ".kermrc" file in
  623.     the user's login directory) upon startup.  But since the initialization
  624.     is standardized, it would be wasteful on multiuser systems to duplicate it
  625.     in every user's home directory.
  626.  
  627.  b. Define a system-wide initialization file (described below).
  628.  
  629.  c. Install the standard initialization file in the system-wide PATH as an
  630.     executable Kerbang script (ckermit2.txt Section 7.19).  Users who want to
  631.     take advantage of the services directory and other features that are
  632.     defined in the standard initialization file can "run" the initialization
  633.     file to get them, whereas those who don't need them can run Kermit
  634.     directly.
  635.  
  636. If you want to define a system-wide initialization file for C-Kermit, rather
  637. than making each user have her/his own copy, define the symbol CK_SYSINI to be
  638. the full pathname of the file, e.g.:
  639.  
  640.   -DCK_SYSINI=\\\"/usr/local/lib/kermit/ckermit.ini\\\"
  641.  
  642. It's best to edit the makefile to add this, because there is no good method
  643. for putting it on the 'make' command line with KFLAGS -- the number of escapes
  644. (\\\\...) for the doublequotes would depend on how deeply the particular make
  645. entry is nested; each level of nesting strips off another layer of escapes.
  646. Here's one example that works, but other targets will be different:
  647.  
  648.   make sunos41 "KFLAGS=-DCK_SYSINI=\\\\\\\"/usr/local/lib/ckermit.ini\\\\\\\""
  649.  
  650. Or, you can define CK_DSYSINI (note "D") to build C-Kermit with its built-in
  651. default name for a system-wide init file, /usr/local/bin/ckermit.ini, or
  652. /usr/share/lib/kermit/ckermit.ini, depending on which version of UNIX it is.
  653. Since no quoting is needed, this one works with KFLAGS, e.g.:
  654.  
  655.   make sunos41c KFLAGS=-DCK_DSYSINI
  656.  
  657. The question arises: if you want C-Kermit to have a system-wide initialization
  658. file, should it take precedence over the user's own?  There are valid reasons
  659. for answering yes or no.  By default, if you build C-Kermit with a system-wide
  660. initialization file, it will take precedence over the user's -- that is, it
  661. will be executed instead of the user's, if the user has one.  You might also
  662. want to set things up so the user's init file is executed if she has one, but
  663. if she doesn't, the system-wide one will be.  Either setup is possible.
  664. Assuming CK_SYSINI is defined, then the following symbols determine the order:
  665.  
  666.   CK_INI_A
  667.     This means the system-wide init file is looked for first; if found, it
  668.     is executed.  If not found, the user's init file is executed.
  669.  
  670.   CK_INI_B
  671.     This means the user's init file is looked for first; if found, it is
  672.     executed.  If not found, the system-wide init file is executed.
  673.  
  674. If CK_SYSINI is defined, but neither CK_INI_A nor CK_INI_B are defined (or
  675. both of them are), then CK_INI_A is assumed.
  676.  
  677. If you build Kermit with CK_SYSINI and CK_INI_A, you can "chain" to the user's
  678. own initialization file (if any) by ending (or starting, depending on the
  679. desired precedence) the system-wide init file with a command like:
  680.  
  681.   if exist \v(home).kermrc take \v(home).kermrc
  682.  
  683. In any case, the initialization file should chain to the user's customization
  684. file, as in this clause from the standard ckermit.ini:
  685.  
  686.   if exist \m(_myinit)  {        ; If it exists,
  687.       echo Executing \m(_myinit)...    ; print message,
  688.       take \m(_myinit)            ; and TAKE the file.
  689.   }
  690.  
  691. 4.3. The 2.x BSD Makefile
  692.  
  693. Use the separate makefile ckubs2.mak.  Read the instructions in that file.
  694. NOTE: C-Kermit 6.0 was probably the last version of C-Kermit that could be
  695. built for 2.x BSD -- it just barely fit with a few bytes to spare into the
  696. maximum overlay model.  More recent versions are larger.  But it might be
  697. possible to make it fit using different overlay arrangements; anybody who
  698. cares is welcome to try.
  699.  
  700. 4.4. The Plan 9 Makefile
  701.  
  702. Use the separate makefile ckpker.mk.
  703.  
  704. 4.5. Makefile Failures
  705.  
  706. First, be sure the source files are stored on your current disk and directory
  707. with the right names (in lowercase).  Second, make sure that the makefile
  708. itself does not contain any lines with leading spaces: indented lines must all
  709. start with horizontal TAB, and no spaces.
  710.  
  711. Then make sure that your UNIX PATH is defined to find the appropriate compiler
  712. for your makefile entry.  For example, on SunOS systems, "make sunos41" builds
  713. C-Kermit for the BSD environment, and assumes that /usr/ucb/cc will be used
  714. for compilation and linking.  If your PATH has /usr/5bin ahead of /usr/ucb,
  715. you can have problems at compile or link time (a commonly reported symptom is
  716. the inability to find "ftime" during linking).  Fix such problems by
  717. redefining your UNIX PATH, or by specifying the appropriate "cc" in CC=
  718. and CC2= statements in your makefile entry.
  719.  
  720. During edits 166-167, considerable effort went into making C-Kermit compilable
  721. by ANSI C compilers.  This includes prototyping all of C-Kermit's functions,
  722. and including the ANSI-defined system header files for system and library
  723. functions, as defined in K & R, second edition: <string.h>, <stdlib.h>,
  724. <unistd.h> (except in NeXTSTEP this is <libc.h>), and <sys/stdtypes.h>.  If
  725. you get warnings about any of these header files not being found, or about
  726. argument mismatches involving pid_t, uid_t, or gid_t, look in ckcdeb.h and
  727. make amendments.  C-Kermit assumes it is being compiled by an ANSI-compliant C
  728. compiler if __STDC__ is defined, normally defined by the compiler itself.  You
  729. can force ANSI compilation without defining __STDC__ (which some compilers
  730. won't let you define) by including -DCK_ANSIC on the cc command line.
  731.  
  732. On the other hand, if your compiler defines __STDC__ but still complains about
  733. the syntax of Kermit's function prototypes, you can disable the ANSI-style
  734. function prototyping by including -DNOANSI on the command line.
  735.  
  736. For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick the
  737. most appropriate makefile entry, and be sure you have installed an SCO
  738. development system that is keyed to your exact SCO operating system release,
  739. down to the minor version (like 2.3.1).
  740.  
  741. Also note that SCO distributes some of its libraries in encrypted form, and
  742. they must be decrypted before C-Kermit can be linked with them.  If not, you
  743. might see a message like:
  744.  
  745.   ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365
  746.  
  747. To decrypt, you must supply a key (password) that came with your license.
  748. Call SCO for further info.
  749.  
  750. If your compiler uses something other than int for the pid (process id) data
  751. type, put -DPID_T=pid_t or whatever in your CFLAGS.
  752.  
  753. If you get complaints about unknown data types uid_t and gid_t, put
  754. -DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the appropriate
  755. types.
  756.  
  757. If your compilation fails because of conflicting or duplicate declarations for
  758. sys_errlist, add -DNDSYSERRLIST to CFLAGS.
  759.  
  760. If your compilation dies because getpwnam() is being redeclared (or because
  761. of "conflicting types for getwpnam"), add -DNDGPWNAM to your CFLAGS.
  762. If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see ckufio.c around
  763. line 440).
  764.  
  765. If the compiler complains about the declaration of getpwnam() during an ANSI C
  766. compilation, remove the declaration from ckufio.c or change the argument in
  767. the prototype from (char *) to (const char *).
  768.  
  769. If you get complaints that getpwuid() is being called with an improper type,
  770. put -DPWID_T=xx in your CFLAGS.
  771.  
  772. If you get compile-time warnings that t_brkc or t_eofc (tchars structure
  773. members, used in BSD-based versions) are undefined, or structure-member-
  774. related warnings that might be traced to this fact, add -DNOBRKC to CFLAGS.
  775.  
  776. If you get a linker message to the effect that _setreuid or _setregid is not
  777. defined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=<blah> to CFLAGS to make
  778. C-Kermit read the right <types.h>-kind-of-file to pick up these definitions.
  779.  
  780. If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS.
  781.  
  782. If you get a complaint at compile time about an illegal pointer-integer
  783. combination in ckufio.c involving popen(), or at link time that _popen is an
  784. undefined symbol, add the declaration "FILE *popen();" to the function zxcmd()
  785. in ckufio.c (this declaration is supposed to be in <stdio.h>).  If making this
  786. change does not help, then apparently your UNIX does not have the popen()
  787. function, so you should add -DNOPOPEN to your make entry, in which case
  788. certain functions involving "file" i/o to the standard input and output of
  789. subprocesses will not be available.
  790.  
  791. If your linker complains that _getcwd is undefined, you can add a getcwd()
  792. function to ckufio.c, or add it to your libc.a library using ar:
  793.  
  794. #include <stdio.h>
  795.  
  796. char *
  797. getcwd(buf,size) char *buf; int size; {
  798. #ifndef NOPOPEN
  799. #ifdef DCLPOPEN
  800.     FILE *popen();
  801. #endif
  802.     FILE *pfp;
  803.  
  804.     if (!buf) return(NULL);
  805.     if (!(pfp = popen("pwd","r"))) return(NULL);
  806.     fgets(buf,size-2,pfp);
  807.     pclose(pfp);
  808.     buf[strlen(buf)-1] = '\0';
  809.     return((char *)buf);
  810. #else
  811.     buf[0] = '\0';
  812.     return(NULL);
  813. #endif /* NOPOPEN */
  814. }
  815.  
  816. #ifdef NOPOPEN
  817. FILE *popen(s,t) char *s,*t; {
  818.     return(NULL);
  819. }
  820. #endif /* NOPOPEN */
  821.  
  822. If you get complaints about NPROC having an invalid value, add a valid
  823. definition for it (depends on your system), as in the cray entry.
  824.  
  825. If you get some symbol that's multiply defined, it probably means that a
  826. variable name used by Kermit is also used in one of your system libraries that
  827. Kermit is linked with.  For example, under PC/IX some library has a variable
  828. or function called "data", and the variable "data" is also used extensively by
  829. Kermit.  Rather than edit the Kermit source files, just put a -D in the make
  830. entry CFLAGS to change the Kermit symbol at compile time.  In this example, it
  831. might be -Ddata=datax.
  832.  
  833. Some symbol is defined in your system's header files, but it produces
  834. conflicts with, or undesired results from, Kermit.  Try undefining the symbol
  835. in the makefile entry's CFLAGS, for example -UFIONREAD.
  836.  
  837. Some well-known symbol is missing from your system header files.  Try defining
  838. in the makefile entry's CFLAGS, for example -DFREAD=1.
  839.  
  840. You get many warnings about pointer mismatches.  This probably means that
  841. Kermit is assuming an int type for signal() when it should be void, or
  842. vice-versa.  Try adding -DSIG_I (for integer signal()) or -DSIG_V (for void)
  843. to CFLAGS.  Or just include KFLAGS=-DSIG_V (or whatever) in your "make"
  844. command, for example:
  845.  
  846.   make bsd KFLAGS=-DSIG_V
  847.  
  848. You get many messages about variables that are declared and/or set but never
  849. used.  It is difficult to avoid these because of all the conditional
  850. compilation in the program.  Ignore these messages.
  851.  
  852. Some of C-Kermit's modules are so large, or contain so many character string
  853. constants, or are so offensive in some other way, that some C compilers give
  854. up and refuse to compile them.  This is usually because the -O (optimize)
  855. option is included in the make entry.  If this happens to you, you can
  856. (a) remove the -O option from the make entry, which will turn off the
  857. optimizer for ALL modules; or (b) compile the offending module(s) by hand,
  858. including all the switches from make entry except for -O, and then give the
  859. appropriate "make" command again; or (c) increase the value of the -Olimit
  860. option, if your compiler supports this option; or (d) change the makefile
  861. entry to first compile each offending module explicitly without optimization,
  862. then compile the others normally (with optimization), for example:
  863.  
  864. #Fortune 32:16, For:Pro 2.1 (mostly like 4.1bsd)
  865. ft21:
  866.     @echo 'Making C-Kermit $(CKVER) for Fortune 32:16 For:Pro 2.1...'
  867.     $(MAKE) ckuusx.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  868.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  869.     $(MAKE) ckuxla.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  870.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  871.     $(MAKE) ckudia.$(EXT) "CFLAGS= -DNODEBUG -DBSD4 -DFT21 -DNOFILEH \
  872.     -SYM 800 \ -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short"
  873.     $(MAKE) wermit "CFLAGS= -O -DNODEBUG -DBSD4 -DFT21 -DNOFILEH -SYM 800 \
  874.     -DDYNAMIC -DNOSETBUF -DCK_CURSES $(KFLAGS) -DPID_T=short" \
  875.     "LNKFLAGS= -n -s" "LIBS= -lcurses -ltermcap -lv -lnet"
  876.  
  877. As an extreme example, some compilers (e.g. gcc on the DG AViiON) have been
  878. known to dump core when trying to compile ckwart.c with optimization.  So just
  879. do this one "by hand":
  880.  
  881.   cc -o wart ckwart.c
  882.  
  883. or:
  884.  
  885.   touch ckcpro.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.  
  909. 5. INSTALLING THE KERMIT FILES
  910.  
  911. There is an "install" entry in the makefile, but it is only a sample.  Since
  912. every site has its own layout and requirements, it is better to install the
  913. Kermit files by hand.
  914.  
  915. After you have built and tested the C-Kermit program successfully, you can
  916. discard the object (ck*.o) files, which are no longer needed.  Use "make
  917. clean" to do this.  If you don't need the source files (ck[cuw]*.[cwh]), you
  918. can remove them too.
  919.  
  920. You should install the C-Kermit program in a directory that is in the users'
  921. PATH, but that is not likely to be overwritten when you install a new version
  922. of the operating system.  A good candidate would be the /usr/local/bin/
  923. directory.  Example:
  924.  
  925.   mv wermit /usr/local/bin/kermit
  926.   chmod 775 /usr/local/bin/kermit  <--  But see Section 10.
  927.  
  928. You should also install the man page, which is called ckuker.nr, in the
  929. man page directory for local commands, such as /usr/man/manl/, renamed
  930. appropriately, e.g. to kermit.l.
  931.  
  932. Several text files should be placed in a publicly readable directory, and the
  933. man page should be altered, if necessary (in the FILES section), to point to
  934. that directory.  Suggested directory names are:
  935.  
  936.   /usr/local/doc/kermit/
  937.   /usr/local/lib/kermit/
  938.   /usr/share/lib/kermit/
  939.  
  940. (or any of these without the "/kermit").  Upon startup, C-Kermit checks the
  941. following environment variables whose purpose is to specify the directory
  942. where the C-Kermit text files are, in the following order:
  943.  
  944.   K_INFO_DIRECTORY
  945.   K_INFO_DIR
  946.   KERMITINFO
  947.  
  948. If any of these is defined, C-Kermit checks for the existence of the
  949. ckermit2.txt file (the C-Kermit 7.0 updates documentation).  If not found,
  950. it checks the directories listed above (both with and without the "/kermit")
  951. plus several others to see if they contain the ckermit2.txt file.  If found,
  952. various C-Kermit messages can refer the user to this directory.
  953.  
  954.   READ.ME
  955.     Explanation of the following files.  You can create this file by
  956.     clipping out the following file list.
  957.  
  958.   COPYING.TXT
  959.     Copyright notice, permissions, and disclaimer.
  960.  
  961.   ckermit.ini
  962.     The standard initialization file.  Users should copy this to
  963.     their home directories and rename it to .kermrc.  (In C-Kermit 5A(190)
  964.     and later, you can designate a single copy as the system-wide
  965.     initialization file; details above).
  966.  
  967.   ckermod.ini
  968.     A sample customization file.  Users should copy this file to
  969.     their home directories, make any desired modifications (user- or
  970.     site-specific customizations), and rename it to .mykermrc.
  971.  
  972.   ckermit.kdd
  973.     A sample dialing directory file.
  974.  
  975.   ckermit.knd
  976.     A sample network directory.
  977.  
  978.   ckermit.ksd
  979.     A sample services directory.
  980.  
  981.   ckedemo.ksc
  982.     Macro definitions from "Using C-Kermit".
  983.  
  984.   ckevt.ksc
  985.     Command file to demonstrate special screen effects from "Using C-Kermit".
  986.  
  987.   ckepage.ksc
  988.     A sample script for sending alphanumeric pages.
  989.  
  990.   ckurzsz.ini
  991.     Macros for using rz and sz as external protocols.
  992.  
  993.   ckermit2.txt
  994.     A file listing the updates, changes, and corrections made to C-Kermit
  995.     since publication of "Using C-Kermit".
  996.  
  997.   ckcbwr.txt
  998.     The general C-Kermit "beware" file.
  999.  
  1000.   ckubwr.txt
  1001.     The UNIX-specific C-Kermit beware file.
  1002.  
  1003. We recommend that the C-Kermit initialization file, named ckermit.ini in the
  1004. distribution, be executed by all users, since it defines and sets up certain
  1005. important features, such as the dialing directory, services directory,
  1006. commonly-used macros, etc.  On multiuser systems, it can be put in a common
  1007. place and shared by all users, but this requires building C-Kermit from source
  1008. in a special way, which embeds the full path of common initialization file in
  1009. the program binary, described above.
  1010.  
  1011. Alternatively, each user can copy the ckermit.ini file into her login
  1012. directory and rename it to .kermrc.
  1013.  
  1014. The user's private "customization file" goes in the login directory and is
  1015. called .mykermrc.
  1016.  
  1017.  
  1018. 6. INSTALLING UNIX C-KERMIT FROM DOS-FORMAT DISKETTES
  1019.  
  1020. If you received a DOS-format diskette containing a binary executable C-Kermit
  1021. program plus supporting text files, be sure to chmod +x the executable before
  1022. attempting to run it.
  1023.  
  1024. In version 5A(190) and later, all the text files on the C-Kermit DOS-format
  1025. diskettes are in UNIX format: LF at the end of each line rather than CRLF.
  1026. This means that no conversions are necessary when copying to your UNIX file
  1027. system, and that all the files on the diskette, text and binary, can be copied
  1028. together.  The following comments apply to the DOS-format diskettes furnished
  1029. with version 5A(189) and earlier or to other DOS-format diskettes you might
  1030. have obtained from other sources.
  1031.  
  1032. If you have received C-Kermit on MS-DOS format diskettes (such as those
  1033. distributed by Columbia University), you should make sure that your
  1034. DOS-to-UNIX conversion utility (such as "dosread") both: (1) changes line
  1035. terminators in all files from carriage-return linefeed (CRLF) to just linefeed
  1036. (LF) (such as "dosread -a") and remove any Ctrl-Z's, and (2) that all
  1037. filenames are converted from uppercase to lowercase.  If these conversions
  1038. were not done, you can use the following shell script on your UNIX system to
  1039. do them:
  1040. ---(cut here)---
  1041. #!/bin/sh
  1042. #
  1043. # Shell script to convert C-Kermit DOS-format files into UNIX format.
  1044. # Lowercases the filenames, strips out carriage returns and Ctrl-Z's.
  1045. #
  1046. x=$1 # the name of the source directory
  1047. y=$2 # the name of the target directory if [ $# -lt 2 ]; then
  1048.   echo "usage: $0 source-directory target-directory"
  1049.   exit 1
  1050. fi
  1051. if cd $1 ; then
  1052.   echo "Converting files from $1 to $2"
  1053. else
  1054.   echo "$0: cannot cd to $1"
  1055.   exit 1
  1056. fi
  1057. for i in *; do
  1058.   j=`echo $i | tr 'A-Z' 'a-z'`
  1059.   echo $x/$i =\> $y/$j
  1060.   tr -d '\015\032' < $i > $y/$j
  1061. done
  1062. ---(cut here)---
  1063. Cut out this shell script, save it as "convert.sh" (or any other name you
  1064. prefer), then "chmod +x convert.sh".  Then, create a new, empty directory
  1065. to put the converted files in, and then "convert.sh /xxx /yyy" where /xxx
  1066. is the name of the directory where the PC-format files are, and /yyy is the
  1067. name of the new, empty directory.  The converted files will appear in the
  1068. new directory.
  1069.  
  1070.  
  1071. 7. CHECKING THE RESULTS
  1072.  
  1073. First some quick checks for problems that can be easily corrected by
  1074. recompiling with different options:
  1075.  
  1076. DIRECTORY listing is garbage
  1077.   Permissions, size, and date are random garbage (but the filenames are
  1078.   correct) in a C-Kermit DIRECTORY listing.  On some platforms, the lstat()
  1079.   function is present but simply doesn't work; try adding -DNOLSTAT to CFLAGS
  1080.   and rebuild.  If that doesn't fix it, also add -DNOLINKBITS.  If it's
  1081.   still not fixed, remove -DNOLSTAT and -DNOLINKBITS and add -DNOSYMLINK.
  1082.  
  1083. curses
  1084.   When you make a connection with C-Kermit and transfer files using the
  1085.   fullscreen (curses) file-transfer display, and then get the C-Kermit>
  1086.   prompt back afterwards, do characters echo when you type them?  If not,
  1087.   the curses library has altered the buffering of /dev/tty.  Try rebuilding
  1088.   with KFLAGS=-DCK_NEWTERM.  If it already has -DCK_NEWTERM in CFLAGS, try
  1089.   removing it.  If nothing works (and you can't fix the code), then either
  1090.   don't use the fullscreen display, or rebuild with -DNOCURSES.
  1091.  
  1092. Ctrl-L or any SCREEN command crashes C-Kermit:
  1093.   Rebuild with -DNOTERMCAP
  1094.  
  1095. No prompt after CONNECT:
  1096.   After escaping back from CONNECT mode, does your C-Kermit> prompt
  1097.   disappear?  (Yet, typing "?" still produces a command list, etc)
  1098.   In that case, add -DCKCONINTB4CB to CFLAGS and rebuild.
  1099.  
  1100. Here is a more thorough checklist can use to tell whether your version of
  1101. C-Kermit was built correctly for your UNIX system, with hints on how to fix
  1102. or work around problems:
  1103.  
  1104.   a. Start C-Kermit (usually by typing "./wermit" in the directory where you
  1105.      ran the makefile).  Do you see the C-Kermit> prompt?  If not, C-Kermit
  1106.      incorrectly deduced that it was running in the background.  The test is
  1107.      in conbgt() in ckutio.c.  If you can fix it for your system, please send
  1108.      in the fix (Hint: read about "PID_T" below).  Otherwise, you can force
  1109.      C-Kermit to foreground mode by starting it with the -z command line
  1110.      option, as in "kermit -z", or giving the interactive command SET
  1111.      BACKGROUND OFF.
  1112.  
  1113.   b. When you type characters at the C-Kermit prompt, do they echo
  1114.      immediately?  If not, something is wrong with concb() and probably the
  1115.      other terminal mode settings routines in ckutio.c.  Be sure you have used
  1116.      the most appropriate make entry.
  1117.  
  1118.   c. At the C-Kermit> prompt, type "send *?".  C-Kermit should list all the
  1119.      files in the current directory.  If not, it was built for the wrong type
  1120.      of UNIX file system.  Details below.  In the meantime, try SET
  1121.      WILDCARD-EXPANSION SHELL as a workaround.
  1122.  
  1123.   d. CD to a directory that contains a variety of files, symlinks, and
  1124.      subdirectories and give a DIRECTORY command at the C-Kermit> prompt. Do
  1125.      the permissions, size, and date appear correct?  If not see Section 4.0.
  1126.  
  1127.   3. Assuming your platform supports long file names, create a file with a
  1128.      long name in your current directory, e.g.:
  1129.  
  1130.      % touch thisisafilewithaveryveryveryveryveryveryveryverylooooooooongname
  1131.  
  1132.      (you might need to make it longer than this, perhaps as long as 257
  1133.      or even 1025 characters).
  1134.  
  1135.      Check with ls to see if your version of UNIX truncated the name.  Now
  1136.      start C-Kermit and type "send thisis<ESC>".  Does Kermit complete the
  1137.      name, showing the same name as ls did?  If not, wrong filesystem.  Read
  1138.      on.
  1139.  
  1140.   f. Make sure that Kermit has the maximum path length right.  Just type
  1141.      SHOW FILE and see what it says about this.  If it is too short, there
  1142.      could be some problems at runtime.  To correct, look in ckcdeb.h to
  1143.      see how the symbol CKMAXPATH is set and make any needed adjustments.
  1144.  
  1145.   g. Send a file to your new Kermit program from a different Kermit program
  1146.      that is known to work.  Is the date/timestamp of the new file identical
  1147.      to the original?  If not, adjustments are needed in zstrdt() in
  1148.      ckufio.c.
  1149.  
  1150.   h. Go to another computer (Computer B) from which you can send files to
  1151.      C-Kermit.  Connect Computer B to the computer (A) where you are testing
  1152.      C-Kermit.  Then:
  1153.  
  1154.   i. Send a file from B to A.  Make sure it transferred OK and was created
  1155.        with the the right name.
  1156.  
  1157.   j. Send a file from B to A, specifying an "as-name" that is very, very
  1158.      long (longer than the maximum name length on computer A).  Check to
  1159.      make sure that the file was received OK and that its name was truncated
  1160.      to Computer A's maximum length.  If not, check the MAXNAMLEN definition
  1161.      in ckufio.c.
  1162.  
  1163.   k. Tell C-Kermit on Computer A to "set receive pathnames relative" and
  1164.      then send it a file from Computer B specifying an as-name that contains
  1165.      several directory segments:
  1166.  
  1167.        send foo dir1/dir2/dir3/foo
  1168.  
  1169.      Check to make sure that dir1/dir2/dir3/foo was created in Computer A's
  1170.      current directory (i.e. that three levels of directories were created).
  1171.  
  1172.   l. Repeat step k, but make each path segment in the pathname longer than
  1173.      Computer A's maximum name length.  Make sure each directory name, and
  1174.      the final filename, were truncated properly.
  1175.  
  1176.   m. Type Ctrl-C (or whatever your UNIX interrupt character is) at the prompt.
  1177.      Do you get "^C..." and a new prompt?  If instead, you get a core dump
  1178.      (this shouldn't happen any more) "rm core" and then rebuild with
  1179.      -DNOCCTRAP added to your CFLAGS.  If it did work, then type another
  1180.      Ctrl-C.  If this does the same thing as the first one, then Ctrl-C
  1181.      handling is OK.  Otherwise, the SIGINT signal is either not getting
  1182.      re-armed (shouldn't happen) or is being masked off after the first time
  1183.      it is caught, in which case, if your UNIX is POSIX-based, try rebuilding
  1184.      C-Kermit with -DCK_POSIX_SIG.
  1185.  
  1186.   n. Type Ctrl-Z (or whatever your UNIX suspend character is) to put C-Kermit
  1187.      in the background.  Did it work?  If nothing happened, then (a) your
  1188.      version of UNIX does not support job control, or (b) your version of
  1189.      C-Kermit was probably built with -DNOJC.  If your session became totally
  1190.      frozen, then you are probably running C-Kermit on a UNIX version that
  1191.      supports job control, but under a shell that doesn't.  If that's not the
  1192.      case, look in the congm() and psuspend() routines in ckutio.c and see if
  1193.      you can figure out what's wrong.  If you can't, rebuild with -DNOJC.
  1194.  
  1195.   o. Give a SET LINE command for a dialout device, e.g. "set line /dev/tty00".
  1196.      If you got some kind of permission or access denied message, go read
  1197.      Section 10 and then come back here.
  1198.  
  1199.   p. After giving a successful SET LINE command, type "show comm" to
  1200.      see the communication parameters.  Do they make sense?
  1201.  
  1202.   q. Type "set speed ?" and observe the list of available speeds.  Is it
  1203.        what you expected?  If not, see Section 2 of ckccfg.txt.
  1204.  
  1205.   r. Give a SET SPEED command to change the device's speed.  Did it work?
  1206.        (Type "show comm" again to check.)
  1207.  
  1208.   s. Try dialing out: SET MODEM TYPE <whatever>, SET LINE <whatever>, SET
  1209.      SPEED <whatever>, DIAL <phone-number>.  If it doesn't work, keep
  1210.      reading.  After dialing, can you REDIAL?
  1211.  
  1212.   t. If your version was built with TCP/IP network support, try the TELNET
  1213.      command.
  1214.  
  1215.   u. Transfer some files in remote mode on incoming asynchronous serial
  1216.      (direct or modem) connections, and on incoming network (telnet, rlogin,
  1217.      terminal server) connections.  If you get lots of errors, try different
  1218.      SET FLOW settings on the remote Kermit program.
  1219.  
  1220.   v. Establish a serial connection from C-Kermit to another computer (direct
  1221.      or dialed) and transfer some files.  If you have network support, do the
  1222.      same with a network connection.
  1223.  
  1224.   x. If your version was built with fullscreen file transfer display support,
  1225.      check that it works during local-mode file transfer.  Also, check
  1226.      C-Kermit's operation afterwards: is the echoing funny?  etc etc.  If
  1227.      there are problems, see Section 4.
  1228.  
  1229.   y. If your version was built with script programming language support,
  1230.      TAKE the ckedemo.ksc file to give it a workout.
  1231.  
  1232.   z. Does C-Kermit interlock correctly with UUCP-family programs (cu, tip,
  1233.      uucp, etc)?  If not, read the section DIALING OUT AND COORDINATING WITH
  1234.      UUCP below.
  1235.  
  1236.   A. Modem signals...  Give a SET LINE command to a serial device and then
  1237.      type the SHOW MODEM command.  If it says "Modem signals unavailable in
  1238.      this version of Kermit", then you might want to look at the ttgmdm()
  1239.      routine in ckutio.c and add the needed code -- if indeed your version of
  1240.      UNIX provides a way to get modem signals (some don't; e.g. modem signals
  1241.      are a foreign concept to POSIX, requiring politically incorrect
  1242.      workarounds).
  1243.  
  1244.      If it says "Modem signals unavailable", then it is likely that the API
  1245.      for getting modem signals is provided, but it doesn't actually do
  1246.      anything (e.g. ioctl(ttyfd,TIOCMGET,&x) returns EINVAL).
  1247.  
  1248.      In any case, it still should be able to manipulate the DTR signal.  To
  1249.      test, SET LINE <name-of-dialout-device>, SET MODEM NONE, and HANGUP.
  1250.      The DTR light should go out momentarily.  If it doesn't, see if you can
  1251.      add the needed code for your system to the tthang() routine in ckutio.c.
  1252.  
  1253.      If your version of Kermit has the SET FLOW RTS/CTS command, check to
  1254.      see if it works: give Kermit this command, set your modem for RTS/CTS,
  1255.      transfer some files (using big packet and window sizes) and watch the
  1256.      RTS and CTS lights on the modem.  If they go on and off (and Kermit does
  1257.      not get packet errors), then it works.  If your version of Kermit does
  1258.      not have this command, but your version of UNIX does support hardware
  1259.      flow control, take a look at the tthflow() command in ckutio.c and see
  1260.      if you can add the needed code (see the section on HARDWARE FLOW
  1261.      CONTROL below).
  1262.  
  1263.      (And please send back any added code to the author, so that others can
  1264.      benefit from it and it can be carried forward into future releases.)
  1265.  
  1266.   B. If C-Kermit starts normally and issues its prompt, echoing is normal,
  1267.      etc, but then after returning from a CONNECT session, the prompt no
  1268.      longer appears, try rebuilding with -DCKCONINTB4CB.
  1269.  
  1270.  
  1271. 8. REDUCING THE SIZE OF THE EXECUTABLE PROGRAM IMAGE
  1272.  
  1273.   a. Many of C-Kermit's options and features can be deselected at compile
  1274.      time.  The greatest savings at the least sacrifice in functionality is
  1275.      to disable the logging of debug information by defining NODEBUG during
  1276.      compilation.  See the ckccfg.txt file for further information.
  1277.  
  1278.   b. Use shared libraries rather than static linking.  This is the default
  1279.      on many UNIX systems anyway.  However, executables built for dynamic
  1280.      linking with shared libraries are generally not portable away from the
  1281.      machine they were built on, so this is recommended if the binary is for
  1282.      your use only.
  1283.  
  1284.   c. Most UNIX systems have a "strip" command to remove symbol table
  1285.      information from an executable program image.  "man strip" for further
  1286.      information.  The same effect can be achieved by including "-s" among
  1287.      the link flags when building C-Kermit.
  1288.  
  1289.   d. SCO, Interactive, and some other UNIX versions have an "mcs" command.
  1290.      "mcs -d wermit" can be used to delete the contents of the ".comment"
  1291.      section from the executable program image.
  1292.  
  1293.   e. Many modern optimizers can be instructed to optimize for space rather
  1294.      than execution efficiency.  Check the CFLAGS in the makefile entry,
  1295.      adjust as desired.
  1296.  
  1297.  
  1298. 9. UNIX VERSIONS
  1299.  
  1300. There are several major varieties of UNIX: Bell Laboratories Seventh Edition,
  1301. AT&T System V, Berkeley Standard Distribution (BSD), and POSIX.  Each has
  1302. many, many subvarieties and descendents, and there are also hybrids that
  1303. exhibit symptoms of two or more varieties, plus special quirks of their own.
  1304.  
  1305. Seventh edition versions of C-Kermit include the compile-time option -DV7 in
  1306. the CFLAGS string in the makefile entry.  Various V7-based implementations are
  1307. also supported: -DCOHERENT, -DMINIX, etc.
  1308.  
  1309. AT&T-based versions of UNIX Kermit include the compile-time option -DATTSV
  1310. (standing for AT&T UNIX System V).  This applies to System III and to System V
  1311. up to and including Release 2.  For System V Release 3, the flag -DSVR3 should
  1312. be used instead (which also implies -DATTSV).  This is because the data type
  1313. of signal() and several other functions was changed between SVR2 and SVR3.
  1314. For System V Release 4, include -DSVR4 because of changes in UUCP lockfile
  1315. conventions; this also implies -DSVR3 and -DATTSV.
  1316.  
  1317. For BSD, the flag -BSDxx must be included, where xx is the BSD version
  1318. number, for example BSD4 (for version 4.2 or later, using only 4.2 features),
  1319. -DBSD41 (for BSD 4.1 only), -DBSD43 (for 4.3 or later), -DBSD29 (BSD 2.9
  1320. for DEC PDP-11s).  BSD44 is BSD4.4, which is the basis of FreeBSD,
  1321. NetBSD, OpenBSD, BSDI, and others, and which contains many POSIX features.
  1322.  
  1323. For POSIX, include the flag -DPOSIX.  POSIX defines a whole new set of
  1324. terminal i/o functions that are not found in traditional AT&T or Berkeley
  1325. implementations, and also defines the symbol _POSIX_SOURCE, which is used
  1326. in many system and library header files, mainly to disable non-POSIX features.
  1327.  
  1328. Note (circa 1997): In order to enable serial speeds higher than 38400 bps,
  1329. it is generally necessary to add -DPOSIX (among other things), since the older
  1330. terminal APIs can not accommodate the new speeds -- out o' bits.  But this
  1331. often also means wholesale conversion to POSIX APIs.  In general, just try
  1332. adding -DPOSIX and then see what goes wrong.  Be wary of features
  1333. disappearing: when _POSIX_SOURCE is defined, all sorts of things that were
  1334. perfectly OK before suddenly become politically incorrect -- like reading
  1335. modem signals, doing hardware flow control, etc.  POSIX was evidently not
  1336. designed with serial communication in mind!
  1337.  
  1338. Case in point: In UnixWare 7.0, #define'ing POSIX causes strictness clauses
  1339. in the header files to take effect.  These prevent <sys/time.h> from defining
  1340. the timeval and timezone structs, which are needed for all sorts of things
  1341. (like select()).  Thus, if we want the high serial speeds, we have to
  1342. circumvent the POSIX clauses.
  1343.  
  1344. Similarly in SCO OpenServer R5.0.4 where, again, we must use the POSIX APIs to
  1345. get at serial speeds higher than 38400, but then doing so removes hardware
  1346. flow control -- just when we need it most!  In cases like this, dirty tricks
  1347. are the only recourse (search for SCO_OSR504 in ckutio.c for examples).
  1348.  
  1349. For reasons like this, UNIX implementations tend to be neither pure AT&T nor
  1350. pure BSD nor pure POSIX, but a mixture of two or more of these, with
  1351. "compatibility features" allowing different varieties of programs to be built
  1352. on the same computer.  In general, Kermit tries not to mix & match but to keep
  1353. a consistent repertoire throughout.  However, there are certain UNIX
  1354. implementations that only work when you mix and match.  For example, the
  1355. Silicon Graphics IRIX operating system (prior to version 3.3) is an AT&T UNIX
  1356. but with a BSD file system.  The only way you can build Kermit successfully
  1357. for this configuration is to include -DSVR3 plus the special option -DLONGFN,
  1358. meaning "pretend I was built with -DBSDxx when it's time to compile
  1359. file-related code".  See the "iris" makefile entry.
  1360.  
  1361. 9.1. Standards
  1362.  
  1363. In edits 166-167, C-Kermit was heavily modified to try to keep abreast of new
  1364. standards while still remaining compatible with old versions of C and UNIX.
  1365. There are two new standards of interest: ANSI C (as described in Kernighan and
  1366. Ritchie, "The C Programming Language", Second Edition, Prentice Hall, 1988)
  1367. and POSIX.1 (IEEE Standard 1003.1 and ISO/IEC 9945-1, 1990, "Portable
  1368. Operating System Interface").  These two standards have nothing to do with
  1369. each other: you can build C-Kermit with a non-ANSI compiler for a POSIX
  1370. system, or for a non-POSIX system with with an ANSI compiler.
  1371.  
  1372. 9.1.1. POSIX
  1373.  
  1374. POSIX.1 defines a repertoire of system functions and header files for use by C
  1375. language programs.  Most notably, the ioctl() function is not allowed in
  1376. POSIX; all ioctl() functions have been replaced by device-specific functions
  1377. like tcsetattr(), tcsendbreak(), etc.
  1378.  
  1379. Computer systems that claim some degree of POSIX compliance have made some
  1380. attempt to put their header files in the right places and give them the right
  1381. names, and to provide system library functions with the right names and
  1382. calling conventions.  Within the header files, POSIX-compliant functions are
  1383. supposed to be within #ifdef _POSIX_SOURCE..#endif conditionals, and non-POSIX
  1384. items are not within these conditionals.
  1385.  
  1386. If C-Kermit is built with the -DPOSIX flag, it attempts to configure itself
  1387. for a pure POSIX environment.  It defines _POSIX_SOURCE, it calls only
  1388. POSIX-defined functions, and it includes POSIX-defined header files.
  1389.  
  1390. If Kermit is built with -D_POSIX_SOURCE but not -DPOSIX, C-Kermit must be
  1391. built with one of the -DBSD or -DATTSV flags (or one that implies them), but
  1392. still uses only the POSIX features in the system header files.  This allows
  1393. C-Kermit to be built on BSD or AT&T systems that have some degree of POSIX
  1394. compliance, but still use BSD or AT&T specific features.
  1395.  
  1396. If Kermit is built with neither -D_POSIX_SOURCE nor -DPOSIX, the functions and
  1397. header files of the selected version of UNIX (or VMS, etc) are used according
  1398. to the CFLAGS Kermit was built with.
  1399.  
  1400. The POSIX standard does not define anything about uucp lockfiles.  "make
  1401. posix" uses NO (repeat, NO) lockfile conventions.  If your POSIX-compliant
  1402. UNIX version uses a lockfile convention such as HDBUUCP (see below), use
  1403. the "posix" entry, but include the appropriate lockfile option in your KFLAGS
  1404. on the "make" command line, for example:
  1405.  
  1406.    make posix "KFLAGS=-DHDBUUCP"
  1407.  
  1408. POSIX.1 also lacks certain other features that Kermit needs.  For example:
  1409.  
  1410.  - There is no defined way for an application to do wildcard matching of
  1411.    filenames.  Kermit uses the inode in the directory structure, but POSIX.1
  1412.    does not include this concept.  (Later POSIX revisions include functions
  1413.    named (I think) glob() and fnmatch(), but these functions are not yet in
  1414.    Kermit, and might not be appropriate in any case.)
  1415.  
  1416.  - There is no POSIX mechanism for sensing or controlling modem signals,
  1417.    nor to enable RTS/CTS or other hardware flow control.
  1418.  
  1419.  - There is no select() for multiplexing i/o, and therefore no TCP/IP.
  1420.  
  1421.  - There is no way to check if characters are waiting in a communications
  1422.    device (or console) input buffer, short of trying to read them -- no
  1423.    select(), ioctl(fd,FIONREAD,blah), rdchk(), etc.  This is bad for CONNECT
  1424.    mode and bad for sliding windows.
  1425.  
  1426.  - No way to do a millisecond sleep (no nap(), usleep(), select(), etc).
  1427.  
  1428.  - There is no popen().
  1429.  
  1430. So at this point, there cannot be one single fully functional POSIX form of
  1431. C-Kermit unless it also has "extensions", as do Linux, QNX, etc.
  1432.  
  1433. More on POSIX (quoting from a newsgroup posting by Dave Butenhof
  1434. <butenhof@zko.dec.com>):
  1435.  
  1436. Standards tend to look at themselves as "enabling". So POSIX standards say
  1437. that, in order to use POSIX functions, a program must define some macro that
  1438. will put the development environment in "POSIX mode". For the ancient POSIX
  1439. 1003.1-1990, the symbol is _POSIX_SOURCE. For recent revisions, it's
  1440. _POSIX_C_SOURCE with an appropriate value. POSIX 1003.1-1996 says that, to
  1441. use its features in a portable manner, you must define
  1442. _POSIX_C_SOURCE=199506L before including any header files. Casper's guess --
  1443. and mine -- is that you're doing this.
  1444.  
  1445. But for Solaris, or Digital UNIX, the picture is different. POSIX is one
  1446. important but small part of the universe. Yet POSIX unconditionally and
  1447. unambiguously REQUIRES that, when _POSIX_C_SOURCE=199506L, ALL of the
  1448. functions and definitions required by the standard, and NO others (except in
  1449. specific restricted namespaces, specifically "_" followed by an uppercase
  1450. letter or "__" followed by a lowercase letter) shall be visible. That kinda
  1451. puts a cramp on BSD and SVID support, because those require names that are
  1452. not in the "protected" POSIX namespaces. It's ILLEGAL to make those symbols
  1453. visible, unless you've done something else that's beyond the scope of POSIX
  1454. to allow the system to infer that you didn't really mean it.
  1455.  
  1456. In most cases, you should just compile, with no standards-related macros
  1457. defined. The system will make available every interface and definition that
  1458. isn't incompatible with the "main stream". There may indeed be cases where
  1459. two standards cross, and you really can't use both together. But, in
  1460. general, they play nicely together as long as you don't do anything rash --
  1461. like telling the system that it's not allowed to let them.
  1462.  
  1463. In the area of threads, both Solaris and Digital UNIX support incompatible
  1464. thread APIs. We have POSIX and DCE, they have POSIX and UI. The nasty areas
  1465. are in the _r routines and in some aspects of signal behavior. You cannot
  1466. compile a single source file that uses both semantics. That's life. It
  1467. sounds as if Solaris defaults to the UI variants, but allows you to define
  1468. this _POSIX_THREAD_SEMANTICS to get around it. We default to POSIX, and
  1469. allow you to define _PTHREAD_USE_D4 (automatically defined by the cc
  1470. "-threads" switch) to select the DCE thread variants. That default, because
  1471. you're operating outside of any individual standard, is really just a
  1472. marketing decision.
  1473.  
  1474. (end quote)
  1475.  
  1476. 9.1.2. ANSI C
  1477.  
  1478. The major difference between ANSI C and earlier C compilers is function
  1479. prototyping.  ANSI C allows function arguments to be checked for type
  1480. agreement, and (when possible) type coercion in the event of a mismatch.  For
  1481. this to work, functions and their arguments must be declared before they are
  1482. called.  The form for function declarations is different in ANSI C and
  1483. non-ANSI C (ANSI C also accepts the earlier form, but then does not do type
  1484. checking).
  1485.  
  1486. As of edit 167, C-Kermit tries to take full advantage of ANSI C features,
  1487. especially function prototyping.  This removes many bugs introduced by
  1488. differing data types used or returned by the same functions on different
  1489. computers.  ANSI C features are automatically enabled when the symbol __STDC__
  1490. is defined.  Most ANSI C compilers, such as GNU CC and the new DEC C compiler
  1491. define this symbol internally.
  1492.  
  1493. On the downside, ANSI C compilation increases the administrative/bureacratic
  1494. burden, spewing out countless unneeded warnings about mismatched types,
  1495. especially when we are dealing with signed and unsigned characters, requiring
  1496. casts everywhere to shut up the mindless complaints -- there is no use for
  1497. signed chars in Kermit (or probably anywhere else).  Some compilers,
  1498. mercifully, include a "treat all chars as unsigned" option, and when available
  1499. it should be used -- not only to stop the warnings, but also to avoid unhelpful
  1500. sign extension on high-bit characters.
  1501.  
  1502. To force use of ANSI C prototypes, include -DCK_ANSIC on the cc command line.
  1503. To disable the use of ANSI prototypes, include -DNOANSI.
  1504.  
  1505. 9.1.3. Other Standards
  1506.  
  1507. As the years go by, standards with-which-all-must-comply continue to pile up:
  1508. AES, XPG2, XPG3, XPG4, FIPS 151-2, successive generations of POSIX, OSF/1,
  1509. X/Open, Spec 1170, UNIX95, Open Group UNIX98, Single Unix Spec 98 (or other
  1510. number), ISO/IEC 9945-1, ISO 9899, 88Open, OS 99, not to mention "mature
  1511. standards" like V7, 4.2/4.3BSD, System V R3 and R4 (SVID2 and SVID3), 4.4BSD
  1512. (the basis for BSDI, OpenBSD, NetBSD, FreeBSD, etc), /usr/group, plus assorted
  1513. seismic pronouncements of the neverending series of ephemeral corporate
  1514. consortia, not to mention the libc-vs-glibc turmoil in the Linux arena and who
  1515. knows what else.
  1516.  
  1517. None of these standards simplifies life for portable applications like
  1518. C-Kermit -- each one is simply one more environment to support (or circumvent,
  1519. as in many cases these standards do more harm than good by denying access to
  1520. facilities we need, e.g. as noted in above in 9.1.1).
  1521.  
  1522. 9.2. Library Issues
  1523.  
  1524. On most modern platforms, applications are -- and often must be -- dynamically
  1525. linked.  This has numerous advantages (smaller executables, ability to patch
  1526. a library and thereby patch all applications that use it, etc), but also
  1527. causes some headaches: most commonly, the library ID built into the executable
  1528. at link time does not match the ID of the corresponding library on the target
  1529. system, and so the loader refuses to let the application run.
  1530.  
  1531. This problem only gets worse over time.  In the Linux and *BSD world, we also
  1532. have totally different libraries (each with their own names and numbering
  1533. systems) that cover the same territory; for example, curses vs ncurses, libc
  1534. versus glibc.  Combinations proliferate and any given PC might have any
  1535. combination.  For this reason it is becoming increasingly difficult to produce
  1536. a "Linux binary" for a given architecture (e.g. PC or Alpha).  There has to
  1537. be a separate binary for (at least) every combination of curses vs ncurses
  1538. and libc vs glibc.
  1539.  
  1540. In such cases, the best advice is for every user to build C-Kermit from source
  1541. code on the system where it will run.
  1542.  
  1543. 9.3. UNIX File System Peculiarities
  1544.  
  1545. Normally, including a BSD, System-V, POSIX, or DIRENT flag in the make entry
  1546. selects the right file system code.  But some versions of UNIX are
  1547. inconsistent in this regard, and building in the normal way either gives
  1548. compiler or linker errors, or results in problems at runtime, typically
  1549. failure to properly expand wildcard file specifications when you do something
  1550. like "send *.*", or failure to recognize long filenames, as in "send
  1551. filewithaveryveryveryveryverylongname".
  1552.  
  1553. C-Kermit is supposed to know about all the various styles of UNIX file
  1554. systems, but it has to be told which one to use when you build it, usually in
  1555. the makefile entry CFLAGS as shown below, but you might also have to add
  1556. something like -I/usr/include/bsd to CFLAGS, or something like -lbsd to LIBS.
  1557.  
  1558. C-Kermit gives you the following CFLAGS switches to adapt to your file system's
  1559. peculiarities:
  1560.  
  1561.   -DDIRENT   - #include <dirent.h>
  1562.   -DSDIRENT  - #include <sys/dirent.h>
  1563.   -DNDIR     - #include <ndir.h>
  1564.   -DXNDIR    - #include <sys/ndir.h>
  1565.   -DRTU      - #include "/usr/lib/ndir.h", only if NDIR and XNDIR not defined.
  1566.   -DSYSUTIMH - #include <sys/utime.h> for setting file creation dates.
  1567.   -DUTIMEH   - #include <utime.h> for setting file creation dates.
  1568.  
  1569. (Note, RTU should only be used for Masscomp RTU systems, because it also
  1570. selects certain other RTU-specific features.)
  1571.  
  1572. If none of these is defined, then <sys/dir.h> is used.  IMPORTANT: If your
  1573. system has the file /usr/include/dirent.h then be sure to add -DDIRENT to your
  1574. makefile entry's CFLAGS.  "dirent" should be used in preference to any of the
  1575. others, because it supports all the features of your file system, and the
  1576. others probably don't.
  1577.  
  1578. Having selected the appropriate directory header file, you might also need to
  1579. tell Kermit how to declare the routines and variables it needs to read the
  1580. directory.  This happens most commonly on AT&T System-V based UNIXes,
  1581. particularly System V R3 and earlier, that provide long file and directory
  1582. names (longer than 14 characters).  Examples include certain releases of
  1583. HP-UX, DIAB DNIX, older versions of Silicon Graphics IRIX, and perhaps also
  1584. MIPS.  In this case, try adding -DLONGFN to your makefile entry.
  1585.  
  1586. Another problem child is <sys/file.h>.  Most UNIX C-Kermit versions need to
  1587. #include this file from within ckutio.c and ckufio.c, but some not only do not
  1588. need to include it, but MUST not include it because (a) it doesn't exist, or
  1589. (b) it has already been included by some other header file and it doesn't
  1590. protect itself against multiple inclusion, or (c) some other reason that
  1591. prevents successful compilation.  If you have compilation problems that seem
  1592. to stem from including this file, then add the following switch to CFLAGS in
  1593. your makefile entry:
  1594.  
  1595.   -DNOFILEH
  1596.  
  1597. There are a few odd cases where <sys/file.h> must be included in one of the
  1598. cku[ft]io.c files, but not the other.  In that case, add the aforementioned
  1599. switch, but go into the file that needs <sys/file.h> and add something like
  1600. this:
  1601.  
  1602.   #ifdef XXX       /* (where XXX is a symbol unique to your system) */
  1603.   #undef NOFILEH
  1604.   #endif /* XXX */
  1605.  
  1606. before the section that includes <sys/file.h>.
  1607.  
  1608. Kermit's SEND command expands wildcard characters "?" and "*" itself.  Before
  1609. version 5A, commands like "send *" would send all regular (non-directory)
  1610. files, including "hidden files" (whose names start with ".").  In version 5A,
  1611. the default behavior is to match like the Bourne shell or the ls command, and
  1612. not include files whose names start with dot.  Such files can still be sent if
  1613. the dot is included explicitly in the SEND command: "send .oofa, send .*".  To
  1614. change back to the old way and let leading wildcard characters match dot
  1615. files, include the following in your CFLAGS:
  1616.  
  1617.   -DMATCHDOT
  1618.  
  1619. (In C-Kermit 6.0, there is also a command to control this at runtime.)
  1620.  
  1621. If you get compile-time complaints about data type mismatches for process-ID
  1622. related functions like getpid(), add -DPID_T=pid_t.
  1623.  
  1624. If you get compile-time complaints about data type mismatches for user ID
  1625. related functions like getuid(), add -DUID_T=uid_t.
  1626.  
  1627. If you get compile-time complaints about data type mismatches for user-ID
  1628. related functions like getgid(), add -DGID_T=gid_t.
  1629.  
  1630. If you get compile-time complaints about data type mismatches for getpwuid(),
  1631. add -DPWID_T=uid_t (or whatever it should be).
  1632.  
  1633. File creation dates: C-Kermit attempts to set the creation date/time of an
  1634. incoming file according to the date/time given in the file's attribute
  1635. packet, if any.  If you find that the dates are set incorrectly, you might
  1636. need to build Kermit with the -DSYSUTIMEH flag, to tell it to include
  1637. <sys/utime.h>.  If that doesn't help, look at the code in zstrdt() in
  1638. ckufio.c.
  1639.  
  1640. 9.4. Hardware Flow Control
  1641.  
  1642. Hardware flow control is a problematic concept in many popular UNIX
  1643. implementations.  Often it is lacking altogether, and when available, the
  1644. application program interface (API) to it is inconsistent from system to
  1645. system.  Here are some examples:
  1646.  
  1647.   a. POSIX does not support hardware flow control.
  1648.  
  1649.   b. RTS/CTS flow control support MIGHT be available for System V R3 and
  1650.      later if /usr/include/termiox.h exists (its successful operation also
  1651.      depends on the device driver, and the device itself, not to mention the
  1652.      cable, etc, actually supporting it).  If your SVR3-or-later UNIX system
  1653.      does have this file, add:
  1654.  
  1655.        -DTERMIOX
  1656.  
  1657.      to your CFLAGS.  If the file is in /usr/include/sys instead, add:
  1658.  
  1659.        -DSTERMIOX
  1660.  
  1661.      Note that the presence of this file does not guarantee that RTS/CTS will
  1662.      actually work -- that depends on the device-driver implementation
  1663.      (reportedly, many UNIX versions treat hardware-flow-control related
  1664.      ioctl's as no-ops).
  1665.  
  1666.   c. Search ("grep -i") through /usr/include/*.h and /usr/include/sys/*.h for
  1667.      RTS or CTS and see what turns up.  For example, in SunOS 4.x we find
  1668.      "CRTSCTS".  Figuring out how to use it is another question entirely!  In
  1669.      IBM AIX RS/6000 3.x, we have to "add" a new "line discipline" (and you
  1670.      won't find uppercase RTS or CTS symbols in the header files).
  1671.  
  1672.   d. NeXTSTEP and IRIX, and possibly others, support hardware flow control,
  1673.      but do not furnish an API to control it, and thus on these systems
  1674.      Kermit has no command to select it -- instead, a special device name
  1675.      must be used.  (NeXTSTEP: /dev/cufa instead of /dev/cua; IRIX:
  1676.      /dev/ttyf00)
  1677.  
  1678. See the routine tthflow() in ckutio.c for details.  If you find that your
  1679. system offers hardware flow control selection under program control, you can
  1680. add this capability to C-Kermit as follows:
  1681.  
  1682.   a. See if it agrees with one of the methods already used in tthflow().
  1683.      If not, add new code, appropriately #ifdef'd.
  1684.  
  1685.   b. Add -DCK_RTSCTS to the compiler CFLAGS in your makefile entry or define
  1686.      this symbol within the appropriate #ifdef's in ckcdeb.h.
  1687.  
  1688. To illustrate the difficulties with RTS/CTS, here is a tale from Jamie Watson
  1689. <jw@adasoft.ch>, who added the RTS/CTS code for the RS/6000, about his
  1690. attempts to do the same for DEC ULTRIX:
  1691.  
  1692.    "The number and type of hardware signals available to/from a serial port
  1693.    vary between different machines and different types of serial interfaces on
  1694.    each machine.  This means that, for example, there are virtually no
  1695.    hardware signals in or out available on the DECsystem 3000/3100 series; on
  1696.    the DECsystem 5000/2xx series all modem signals in/out are present on both
  1697.    built-in serial ports; on the DECsystem 5100 some ports have all signals
  1698.    and some only have some; and so on...  It looks to me as if this pretty
  1699.    well rules out any attempt to use hardware flow control on these platforms,
  1700.    even if we could figure out how to do it.  The confusion on the user level
  1701.    about whether or not it should work for any given platform or port would be
  1702.    tremendous.  And then it isn't clear how to use the hardware signals even
  1703.    in the cases where the device supports them."
  1704.  
  1705. 9.5. Terminal Speeds
  1706.  
  1707. The allowable speeds for the SET SPEED command are defined in ckcdeb.h.  If
  1708. your system supports speeds that are not listed in "set speed ?", you can
  1709. add definitions for them to ckcdeb.h.
  1710.  
  1711. Then if the speed you are adding is one that was never used before in Kermit,
  1712. such as 921600, you'll also need to add the appropriate keywords to spdtab[]
  1713. in ckuus3.c, and the corresponding case to ttsspd() in ckutio.c.
  1714.  
  1715. 9.6. Millisecond Sleeps
  1716.  
  1717. There is no standard for millisecond sleeps, but at least five different
  1718. functions have appeared in various UNIX versions that can be used for this
  1719. purpose: nap() (mostly in System V), usleep() (found at least in SunOS and
  1720. NeXT OS), select() (found in 4.2BSD and later, and part of any TCP/IP sockets
  1721. library), nanosleep(), and sginap().  If you have any of these available, pick
  1722. one (in this order of preference, if you have more than one):
  1723.  
  1724.   -DSELECT: Include this in CFLAGS if your system has the select() function.
  1725.   -DNAP:    Include this in CFLAGS if your system has the nap() function.
  1726.   -USLEEP:  Include this in CFLAGS if your system has the usleep() function.
  1727.  
  1728. NOTE: The nap() function is assumed to be a function that puts the process
  1729. to sleep for the given number of milliseconds.  If your system's nap()
  1730. function does something else or uses some other units of time (like the NCR
  1731. Tower 32, which uses clock-ticks), do not include -DNAP.
  1732.  
  1733. Reportedly, all versions of System V R4 for Intel-based computers, and
  1734. possibly also SVR3.2, include nap() as a kernel call, but it's not in the
  1735. library.  To include code to use it via syscall(3112,x), without having to
  1736. include Xenix compatibility features, include the following compile-time
  1737. option:
  1738.  
  1739.   -DNAPHACK
  1740.  
  1741. 9.7. Nondestructive Input Buffer Peeking
  1742.  
  1743. Some AT&T UNIX versions have no way to check if input is waiting on a tty
  1744. device, but this is a very important feature for Kermit.  Without it, sliding
  1745. windows might not work very well (or at all), and you also have to type your
  1746. escape character to get Kermit's attention in order to interrupt a local-mode
  1747. file transfer.  If your system offers an FIONREAD ioctl, the build procedure
  1748. should pick that up automatically and use it, which is ideal.
  1749.  
  1750. If your system lacks FIONREAD but has a select() function, this can be used
  1751. instead.  If the build procedure fails to include it (SHOW FEATURES will
  1752. list SELECT), then you can add it to your CFLAGS:
  1753.  
  1754.   -DSELECT
  1755.  
  1756. Conversely, if the build procedure tries to use select() when it really is
  1757. not there, add:
  1758.  
  1759.   -DNOSELECT
  1760.  
  1761. Note: select() is not part of System V nor of POSIX, but it has been added to
  1762. various System-V- and POSIX-based systems as an extension.
  1763.  
  1764. Some System-V variations (SCO Xenix/UNIX/ODT and DIAB DNIX) include a rdchk()
  1765. function that can be used for buffer peeking.  It returns 0 if no characters
  1766. are waiting and 1 if characters are waiting (but unlike FIONREAD, it does not
  1767. tell the actual number).  If your system has rdchk(), add:
  1768.  
  1769.   -DRDCHK:  Include this in CFLAGS if your system has the rdchk() function.
  1770.  
  1771. Otherwise, if your version of UNIX has the poll() function (and the
  1772. /usr/include/poll.h file) -- which appears to be a standard part of System V
  1773. going back to at least SVR3, include:
  1774.  
  1775.   -DCK_POLL
  1776.  
  1777. 9.8. Other System-Dependent Features
  1778.  
  1779. Systems with <termios.h> might have the symbol IEXTEN defined.  This is used
  1780. to turn "extended features" in the tty device driver on and off, such as
  1781. Ctrl-O to toggle output flushing, Ctrl-V to quote input characters, etc.
  1782.  
  1783. In most UNIX implementations, it should be turned off during Kermit operation,
  1784. so if ckutio.c finds this symbol, it uses it.  This is necessary, at least, on
  1785. BSDI.  On some systems, however, IEXTEN is either misdefined or
  1786. misimplemented.  The symptom is that CR, when typed to the command processor,
  1787. is echoed as LF, rather than CRLF.  This happens (at least) on Convex/OS 9.1.
  1788. The solution is to add the following symbol to the makefile entry's CFLACS:
  1789.  
  1790.   -DNOIEXTEN
  1791.  
  1792. However, in at least one UNIX implementation, QNX 4.21, IEXTEN must be set
  1793. before hardware flow control can be used.
  1794.  
  1795. In edits 177 and earlier, workstation users noticed a "slow screen writing"
  1796. phenomenon during interactive command parsing.  This was traced to a setbuf()
  1797. call in ckutio.c that made console (stdout) writes unbuffered.  This setbuf()
  1798. call has been there forever, and could not be removed without some risk.
  1799. Kermit's operation was tested on the NeXT in edit 178 with the setbuf() call
  1800. removed, and the slow-writing symptom was cured, and everything else (command
  1801. parsing, proper wakeup on ?, ESC, Ctrl-U, and other editing characters,
  1802. terminal emulation, remote-mode and local-mode file transfer, etc) seemed to
  1803. work as well as or better than before.  In subsequent edits, this change was
  1804. made to many other versions too, with no apparent ill effects.  To remove the
  1805. setbuf() call for your version of Kermit, add:
  1806.  
  1807.   -DNOSETBUF
  1808.  
  1809. Later reports indicate that adding -DNOSETBUF has other beneficial effects,
  1810. like cutting down on swapping when Kermit is run on workstations with small
  1811. memories.  But BEWARE: on certain small UNIX systems, notably the AT&T 6300
  1812. and 3B1 (the very same ones that benefit from NOSETBUF), NOSETBUF seems to
  1813. conflict with CK_CURSES.  The program builds and runs OK, but after once using
  1814. the curses display, echoing is messed up.  In this case, we use a System-V
  1815. specific variation in the curses code, using newterm() to prevent System V
  1816. from altering the buffering.  See makefile entries for AT&T 6300 and 3B1.
  1817.  
  1818. The UNIX version of C-Kermit includes code to switch to file descriptor zero
  1819. (stdin) for remote-mode file transfer.  This code is necessary to prevent
  1820. Kermit from giving the impression that it is "idle" during file transfers,
  1821. which, at some sites, can result in the job being logged out in the middle of
  1822. an active file transfer by idle-job monitors.
  1823.  
  1824. However, this feature can interfere with certain setups; for example, there is
  1825. a package which substitutes a pty/tty pair for /dev/tty and sets file
  1826. descriptor 0 to be read-only, preventing Kermit from sending packets.  Or...
  1827. When a UNIX shell is invoked under the PICK environment, file descriptor 0
  1828. is inoperative.
  1829.  
  1830. To remove this feature and allow Kermit to work in such environments, add the
  1831. compile-time option:
  1832.  
  1833.   -DNOFDZERO
  1834.  
  1835. On some versions of UNIX, earlier releases of C-Kermit were reported to render
  1836. a tty device unusable after a hangup operation.  Examples include IBM AIX on
  1837. the RT PC and RS/6000.  A typical symptom of this phenomenon is that the DIAL
  1838. command doesn't work, but CONNECTing to the device and dialing manually do
  1839. work.  A further test is to SET DIAL HANGUP OFF, which should make dialing
  1840. work once by skipping the pre-dial hangup.  However, after the connection is
  1841. broken, it can't be used any more: subsequent attempts to DIAL the same device
  1842. don't work.  The cure is usually to close and reopen the device as part of the
  1843. hangup operation.  To do this, include the following compile-time option:
  1844.  
  1845.   -DCLSOPN
  1846.  
  1847. Similarly, there is a section of code in ttopen(), which does another
  1848. close(open()) to force the O_NDELAY mode change.  On some systems, the
  1849. close(open()) is required to make the mode change take effect, and apparently
  1850. on most others it does no harm.  But reportedly on at least one System V R4
  1851. implementation, and on SCO Xenix 3.2, the close(open()) operation hangs
  1852. if the device lacks carrier, EVEN THOUGH the CLOCAL characteristic has just
  1853. been set to avoid this very problem.  If this happens to you, add this to
  1854. your CFLAGS:
  1855.  
  1856.   -DNOCOTFMC
  1857.  
  1858. or, equivalently, in your KFLAGS on the make command line.  It stands for
  1859. NO Close(Open()) To Force Mode Change.
  1860.  
  1861. C-Kermit renames files when you give a RENAME command and also according to
  1862. the current SET FILE COLLISION option when receiving files.  The normal UNIX
  1863. way to rename a file is via two system calls: link() and unlink().  But
  1864. this leaves open a window of vulnerability.  Some UNIX systems also offer an
  1865. atomic rename(oldname,newname) function.  If your version of UNIX has this
  1866. function, add the following to your CFLAGS:
  1867.  
  1868.   -DRENAME
  1869.  
  1870. C-Kermit predefines the RENAME for several UNIX versions in ckcdeb.h (SVR4,
  1871. SUNOS41, BSD44, AIXRS, etc).  You can tell if rename() is being used if the
  1872. SHOW FEATURES command includes RENAME in the compiler options list.  If the
  1873. predefined RENAME symbol causes trouble, then add NORENAME to your CFLAGS.
  1874. Trouble includes:
  1875.  
  1876.   a. Linker complains that _rename is an unresolved symbol.
  1877.  
  1878.   b. Linking works, but Kermit's RENAME command doesn't work (which happens
  1879.      because older versions of rename() might have their arguments reversed).
  1880.  
  1881. If rename() is not used, then Kermit uses link()/unlink(), which is equivalent
  1882. except it is not atomic: there is a tiny interval in which some other process
  1883. might "do something" to one of the files or links.
  1884.  
  1885. Some UNIX systems (Olivetti X/OS, Amdahl UTS/V, ICL SVR3, etc) define the
  1886. S_ISREG and S_ISDIR macros incorrectly.  This is compensated for automatically
  1887. in ckufio.c.  Other systems might have this same problem.  If you get a
  1888. compile-time error message regarding S_ISREG and/or S_ISDIR, add the following
  1889. to your CFLAGS:
  1890.  
  1891.   -DISDIRBUG
  1892.  
  1893. Finally, here's a symbol you should NEVER define:
  1894.  
  1895.   -DCOMMENT
  1896.  
  1897. It's used for commenting out blocks of code.  If for some reason you find
  1898. that your compiler has COMMENT defined, then add -UCOMMENT to CFLAGS or KFLAGS!
  1899. Similarly, some header files have been known to define COMMENT, in which case
  1900. you must add "#undef COMMENT" to each C-Kermit source module, after all the
  1901. #includes.
  1902.  
  1903. 9.9. Terminal Interruption
  1904.  
  1905. When C-Kermit enters interactive command mode, it sets a Control-C (terminal
  1906. keyboard interrupt = SIGINT) trap to allow it to return to the command prompt
  1907. whenever the user types Control-C (or whatever is assigned to be the interrupt
  1908. character).  This is implemented using setjmp() and longjmp().  On some
  1909. systems, depending on the machine architecture and C compiler and who knows
  1910. what else, you might get "Memory fault (coredump)" or "longjmp botch" instead
  1911. of the desired effect (this should not happen in 5A(190) and later).  In that
  1912. case, add -DNOCCTRAP to your CFLAGS and rebuild the program.
  1913.  
  1914. Job control -- the ability to "suspend" C-Kermit on a UNIX system by typing
  1915. the "susp" character (normally Ctrl-Z) and then resume execution later (with
  1916. the "fg" command) -- is a tricky business.  C-Kermit must trap suspend signals
  1917. so it can put the terminal back into normal mode when you suspend it (Kermit
  1918. puts the terminal into various strange modes during interactive command
  1919. parsing, CONNECT, and file transfer).  Supporting code is compiled into
  1920. C-Kermit automatically if <signal.h> includes a definition for the SIGTSTP
  1921. signal.  HOWEVER... some systems define this signal without supporting
  1922. job control correctly.  You can build Kermit to ignore SIGTSTP signals by
  1923. including the -DNOJC option in CFLAGS.  (You can also do this at runtime by
  1924. giving the command SET SUSPEND OFF.)
  1925.  
  1926.   NOTE: As of version 5A(190), C-Kermit makes another safety check.
  1927.   Even if job control is available in the operating system (according to
  1928.   the numerous checks made in congm()), it will still disable the catching
  1929.   of SIGTSTP signals if SIGTSTP was set to SIG_IGN at the time C-Kermit
  1930.   was started.
  1931.  
  1932. System V R3 and earlier systems normally do not support job control.  If you
  1933. have an SVR3 system that does, include the following option in your CFLAGS:
  1934.  
  1935.   -DSVR3JC
  1936.  
  1937. On systems that correctly implement POSIX signal handling, signals can be
  1938. handled more reliably than in Bell, Berkeley, or AT&T UNIXes.  On systems
  1939. (such as QNX) that are "strictly POSIX", POSIX signal handling *must* be used,
  1940. otherwise no signal will work more than once.  If you have POSIX-based system
  1941. and you find that your version of Kermit responds to Ctrl-C (SIGINT) or Ctrl-Z
  1942. (SIGTSTP) only once, then you should add the following option to your CFLAGS:
  1943.  
  1944.   -DCK_POSIX_SIG
  1945.  
  1946. But be careful; some POSIX implementations, notably 4.4BSD, include POSIX
  1947. signal handling symbols and functions as "stubs" only, which do nothing.  Look
  1948. in <signal.h> for sigsetjmp and siglongjmp and read the comments.
  1949.  
  1950. 10. DIALING OUT AND COORDINATING WITH UUCP
  1951.  
  1952. The short version:
  1953.  
  1954.   In order for C-Kermit to be able to dial out from your UNIX computer,
  1955.   you need to give it the same owner, group, and permissions as your
  1956.   other dialout programs, such as cu, tip, minicom, uucp, seyon, etc.
  1957.  
  1958. The long version:
  1959.  
  1960. Make sure your dialout line is correctly configured for dialing out (as
  1961. opposed to login).  The method for doing this is different for each kind of
  1962. UNIX.  Consult your system documentation for configuring lines for dialing out
  1963. (for example, Sun SPARCstation IPC users should read the section "Setting up
  1964. Modem Software" in the Desktop SPARC Sun System & Network Manager's Guide, or
  1965. the Terminals and Modems section of the HP manual, "Configuring HP-UX for
  1966. Peripherals" (e.g. /usr/sbin/sam => Peripheral Devices => Terminals and Modems
  1967. => Add Modem).
  1968.  
  1969. Unlike other operating systems, UNIX allows multiple users to access the same
  1970. serial device at the same time, even though there is no earthly reason why two
  1971. users should do this.  When they do, user A will read some of the incoming
  1972. characters, and user B will read the others.  In all likelihood, neither user
  1973. will see them all.  Furthermore, User B can hang up User A's call, etc.
  1974.  
  1975. Rather than change UNIX to enforce exclusive access to serial devices such as
  1976. ttys, UNIX developers chose instead to use a "lock file".  Any process that
  1977. wants to open a tty device should first check to see if a file of a certain
  1978. name exists, and if so, not to open the device.  If the file does not exist,
  1979. the process creates the file and then opens the device.  When the process
  1980. closes the device, it destroys the lockfile.  This procedure was originated
  1981. for use with UNIX's UUCP, CU, and TIP programs, and so these lockfiles are
  1982. commonly called "UUCP lockfiles" (UUCP = UNIX-to-UNIX Copy Program).
  1983.  
  1984. As you can imagine, this method is riddled with pitfalls:
  1985.  
  1986.   - If a process does not observe the prevailing lockfile convention,
  1987.     then it can interfere with other "polite" processes.  And in fact,
  1988.     very few UNIX applications or commands handle lockfiles at all; an
  1989.     original design goal of UNIX was that "everything is a file", and
  1990.     countless utilities operate on files directly (by opening them) or
  1991.     indirectly through redirection of standard i/o, without creating or
  1992.     looking for lockfiles.
  1993.  
  1994.   - If a process crashes while it has the device open, the lockfile is
  1995.     left behind, preventing further processes from using the device.
  1996.  
  1997.   - Various versions of UNIX use different names for the lockfiles, put
  1998.     them in different directories, with different owners and groups and
  1999.     permissions, and specify their contents differently.
  2000.  
  2001.   - On a given platform, the lockfile conventions may change from one UNIX
  2002.     release to the next (for example, SunOS 4.0 to 4.1) or, in the case of
  2003.     Linux, across different distributions.
  2004.  
  2005.   - The same tty device might have more than one name, and most lockfile
  2006.     conventions don't allow for this.  Similarly for symbolic links.
  2007.  
  2008. In an attempt to address the problem of "stale" lockfiles, most UUCP
  2009. implementations put the PID (Process ID) of the creating process in the
  2010. lockfile.  Thus, another process that wants to open the corresponding device
  2011. can check not only for the lockfile itself, but also can check the PID for
  2012. validity.  But this doesn't work well either:
  2013.  
  2014.   - PIDs are stored in diverse formats that change with every new release
  2015.     (short, integer, long, or string in any of various formats).  If the
  2016.     reading program does not follow the same convention as the writing
  2017.     program, it can diagnose a valid PID to be invalid, and therefore not
  2018.     honor the lock.
  2019.  
  2020.   - PIDs recycle.  If the lockfile was created by PID 1234, which later
  2021.     crashed without removing the lockfile, and then a new process 1234 exists
  2022.     a the time the lockfile is checked, the lockfile will be improperly taken
  2023.     as valid, and access to the device denied unnecessarily.
  2024.  
  2025. Several techniques address the problem of multiple names for the same device:
  2026.  
  2027.   - Multiple lockfiles.  For example, if the user opens a device through a
  2028.     symlink, a lockfile is created for both the symlink name and the true
  2029.     name (obtained from readlink()).  However, when multiple drivers are
  2030.     installed for the same device (e.g. /dev/cua, /dev/cufa, etc), this
  2031.     approach won't work unless all applications *know* all the different
  2032.     names for the same device and make lockfiles for all of them, which is
  2033.     obviously not practical.
  2034.  
  2035.   - Lockfiles whose names are not based on the device name.  These
  2036.     lockfiles generally have names like LK.inode/major/minor, where
  2037.     inode, major, and minor are numbers, which will always be the same for
  2038.     any physical device, no matter what its name.  This form of lockfile is
  2039.     used in System V R4 and its derivatives, such as Solaris, UnixWare,
  2040.     etc.  If lockfiles must be used (as opposed to, say, kernel-based
  2041.     locks), this would seem to be the most effective form.
  2042.  
  2043. Most versions of UNIX were not designed to accommodate third-party
  2044. communications software; thus vendors of these UNIX products feel no
  2045. compunction about changing lockfile conventions from release to release, since
  2046. they also change their versions of the cu, uucp, tip, etc, programs at the
  2047. same time to match.  And since the source code to these programs is not
  2048. published, it is difficult for makers of third-party products (like C-Kermit)
  2049. to find out what the new conventions are.  It also forces release of new
  2050. versions of C-Kermit whenever the OS vendor makes a change like this.
  2051.  
  2052. Some UNIX vendors have taken a small step to simplify communications
  2053. application development for their products: the inclusion of lockfile routines
  2054. in the standard system C runtime libraries to shield the application from the
  2055. details of lockfile management (IBM AIX is an example).  When such routines
  2056. are used, communications applications do not need modification when lockfile
  2057. conventions change (although they will need recompiling if the routines are
  2058. statically linked into the application).  In the AIX example, the simple
  2059. function calls ttylock(), ttyunlock(), and ttylocked() replace hundreds of
  2060. lines of ugly code in C-Kermit that attempts to keep pace with every release
  2061. of every UNIX product over the last 20 years.  Inclusion of ttylock() code
  2062. occurs when:
  2063.  
  2064.   -DUSETTYLOCK
  2065.  
  2066. is included in the CFLAGS.
  2067.  
  2068. If such routines are available, they should be used.  The rest of this section
  2069. applies when they are not.
  2070.  
  2071. To fit in with UUCP and other UNIX-based communication software, C-Kermit must
  2072. have the same idea as your system's uucp, cu, and tip programs about what the
  2073. UUCP lock directory is called, what the lockfile itself is called, and what
  2074. its contents should be.  In most cases, C-Kermit preprocessor flags create the
  2075. appropriate configuration at compile time if the appropriate makefile target
  2076. was used (see ckutio.c).  The following CFLAGS options can be used to override
  2077. the built-in configuration:
  2078.  
  2079.   -DLCKDIR:   Tells Kermit that the UUCP lock directory is /usr/spool/uucp/LCK.
  2080.  
  2081.   -DACUCNTRL: Tells Kermit to use the BSD 4.3 acucntrl() program to turn
  2082.               off getty (login) on the line before using it, and restore
  2083.               getty when done.
  2084.  
  2085.   -DHDBUUCP:  Include this if your system uses Honey DanBer UUCP, in which
  2086.               the lockfile directory and format are relatively standardized.
  2087.  
  2088.   -DLOCK_DIR=\\\"/xxx/yyy\\\": Gives the lock directory name explicitly.
  2089.               The triple quoting is necessary.  For example:
  2090.               "CFLAGS= -DBSD4 -DLOCK_DIR=\\\"/usr/local/locks\\\" -DNODEBUG"
  2091.               (NOTE: The triple quoting assumes this is a "top-level" make
  2092.               entry, and not a make entry that calls another one.)
  2093.  
  2094.   -DLFDEVNO   The lockfile name uses the tty device inode and major and minor
  2095.               numbers: LK.dev.maj.min, as in Sys V R4, e.g. LK.035.044.008.
  2096.  
  2097. When the LK.inode.major.minor form is used, a single lockfile is enough.
  2098. Otherwise, a single lockfile rarely suffices.  For example, in Linux, it is
  2099. common to have a /dev/modem symbolic link to an actual dialout device, like
  2100. /dev/cua0 or /dev/ttyS0, whose purpose is to hide the details of the actual
  2101. driver from the user.  So if one user opens /dev/modem, a lockfile called
  2102. LCK..modem is created, which does not prevent another user from
  2103. simulataneously opening the same device by its real name.
  2104.  
  2105. On SCO UNIX platforms, we have a slightly different problem: the same device
  2106. is, by convention, known by "lowercase" and "uppercase" names, depending on
  2107. whether it has modem control.  So by convention, communications programs are
  2108. supposed to create the lockfiles based on the lowercase name.  But some
  2109. programs don't follow this convention.  In HP-UX, we have several different
  2110. names for each serial device.  And so on.
  2111.  
  2112. For this reason, on platforms where the LK.inode.major.minor form is not used,
  2113. C-Kermit also creates a secondary lockfile (which is simply a link to the
  2114. first) if:
  2115.  
  2116.   a. The given device name is a symbolic link.  The secondary link is based
  2117.      on the device's real name.
  2118.  
  2119.   b. On SCO: The device name is not a symbolic link, but it contains uppercase
  2120.      letters.  The primary link is based on the lowercase name; the secondary
  2121.      link is based on the name that was given.
  2122.  
  2123.   c. On HP-UX: The device name starts with "cu".  The primary link is based on
  2124.      the name that was given; the secondary link is based on the corresponding
  2125.      "ttyd" device, e.g. "LCK..cua0p0" and "LCK..ttyd0p0".
  2126.  
  2127. NOTE: symlinks are not handled in HP-UX.
  2128.  
  2129. Honey DanBer (HDB) UUCP, which is becoming increasingly popular, has two
  2130. characteristics:
  2131.  
  2132.    a. Lockfiles are kept in /usr/spool/locks/ (usually).
  2133.  
  2134.    b. A lockfile contains the process id (pid) in ASCII, rather than as an int.
  2135.  
  2136. Non-HDB selections assume the lockfile contains the pid in int form (or,
  2137. more precisely, in PID_T form, where PID_T is either int or pid_t, depending
  2138. on your system's C library and header files).  (b), by the way, is subject
  2139. to interpretation: the numeric ASCII string may or may not be terminated by
  2140. a newline, it may or may not have leading spaces (or zeros), and the number
  2141. of leading spaces or zeros can differ, and the differences can be significant.
  2142.  
  2143. Even if you build the program with the right lockfile option, you can still
  2144. have problems when you try to open the device.  Here are the error messages
  2145. you can get from SET LINE, and what they mean:
  2146.  
  2147.    a. "Timed out, no carrier."  This one is not related to lockfiles.  It
  2148.       means that you have SET CARRIER ON xx, where xx is the number of seconds
  2149.       to wait for carrier, and carrier did not appear within xx seconds.
  2150.       Solution: SET CARRIER AUTO or OFF.
  2151.  
  2152.    b. "Sorry, access to lock denied."  Kermit has been configured to use
  2153.       lockfiles, but (a) the lockfile directory is write-protected against
  2154.       you, or (b) it does not exist.  The "access to lock denied" message will
  2155.       tell you the reason.  If the directory does not exist, check to make
  2156.       sure Kermit is using the right name.  Just because version "n" of your
  2157.       UNIX used a certain lockfile directory is no gurantee that version n.1
  2158.       does not use a different one.  Workaround: ask the system administrator
  2159.       to install a symbolic link from the old name to the new name.  Other
  2160.       solutions: (see below)
  2161.  
  2162.    c. "Sorry, access to tty device denied."  The tty device that you specified
  2163.       in your SET LINE command is read/write protected against you.
  2164.       Solution: (see below)
  2165.  
  2166.    d. "Sorry, device is in use."  The tty device you have specified is
  2167.       currently being used by another user.  A prefatory message gives you
  2168.       an "ls -l" listing of the lockfile, which should show the username of
  2169.       the person who created it, plus a message "pid = nnn" to show you the
  2170.       process id of the user's program.  Solutions: try another device,
  2171.       wait until the other user is finished, ask the other user to hurry up,
  2172.       or ask the system manager for help.
  2173.  
  2174.    e. "Sorry, can't open connection: <reason>".  The device cannot be opened
  2175.       for some other reason, which is listed.
  2176.  
  2177.    f. "sh: /usr/lib/uucp/acucntrl: not found".  This means your Kermit program
  2178.       was built with the -DACUCNTRL switch, but your computer system does not
  2179.       have the BSD 4.3 acucntrl program.  Solution: install the acucntrl
  2180.       program if you have it, or rebuild Kermit without the -DACUCNTRL switch.
  2181.  
  2182. There are two solutions for problems (b) and (c), both of which involve
  2183. intervention by your UNIX system administrator (superuser):
  2184.  
  2185.    a. Have the superuser change the permission of the lockfile directory and
  2186.       to the tty devices so that everyone on the system has read/write
  2187.       permission.
  2188.  
  2189.         su% chmod 777 /usr/spool/locks (or whatever the path is)
  2190.         su% chmod 666 /dev/ttyXX
  2191.  
  2192.       One risk here is that people can write lots of junk into the lockfile
  2193.       directory, delete other people's files in the lockfile directory, and
  2194.       intercept other people's data as it goes in and out of the tty device.
  2195.       The major danger here would be intercepting a privileged password.  Of
  2196.       course, any user could write a short, ordinary, unprivileged program to
  2197.       do exactly the same thing if the tty device was world read/writeable.
  2198.       The other risk as that telephone calls are not controlled -- anybody on
  2199.       your system can make them, without having to belong to any particular
  2200.       group, and this could run up your phone bill.
  2201.  
  2202.    b. Have the superuser change Kermit to run setuid and/or setgid to the
  2203.       owner and/or group of the lockfile directory and the tty devices if
  2204.       necessary), typically uucp (see next section), but NOT root.  Example:
  2205.  
  2206.     su% chown uucp kermit          - or -  chgrp uucp kermit
  2207.     su% chmod u+s kermit (setuid)  - or -  chmod g+s kermit (setgid)
  2208.  
  2209.       and then make sure the lockfile directory, and the tty devices, have
  2210.       owner (setuid) and/or group (setgid) write permission.  For example:
  2211.  
  2212.         su% chmod o+rwx /usr/spool/uucp
  2213.         su% chown uucp /dev/ttyXX ; chmod 600 /dev/ttyXX
  2214.  
  2215.       In some cases, the owner and group must be distinct; the key point is
  2216.       that read/write access is required to both the UUCP lockfile directory
  2217.       and the tty itself.
  2218.  
  2219. If you make C-Kermit setuid or setgid to root, it refuses to run:
  2220.  
  2221.   Fatal: C-Kermit setuid to root!
  2222.  
  2223. Example:
  2224.  
  2225.   crw-r-----   1 uucp     uucp       5,  67 Feb 11 06:23 /dev/cua3
  2226.   drwxrwxr-x   3 root     uucp         1024 Feb 11 06:22 /var/lock
  2227.  
  2228. requires suid uucp to get read/write access on /dev/cua3 and sgid to get
  2229. read/write access on /var/lock (since you can't set Kermit's uid or gid to
  2230. root).
  2231.  
  2232. For the lockfile mechanism to achieve its desired purpose -- prevention of
  2233. access to the same tty device by more than one process at a time -- ALL
  2234. programs on a given computer that open, read or write, and close tty devices
  2235. must use the SAME lockfile conventions.  Unfortunately, this is often not the
  2236. case.  Here is a typical example of how this can go wrong: In SunOS 4.0 and
  2237. earler, the lockfile directory was /usr/spool/uucp; in 4.1 it was changed to
  2238. /var/spool/locks in the quest for political correctness.  Consequently, any
  2239. third-party programs (such as C-Kermit) that were not modified to account for
  2240. this change, recompiled, and reinstalled, did not use the same lockfiles as
  2241. uucp, tip, etc, and so the entire purpose of the lockfile is defeated.
  2242.  
  2243. What if your UNIX system does not have UUCP installed?  For example, you have
  2244. a UNIX workstation, and you do not use uucp, cu, or tip, or UUCP was not even
  2245. supplied with your version of UNIX (QNX is an example).  In this case, you
  2246. have two choices:
  2247.  
  2248.    a. If there may be more than one person running Kermit at the same time,
  2249.       competing for the same tty device, then create a special lockfile
  2250.       directory just for Kermit, for example, /usr/spool/kermit, and make sure
  2251.       you have read/write access to it.  Then add the following to your
  2252.       makefile entry CFLAGS, as shown earlier:
  2253.  
  2254.            -DLOCK_DIR=\\\"/usr/spool/kermit\\\"
  2255.  
  2256.    b. If you are the only user on your workstation, and no other processes will
  2257.       ever be competing with Kermit for the dialout tty device, then add
  2258.       -DNOUUCP to your makefile entry's CFLAGS and rebuild Kermit.
  2259.  
  2260. 11. RUNNING UNIX C-KERMIT SETUID OR SETGID
  2261.  
  2262. Even if you don't intend to run C-Kermit setuid, somebody else might come
  2263. along and chown and chmod it after it has been built.  You should be sure that
  2264. it is built correctly to run setuid on your system.  For POSIX and AT&T UNIX
  2265. based versions, you don't have to do anything special.
  2266.  
  2267. For 4.2 and 4.3 BSD-based UNIX versions, you normally need not add anything
  2268. special to the makefile.  The program assumes that the setreuid() and
  2269. setregid() functions are available, without which we cannot switch back &
  2270. forth between real & effective uids.  If "make" complains that _setreuid or
  2271. _setregid is/are not defined, add -DNOSETREU to CFLAGS.  In this case it is
  2272. very likely (but not certain) that you cannot protect ttys and lockfiles
  2273. against people and have them run Kermit setuid.
  2274.  
  2275. If make does not complain about this, you should find out whether your BSD
  2276. version (4.3 or other systems like SunOS 4.x that claim to include BSD 4.3
  2277. compatibility) includes the saved-setuid feature (see long notes under edit
  2278. 146 in ckc178.upd).  If it does, then add -DSAVEDUID to CFLAGS.
  2279.  
  2280.   IMPORTANT NOTE: Most UNIX system documentation will not give you the
  2281.   required information.  To determine whether your UNIX system supplies the
  2282.   the saved-original-effective-user/group-id feature, use the ckuuid.c
  2283.   program.  Read and follow the instructions in the comments at the beginning.
  2284.  
  2285. C-Kermit for 4.4BSD-based systems automatically use sete[ug]id().  See
  2286. ckutio.c.
  2287.  
  2288. If you have a version of UNIX that is not BSD-based, but which supplies the
  2289. setreuid() and setregid() functions, and these are the only way to switch
  2290. between real and effective uid, add -DSETREUID to your makefile entry.
  2291.  
  2292.   WARNING: There are two calls to access() in ckufio.c, by which Kermit checks
  2293.   to see if it can create an output file.  These calls will not work correctly
  2294.   when (a) you have installed C-Kermit setuid or setgid on a BSD-based UNIX
  2295.   system, and (b) the saved-original-effective-uid/gid feature is not present,
  2296.   and (c) the access() function always checks what it believes to be the real
  2297.   ID rather than the effective ID.  This is the case, for example, in Olivetti
  2298.   X/OS and in NeXTSTEP.  In such cases, you can force correct operation of
  2299.   access() calls by defining the symbol SW_ACC_ID at compile time in CFLAGS.
  2300.  
  2301. If you have a version of UNIX that does not allow a process to switch back and
  2302. forth between its effective and real user and group ids multiple times, you
  2303. probably should not attempt to run Kermit setuid, because once having given up
  2304. its effective uid or gid (which it must do in order to transfer files, fork a
  2305. shell, etc) it can never get it back, and so it can not use the original
  2306. effective uid or gid to create or delete uucp lockfiles.  In this case, you'll
  2307. either have to set the permissions on your lockfile directory to make them
  2308. publicly read/writable, or dispense with locking altogether.
  2309.  
  2310. MORAL: Are you thoroughly sickened and/or frightened by all that you have just
  2311. read?  You should be.  What is the real answer?  Simple.  Serial devices --
  2312. such as ttys and magnetic tapes -- in UNIX should be opened with exclusive
  2313. access only, enforced by the UNIX kernel.  Shared access has no conceivable
  2314. purpose, legitimate or otherwise, except by privileged system programs such as
  2315. getty.  The original design dates from the late 1960s, when UNIX was developed
  2316. for laboratory use under a philosophy of trust by people within shouting
  2317. distance of each other -- but even then, no useful purpose was served by this
  2318. particular form of openness; it was probably more of a political statement.
  2319. Since the emergence of UNIX from the laboratory into the commercial market, we
  2320. have seen every vestige of openness -- but this one -- stripped away.  I'd
  2321. like to see some influential UNIX maker take the bold step of making the
  2322. simple kernel change required to enforce exclusive access of serial devices.
  2323. (Well, perhaps not so simple when bidirectionality must also be a goal -- but
  2324. then other OS's like VMS solved this problem 20 years ago.)
  2325.  
  2326. 12. CONFIGURING UNIX WORKSTATIONS
  2327.  
  2328. On desktop workstations that are used by only the user at the console
  2329. keyboard, C-Kermit is always used in local mode.  But as delivered, C-Kermit
  2330. runs in remote mode by default.  To put it in local mode at startup, you can
  2331. put a SET LINE command in your .kermrc.
  2332.  
  2333. You can also build C-Kermit to start up in local mode by default.  To do this,
  2334. include the following in the CFLAGS in your makefile entry:
  2335.  
  2336. -DDFTTY=\\\"/dev/ttyxx\\\"
  2337.  
  2338. where ttyxx is the name of the device you will be using for communications.
  2339. Presently there is no way of setting the default modem type at compile time,
  2340. so use this option only for direct lines.
  2341.  
  2342. C-Kermit does not work well on certain workstations if it is not run from
  2343. within a terminal window.  For example, you cannot start C-Kermit on a NeXT by
  2344. launching it directly from NeXTstep.  Similarly for Sun workstations in the
  2345. Open Windows environment.  Run Kermit in a terminal window.
  2346.  
  2347. 13. BIZARRE BEHAVIOR AT RUNTIME
  2348.  
  2349. See the beware file, ckubwr.txt, for hints about runtime misbehavior.
  2350. This section lists some runtime problems that can be cured by rebuilding
  2351. C-Kermit.
  2352.  
  2353. The program starts, but there is no prompt, and certain operations don't work
  2354. (you see error messages like "Kermit command error in background execution").
  2355. This is because Kermit thinks it is running in the background.  See conbgt()
  2356. in ckutio.c.  Try rebuilding Kermit with:
  2357.  
  2358.  -DPID_T=pid_t
  2359.  
  2360. added to your CFLAGS.  If that doesn't help, find out the actual data type
  2361. for pids (look in types.h or similar file) and use it in place of "pid_t",
  2362. for example:
  2363.  
  2364.  -DPID_T=short
  2365.  
  2366. Unexplainable and inappropriate error messages ("Sockets not supported on this
  2367. device", etc) have been traced in at least one case to a lack of agreement
  2368. between the system header files and the actual kernel.  This happened because
  2369. the GNU C compiler (gcc) was being used.  gcc wants to have ANSI-C-compliant
  2370. header files, and so part of the installation procedure for gcc is to run a
  2371. shell script called "fixincludes", which translates the system's header files
  2372. into a separate set of headers that gcc likes.  So far so good.  Later, a new
  2373. version of the operating system is installed and nobody remembers to run
  2374. fixincludes again.  From that point, any program compiled with gcc that makes
  2375. use of header files (particularly ioctl.h) is very likely to misbehave.
  2376. Solution: run fixincludes again, or use your system's regular C compiler,
  2377. libraries, and header files instead of gcc.
  2378.  
  2379. 14. CRASHES AND CORE DUMPS
  2380.  
  2381. If C-Kermit constitently dumps core at the beginning of a file transfer,
  2382. look in SHOW FEATURES for CKREALPATH.  If found, rebuild with -DNOREALPATH
  2383. and see if that fixes the problem (some UNIXes have realpath() but it doesn't
  2384. work).
  2385.  
  2386. Total failure of the Kermit program can occur because of bad memory
  2387. references, bad system calls, or problems with dynamic memory allocation.
  2388. First, try to reproduce the problem with debugging turned on: run Kermit with
  2389. the -d command-line option (for example, "wermit -d") and then examine the
  2390. resulting debug.log file.  The last entry should be in the vicinity of the
  2391. crash.  In VMS, a crash automatically produces a "stack dump" which shows the
  2392. routine where the crash occurs.  In some versions of UNIX, you can get a stack
  2393. dump with "adb" -- just type "adb wermit core" and then give the command "$c",
  2394. then Ctrl-D to quit (note: replace "wermit" by "kermit" or by the full
  2395. pathname of the executable that crashed if it is not in the current
  2396. directory).  Or use gdb to get a backtrace, etc.
  2397.  
  2398. In edit 186, one implementation, UNISYS 5000/95 built with "make sys5r3", has
  2399. been reported to run out of memory very quickly (e.g. while executing a short
  2400. initialization file that contains a SET DIAL DIRECTORY command).  Debug logs
  2401. show that malloc calls are failing, reason unknown.  For this and any other
  2402. implementation that gives error messages about "malloc failure" or "memory
  2403. allocation failure", rebuild the program *without* the -DDYNAMIC CFLAGS
  2404. definition, for example:
  2405.  
  2406.   make sys5r3 KFLAGS=-UDYNAMIC
  2407.  
  2408. As of edit 169, C-Kermit includes a malloc() debugging package which you may
  2409. link with the Kermit program to catch runtime malloc errors.  See the makefile
  2410. entries for sunos41md and nextmd for examples of how to select malloc
  2411. debugging.  Once you have linked Kermit with the malloc debugger, it will halt
  2412. with an informative message if a malloc-related error occurs and, if possible,
  2413. dump core.  For this reason, malloc-debugging versions of Kermit should be
  2414. built without the "-s" link option (which removes symbols, preventing analysis
  2415. of the core dump).  You have several ways to track down the malloc error:
  2416. Analyze the core dump with adb.  Or reproduce the problem with "log debug" and
  2417. then look at the code around the last debug.log entry.  If you have gcc, build
  2418. the program with "-g" added to CFLAGS and then debug it with gdb, e.g.
  2419.  
  2420.   gdb wermit
  2421.   break main
  2422.   run
  2423.   .. set other breakpoints or watchpoints
  2424.   continue
  2425.  
  2426. Watchpoints are especially useful for finding memory leaks, but they make
  2427. the program run about a thousand times slower than usual, so don't set them
  2428. until the last possible moment.  When a watchpoint is hit, you can use the
  2429. "where" command to find out which C-Kermit source statement triggered it.
  2430.  
  2431. If you have the Pure Software Inc "Purify" product, see the sunos41cp makefile
  2432. entry for an example of how to use it to debug C-Kermit.
  2433.  
  2434.  
  2435. 15. SYSLOGGING
  2436.  
  2437. "Syslogging" means recording selected in the system log via the UNIX syslog()
  2438. facility, which is available in most UNIX versions.  Syslogging is not done
  2439. unless C-Kermit is started with:
  2440.  
  2441.   --syslog:n
  2442.  
  2443. on the command-line, where n is a number greater than 0 to indicate the level
  2444. of syslogging.  See iksd.txt Section 4.2 for details.
  2445.  
  2446. Obviously you can't depend on users to include --syslog:3 (or whatever) on the
  2447. command line every time they start C-Kermit, so if you want certain kinds of
  2448. records to be recorded in the system log, you can build C-Kermit with forced
  2449. syslogging at the desired level, e.g.:
  2450.  
  2451.   make linux KFLAGS=-DSYSLOGLEVEL=2
  2452.  
  2453. Levels 2 and 3 are the most likely candidates for this treatment.  Level 2
  2454. forces logging of all successful dialout calls (e.g. for checking against or
  2455. phone bills), and level 3 records all connections (SET LINE or SET HOST /
  2456. TELNET / RLOGIN, etc) so you can see who is connecting out from your system,
  2457. and to where.
  2458.  
  2459. Level 2 and 3 records are equivalent to those in the connection log; see
  2460. ckermit2.txt for a detailed description of the connection log.
  2461.  
  2462.  
  2463. 16. SECURITY OPTIONS
  2464.  
  2465. C-Kermit 6.1 and later may be built with Kerberos(TM) and/or SRP(TM) (Secure
  2466. Remote Password) capabilities.  These require external libraries that are
  2467. restricted from export by USA law.  See the security.txt file for details.
  2468.  
  2469. Sample makefile entries are provided for Linux:
  2470.  
  2471.   linux:               Regular Linux C-Kermit
  2472.   linux+krb5:          Linux C-Kermit with Kerberos V support
  2473.   linux+krb5+krb4:     Linux C-Kermit with Kerberos IV and V support
  2474.   linux+srp:           Linux C-Kermit with SRP
  2475.   linux+srp+no-des:    Linux C-Kermit with SRP but no DES
  2476.   linux+srp-export:    Linux C-Kermit with SRP, exportable
  2477.   linux+srp+pam:       Linux C-Kermit with SRP with PAM authentication
  2478.   linux+krb5+krb4+srp: Linux C-Kermit with Kerberos IV and V support + SRP
  2479.  
  2480. and so on.  Similarly for other platforms like Solaris, AIX, etc.  Others
  2481. can be added modeled on the ones in the makefile.
  2482.  
  2483. (End of ckuins.txt)
  2484.