📄 ckuins.doc
字号:
and to manually select termcap: compile -DM_TERMCAP and link -ltcap -ltermlib<curses.h> looks at M_TERMINFO and M_TERMCAP to decide which header files touse. /usr/lib/libcurses.a is a link to either libtinfo.a or libtcap.a. TheC-Kermit compilation options must agree with the version of the curses librarythat is actually installed.NOTE: If you are doing an ANSI-C compilation and you get compile time warningslike the following: Warning: function not declared in ckuusx.c: wmove, printw, wclrtoeol, wclear, wrefresh, endwin, etc...it means that your <curses.h> file does not contain prototypes for thesefunctions. The warnings should be harmless.Screen refresh capability (to repaint a file transfer display that was messedup because of a broadcast message or similar interference) was added inC-Kermit 5A(190). A totally satisfactory repainting job can be done only ifthe screen management library includes clearok() and wrefresh() functions orthe equivalent. To enable the use of these functions, add the followingdefinition to your CFLAGS: -DCK_WREFRESHor "#define CK_REFRESH" in ckcdeb.h file. If this symbol is not defined,the screen can be only partially refreshed, because some of the information(such as the filename) has already passed by.UNIX VERSIONSThere are several major varieties of UNIX: Bell Laboratories Seventh Edition,AT&T System V, Berkeley Standard Distribution (BSD), and POSIX. Each hasmany, many subvarieties and descendents, and there are also hybrids thatexhibit symptoms of two or more varieties, plus special quirks of their own.Seventh edition versions of C-Kermit include the compile-time option -DV7 inthe CFLAGS string in the makefile entry. Various V7-based implementations arealso supported: -DCOHERENT, -DMINIX, etc.AT&T-based versions of UNIX Kermit include the compile-time option -DATTSV(standing for AT&T UNIX System V). This applies to System III and to System Vup to and including Release 2. For System V Release 3, the flag -DSVR3 shouldbe used instead (which also implies -DATTSV). This is because the data typeof signal() and several other functions was changed between SVR2 and SVR3.For System V Release 4, include -DSVR4 because of changes in UUCP lockfileconventions; this also implies -DSVR3 and -DATTSV.For BSD, the flag -BSDxx must be included, where xx is the BSD versionnumber, for example BSD4 (for version 4.2 or later, using only 4.2 features),-DBSD41 (for BSD 4.1 only), -DBSD43 (for 4.3 or later), -DBSD29 (BSD 2.9for DEC PDP-11s).For POSIX, include the flag -DPOSIX. POSIX defines a whole new set ofterminal i/o functions that are not found in traditional AT&T or Berkeleyimplementations, and also defines the symbol _POSIX_SOURCE, which is usedin many system and library header files, mainly to disable non-POSIX features.There is a tendency for UNIX implementations to be neither pure AT&T nor pureBSD nor pure POSIX, but a mixture of two or more of these, with "compatibilityfeatures" allowing different varieties of programs to be built on the samecomputer. In general, Kermit tries not to mix & match but to keep aconsistent repertoire throughout. However, there are certain UNIXimplementations that only work when you mix and match. For example, theSilicon Graphics Iris workstation IRIX operating system (prior to version 3.3)is an AT&T UNIX but with a BSD file system. The only way you can build Kermitsuccessfully for this configuration is to include -DSVR3 plus the specialoption -DLONGFN, meaning "pretend I was built with -DBSDxx when it's time tocompile directory-related code". See the "iris" makefile entry.STANDARDSIn edits 166-167, C-Kermit was heavily modified to try to keep abreast of newstandards while still remaining compatible with old versions of C and UNIX.There are two new standards of interest: ANSI C (as described in Kernighan andRitchie, "The C Programming Language", Second Edition, Prentice Hall, 1988)and POSIX.1 (IEEE Standard 1003.1 and ISO/IEC 9945-1, 1990, "PortableOperating System Interface"). These two standards have nothing to do witheach other: you can build C-Kermit with a non-ANSI compiler for a POSIXsystem, or for a non-POSIX system with with an ANSI compiler.(a) POSIXPOSIX.1 defines a repertoire of system functions and header files for use by Clanguage programs. Most notably, the ioctl() function is not allowed inPOSIX; all ioctl() functions have been replaced by device-specific functionslike tcsetattr(), tcsendbreak(), etc.Computer systems (UNIX, and reportedly also forthcoming versions of VAX/VMS)that claim some degree of POSIX compliance have made some attempt to put theirheader files in the right places and give them the right names, and to providesystem library functions with the right names and calling conventions. Withinthe header files, POSIX-compliant functions are supposed to be within #ifdef_POSIX_SOURCE..#endif conditionals, and non-POSIX items are not within theseconditionals.If C-Kermit is built with the -DPOSIX flag, it attempts to configure itselffor a pure POSIX environment. It defines _POSIX_SOURCE, it calls onlyPOSIX-defined functions, and it includes POSIX-defined header files.If Kermit is built with _D_POSIX_SOURCE but not -DPOSIX, C-Kermit must bebuilt with one of the -DBSD or -DATTSV flags (or one that implies them), butstill uses only the POSIX features in the system header files. This allowsC-Kermit to be built on BSD or AT&T systems that have some degree of POSIXcompliance, but still use BSD or AT&T specific features.If Kermit is built with neither _D_POSIX_SOURCE nor -DPOSIX, the functions andheader files of the selected version of UNIX (or VMS, etc) are used accordingto the CFLAGS Kermit was built with.The POSIX standard does not define anything about uucp lockfiles. "makeposix" uses NO (repeat, NO) lockfile conventions. If your POSIX-compliantUNIX version uses a lockfile convention such as HDBUUCP (see below), usethe "posix" entry, but include the appropriate lockfile option in your KFLAGSon the "make" command line, for example: make posix "KFLAGS=-DHDBUUCP"POSIX.1 also lacks certain other features that Kermit needs. For example: - There is no defined way for an application to do wildcard matching of filenames. Kermit uses the inode in the directory structure, but POSIX does not include this concept. POSIX.2 will include functions for this, named (I think) glob() and fnmatch(), but these functions are not yet in Kermit. - There is no POSIX mechanism for dealing with modem signals, nor to enable RTS/CTS or other hardware flow control. - There is no way to check if characters are waiting in a communications device (or console) input buffer, short of trying to read them -- no select(), ioctl(fd,FIONREAD,blah), rdchk(), etc. This is bad for CONNECT mode and bad for sliding windows. - No way to do a millisecond sleep (no nap(), usleep(), select(), etc). - There is no popen().So at this point, there cannot be one single fully functional POSIX form ofC-Kermit unless it also has "extensions", as do Linux, QNX, etc.(b) ANSI CThe major difference between ANSI C and earlier C compilers is functionprototyping. ANSI C allows function arguments to be checked for typeagreement, and (when possible) type coercion in the event of a mismatch. Forthis to work, functions and their arguments must be declared before they arecalled. The form for function declarations is different in ANSI C andnon-ANSI C (ANSI C also accepts the earlier form, but then does not do typechecking).As of edit 167, C-Kermit tries to take full advantage of ANSI C features,especially function prototyping. This removes many bugs introduced bydiffering data types used or returned by the same functions on differentcomputers. ANSI C features are automatically enabled when the symbol __STDC__is defined. Most ANSI C compilers, such as GNU CC and the new DEC C compilerdefine this symbol internally.To force use of ANSI C prototypes, include -DCK_ANSIC on the cc command line.To disable the use of ANSI prototypes, include -DNOANSI.UNIX MAKE FAILURESFirst, be sure the source files are stored on your current disk and directorywith the right names (in lowercase). Second, make sure that the makefileitself does not contain any lines with leading spaces: indented lines must allstart with horizontal TAB, and no spaces.Then make sure that your UNIX PATH is defined to find the appropriate compilerfor your makefile entry. For example, on SunOS systems, "make sunos41" buildsC-Kermit for the BSD environment, and assumes that /usr/ucb/cc will be usedfor compilation and linking. If your PATH has /usr/5bin ahead of /usr/ucb,you can have problems at compile or link time (a commonly reported symptom isthe inability to fine "ftime" during linking). Fix such problems byredefining your UNIX PATH, or by specifying the appropriate "cc" in CC=and CC2= statements in your makefile entry.During edits 166-167, considerable effort went into making C-Kermit compilableby ANSI C compilers. This includes prototyping all of C-Kermit's functions,and including the ANSI-defined system header files for system and libraryfunctions, as defined in K & R, second edition: <string.h>, <stdlib.h>,<unistd.h> (except in NeXTSTEP this is <libc.h>), and <sys/stdtypes.h>. Ifyou get warnings about any of these header files not being found, or aboutargument mismatches involving pid_t, uid_t, or gid_t, look in ckcdeb.h andmake amendments. C-Kermit assumes it is being compiled by an ANSI-compliant Ccompiler if __STDC__ is defined, normally defined by the compiler itself. Youcan force ANSI compilation without defining __STDC__ (which some compilerswon't let you define) by including -DCK_ANSIC on the cc command line.On the other hand, if your compiler defines __STDC__ but still complains aboutthe syntax of Kermit's function prototypes, you can disable the ANSI-stylefunction prototyping by including -DNOANSI on the command line.For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick themost appropriate makefile entry, and be sure you have installed an SCOdevelopment system that is keyed to your exact SCO operating system release,down to the minor version (like 2.3.1).Also note that SCO distributes some of its libraries in encrypted form, andthey must be decrypted before C-Kermit can be linked with them. If not, youmight see a message like: ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365To decrypt, you must supply a key (password) that came with your license.Call SCO for further info.If your compiler uses something other than int for the pid (process id) datatype, put -DPID_T=pid_t or whatever in your CFLAGS.If you get complaints about unknown data types uid_t and gid_t, put-DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the appropriatetypes.If your compilation fails because of conflicting or duplicate declarations forsys_errlist, add -DNDSYSERRLIST to CFLAGS.If your compilation dies because getpwnam() is being redeclared (or becauseof "conflicting types for getwpnam"), add -DNDGPWNAM to your CFLAGS.If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see ckufio.c aroundline 440).If the compiler complains about the declaration of getpwnam() during an ANSI Ccompilation, remove the declaration from ckufio.c or change the argument inthe prototype from (char *) to (const char *).If you get complaints that getpwuid() is being called with an improper type,put -DPWID_T=xx in your CFLAGS.If you get compile-time warnings that t_brkc or t_eofc (tchars structuremembers, used in BSD-based versions) are undefined, or structure-member-related warnings that might be traced to this fact, add -DNOBRKC to CFLAGS.If you get a linker message to the effect that _setreuid or _setregid is notdefined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=<blah> to CFLAGS to makeC-Kermit read the right <types.h>-kind-of-file to pick up these definitions.If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS.If you get a complaint at compile time about an illegal pointer-integercombination in ckufio.c involving popen(), or at link time that _popen is anundefined symbol, add the declaration "FILE *popen();" to the function zxcmd()in ckufio.c (this declaration is supposed to be in <stdio.h>). If making thischange does not help, then apparently your UNIX does not have the popen()function, so you should add -DNOPOPEN to your make entry, in which casecertain functions involving "file" i/o to the standard input and output ofsubprocesses will not be available.If your linker complains that _getcwd is undefined, you can add a getcwd()function to ckufio.c, or add it to your libc.a library using ar:#include <stdio.h>char *getcwd(buf,size) char *buf; int size; {#ifndef NOPOPEN#ifdef DCLPOPEN FILE *popen();#endif FILE *pfp; if (!buf) return(NULL); if (!(pfp = popen("pwd","r"))) return(NULL); fgets(buf,size-2,pfp); pclose(pfp); buf[strlen(buf)-1] = '\0'; return((char *)buf);#else buf[0] = '\0'; return(NULL);#endif /* NOPOPEN */}#ifdef NOPOPEN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -