📄 ckcplm.txt
字号:
as needed; not only for purity's sake, but also to allow for multiple simultaneous communication sessions and or user interfaces. Our list of things to do is endless, and reorganizing the source is almost always at the bottom. The ckuus*.c modules (like many of the ckc*.c modules) depend on the existence of C library features like fopen, fgets, feof, (f)printf, argv/argc, etc. Other functions that are likely to vary among operating systems -- like setting terminal modes or interrupts -- are invoked via calls to functions that are defined in the [93]Group E platform-dependent modules, ck?[ft]io.c. The command line parser processes any arguments found on the command line, as passed to main() via argv/argc. The interactive parser uses the facilities of the cmd package (developed for this program, but, in theory, usable by any program). Any command parser may be substituted for this one. The only requirements for the Kermit command parser are these: 1. Set parameters via global variables like duplex, speed, ttname, etc. See [94]ckcmai.c for the declarations and descriptions of these variables. 2. If a command can be executed without the use of Kermit protocol, then execute the command directly and set the sstate (start state) variable to 0. Examples include SET commands, local directory listings, the CONNECT command. 3. If a command requires the Kermit protocol, set the following variables: sstate string data 'x' (enter server mode) (none) 'r' (send a 'get' command) cmarg, cmarg2 'v' (enter receive mode) cmarg2 'g' (send a generic command) cmarg 's' (send files) nfils, cmarg & cmarg2 OR cmlist 'c' (send a remote host command) cmarg cmlist is an array of pointers to strings. cmarg, cmarg2 are pointers to strings. nfils is an integer (hmmm, probably should be an unsigned long). cmarg can be: A filename string (possibly wild), or: a pointer to a prefabricated generic command string, or: a pointer to a host command string. cmarg2 is: The name to send a single file under, or: the name under which to store an incoming file; must not be wild. If it's the name for receiving, a null value means to store the file under the name it arrives with. cmlist is: A list of nonwild filenames, such as passed via argv. nfils is an integer, interpreted as follows: -1: filespec (possibly wild) in cmarg, must be expanded internally. 0: send from stdin (standard input). >0: number of files to send, from cmlist. The screen() function is used to update the screen during file transfer. The tlog() function writes to a transaction log (if TLOG is defined). The debug() function writes to a debugging log (if DEBUG is defined). The intmsg() and chkint() functions provide the user i/o for interrupting file transfers. [ [95]Contents ] [ [96]C-Kermit ] [ [97]Kermit Home ] ________________________________________________________________________ 4.E. Group E: Platform-Dependent I/O Platform-dependent function definitions. All the Kermit modules, including the command package, call upon these functions, which are designed to provide system-independent primitives for controlling and manipulating devices and files. For Unix, these functions are defined in the files [98]ckufio.c (files), [99]ckutio.c (communications), and [100]ckusig.c (signal handling). For VMS, the files are [101]ckvfio.c, ckvtio.c, and [102]ckusig.c (VMS can use the same signal handling routines as Unix). It doesn't really matter what the files are called, except for Kermit distribution purposes (grouping related files together alphabetically), only that each function is provided with the name indicated, observes the same calling and return conventions, and has the same type. The Group E modules contain both functions and global variables that are accessed by modules in the other groups. These are now described. (By the way, I got this list by linking all the C-Kermit modules together except ckutio and ckufio. These are the symbols that ld reported as undefined. But that was a long time ago, probably circa Version 6.) 4.E.1. Global Variables char *DELCMD; Pointer to string containing command for deleting files. Example: char *DELCMD = "rm -f "; (UNIX) Example: char *DELCMD = "delete "; (VMS) Note trailing space. Filename is concatenated to end of this string. NOTE: DELCMD is used only in versions that do not provide their own built-in DELETE command. char *DIRCMD; Pointer to string containing command for listing files when a filespec is given. Example: char *DIRCMD = "/bin/ls -l "; (UNIX) Example: char *DIRCMD = "directory "; (VMS) Note trailing space. Filename is concatenated to end of this string. NOTE: DIRCMD is used only in versions that do not provide their own built-in DIRECTORY command. char *DIRCM2; Pointer to string containing command for listing files when a filespec is not given. (currently not used, handled in another way.) Example: char *DIRCMD2 = "/bin/ls -ld *"; NOTE: DIRCMD2 is used only in versions that do not provide their own built-in DIRECTORY command. char *PWDCMD; Pointer to string containing command to display current directory. Example: char *PWDCMD = "pwd "; NOTE: PWDCMD is used only in versions that do not provide their own built-in PWD command. char *SPACMD; Pointer to command to display free disk space in current device/directory. Example: char *SPACMD = "df ."; NOTE: SPACMD is used only in versions that do not provide their own built-in SPACE command. char *SPACM2; Pointer to command to display free disk space in another device/directory. Example: char *SPACM2 = "df "; Note trailing space. Device or directory name is added to this string. NOTE: SPACMD2 is used only in versions that do not provide their own built-in SPACE command. char *TYPCMD; Pointer to command for displaying the contents of a file. Example: char *TYPCMD = "cat "; Note trailing space. Device or directory name is added to this string. NOTE: TYPCMD is used only in versions that do not provide their own built-in TYPE command. char *WHOCMD; Pointer to command for displaying logged-in users. Example: char *WHOCMD = "who "; Note trailing space. Specific user name may be added to this string. int backgrd = 0; Flag for whether program is running in foreground (0) or background (nonzero). Background operation implies that screen output should not be done and that all errors should be fatal. int ckxech; Flag for who is to echo console typein: 1: The program (system is not echoing). 0: The OS, front end, terminal, etc (not this program). char *ckxsys; Pointer to string that names the computer and operating system. Example: char *ckxsys = " NeXT Mach 1.0"; Tells what computer system ckxv applies to. In UNIX Kermit, this variable is also used to print the program herald, and in the SHOW VERSION command. char *ckxv; Pointer to version/edit info of ck?tio.c module. Example: char *ckxv = "UNIX Communications Support, 6.0.169, 6 Sep 96"; Used by SHOW VERSION command. char *ckzsys; Like ckxsys, but briefer. Example: char *ckzsys = " 4.3 BSD"; Tells what platform ckzv applies to. Used by the SHOW VERSION command. char *ckzv; Pointer to version/edit info of ck?fio.c module. Example: char *ckzv = "UNIX File support, 6.0.113, 6 Sep 96"; Used by SHOW VERSION command. int dfflow; Default flow control. 0 = none, 1 = Xon/Xoff, ... (see FLO_xxx symbols in ckcdeb.h) Set by Group E module. Used by [103]ckcmai.c to initialize flow control variable. int dfloc; Default location. 0 = remote, 1 = local. Set by Group E module. Used by ckcmai.c to initialize local variable. Used in various places in the user interface. int dfprty; Default parity. 0 = none, 'e' = even, 'o' = odd, 'm' = mark, 's' = space. Set by Group E module. Used by ckcmai.c to initialize parity variable. char *dftty; Default communication device. Set by Group E module. Used in many places. This variable should be initialized the the symbol CTTNAM, which is defined in ckcdeb.h, e.g. as "/dev/tty" for UNIX, "TT:" for VMS, etc. Example: char *dftty = CTTNAM; char *mtchs[]; Array of string pointers to filenames that matched the most recent wildcard match, i.e. the most recent call to zxpand(). Used (at least) by command parsing package for partial filename completion. int tilde_expand; Flag for whether to attempt to expand leading tildes in directory names (used in UNIX only, and then only when the symbol DTILDE is defined. int ttnproto; The protocol being used to communicate over a network device. Values are defined in ckcnet.h. Example: NP_TELNET is network protocol "telnet". int maxnam; The maximum length for a filename, exclusive of any device or directory information, in the format of the host operating system. int maxpath; The maximum length for a fully specified filename, including device designator, directory name, network node name, etc, in the format of the host operating system, and including all punctuation. int ttyfd; File descriptor of the communication device. -1 if there is no open or usable connection, including when C-Kermit is in remote mode. Since this is not implemented everywhere, references to it are in #ifdef CK_TTYFD..#endif. [ [104]Contents ] [ [105]C-Kermit ] [ [106]Kermit Home ] ________________________________________________________________________ 4.E.2. Functions These are divided into three categories: file-related functions (B.1), communication functions (B.2), and miscellaneous functions (B.3). 4.E.2.1. File-Related Functions In most implementations, these are collected together into a module called ck?fio.c, where ? = "u" ([107]ckutio.c for Unix), "v" ([108]ckvtio.c for VMS), [109]etc. To be totally platform-independent, C-Kermit maintains its own file numbers, and provides the functions described in this section to deal with the files associated with them. The file numbers are referred to symbolically, and are defined as follows in ckcker.h: #define ZCTERM 0 /* Console terminal */ #define ZSTDIO 1 /* Standard input/output */ #define ZIFILE 2 /* Current input file for SEND command */ #define ZOFILE 3 /* Current output file for RECEIVE command */ #define ZDFILE 4 /* Current debugging log file */ #define ZTFILE 5 /* Current transaction log file */ #define ZPFILE 6 /* Current packet log file */ #define ZSFILE 7 /* Current session log file */ #define ZSYSFN 8 /* Input from a system function (pipe) */ #define ZRFILE 9 /* Local file for READ command */ (NEW) #define ZWFILE 10 /* Local file for WRITE command */ (NEW) #define ZMFILE 11 /* Auxilliary file for internal use */ (NEW) #define ZNFILS 12 /* How many defined file numbers */ In the descriptions below, fn refers to a filename, and n refers to one of these file numbers. Functions are of type int unless otherwise noted, and are listed mostly alphabetically. int chkfn(n) int n;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -