📄 ckcplm.txt
字号:
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 system, 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 to by group 3 module. Used by ckcmai.c to initialize flow control variable.int dfloc; Default location. 0 = remote, 1 = local. Set by group 3 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 3 module. Used by ckcmai.c to initialize parity variable.char *dftty; Default communication device. Set by group 3 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 VAX/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.B. Functions.These are divided into three categories: file-related functions (B.1),communication functions (B.2), and miscellaneous functions (B.3).B.1. File-related functions.In most implementations, these are collected together into a module calledCK?FIO.c, where ? = U (UNIX), V (VMS), O (OS/2), etc (see CKAAAA.TXT). To betotally system-independent, C-Kermit maintains its own file numbers, andprovides the functions described in this section to deal with the filesassociated with them. The file numbers are referred to symbolically, and aredefined 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 ofthese file numbers. Functions are of type int unless otherwise noted, and arelisted alphabetically.intchkfn(n) int n; Checks the file number n. Returns: -1: File number n is out of range 0: n is in range, but file is not open 1: n in range and file is openintiswild(filspec) char *filespec; Checks if the file specification is "wild", i.e. contains metacharacters or other notations intended to match multiple filenames. Returns: 0: not wild 1: wildintisdir(string) char *string; Checks if the string is the name of an existing directory. Returns: 0: not a directory (including any kind of error) 1: it is an existing directory The idea is to check whether the string can be "cd'd" to, so in some cases (e.g. OS/2) it might also indicate any file structured device, such as a disk drive (like A:). Other nonzero returns indicate system-dependent information; e.g. in VMS isdir("[.FOO]") returns 1 but isdir("FOO.DIR;1") returns 2 to indicate the directory-file name is in a format that needs conversion before it can be combined with a filename.char *zfcdat(name) char *name; Returns modification (preferably, otherwise creation) date/time of file whose name is given in the argument string. Return value is a pointer to a string of the form yyyymmdd hh:mm:ss, for example 19931231 23:59:59, which represents the local time (no timezone or daylight savings time finagling required). Returns the null string ("") on failure. The text pointed to by the string pointer might be in a static buffer, and so should be copied to a safe place by the caller before any subsequent calls to this function.struct zfnfp *zfnqfp(fname, buflen, buf) char * fname; int buflen; char * buf; Given the filename "fname", the corresponding fully qualified, absolute filename is placed into the buffer buf, with maximum length buflen. On failure returns a NULL pointer. On success returns a pointer to a struct zfnfp (see ckcdeb.h) containing pointers to the full pathname and to just the filename. All references to this function in mainline code must be protected by #ifdef ZFNQFP..#endif, because it is not present in all of the ck*fio.c modules. So if you implement this function in a version that did not have it before, be sure to add #define ZFNQFP in the appropriate spot in ckcdeb.h.intzfseek(pos) long pos; Positions the input pointer on the current input file to the given position. The pos argument is 0-based, the offset (distance in bytes) from beginning of the file. Needed for RESEND, PSEND, and other recovery operations. This function is not necessarily possible on all systems, e.g. record-oriented systems. It should only be used on binary files (i.e. files we are sending in binary mode) and stream-oriented file systems. Returns -1 on failure, 0 on success.intzchdir(dirnam) char *dirnam; Change current or default directory to the one given in dirnam. Returns 1 on success, 0 on failure.longzchki(fn) char *fn; Check to see if file with name fn is a regular, readable, existing file, suitable for Kermit to send -- not a directory, not a symbolic link, etc. Returns: -3 if file exists but is not accessible (e.g. read-protected); -2 if file exists but is not of a readable type (e.g. a directory); -1 on error (e.g. file does not exist, or fn is garbage); >= 0 (length of file) if file exists and is readable. Also see isdir(), zgetfs().intzchkpid(pid) unsigned long pid; Returns 1 if the given process ID (e.g. pid in UNIX) is valid and active, 0 otherwise.longzgetfs(fn) char *fn; Get the size of the given file, regardless of accessibility. Used for directory listings. Unlike zchki(), should return the size of any kind of file, even a directory. zgetfs() also should serve as a mini "get file info" function that can be used until we design a better one, by also setting some global variables: int zgfs_link = 1/0 = file is (not) a symbolic link. int zgfs_dir = 1/0 = file is (not) a directory. char linkname[] = if zgfs_link != 0, name of file link points to. Returns: -1 on error (e.g. file does not exist, or fn is garbage); >= 0 (length of file) if file exists and is readable.intzchko(fn) char *fn; Checks to see if a file of the given name can be created. Returns: -1 if file cannot be created, or on any kind of error. 0 if file can be created.intzchkspa(fn,len) char *f; long len; Check to see if there is sufficient space to store the file named fn, which is len bytes long. Returns: -1 on error. 0 if there is not enough space. 1 if there is enough space. If you can't write a function to do this, then just make a dummy that always returns 1. Higher level code will recover from disk-full errors. The receiving Kermit uses this function to refuse an incoming file based on its size, via the attribute mechanism.intzchin(n,c) int n; int *c; Get a character from file number n, return it in c (call with &c). Returns: -1 on failure, including EOF. 0 on success with character in c.intzchout(n,c) int n; char c; Write the character c to file number n. Returns: -1 error 0 OKintzclose(n) int n; Close file number n. Returns: -1 error 1 OKintzdelet(fn) char *name; Attempts to delete the named file. Returns: -1 on error 0 if file was deleted successfullychar *zgperm(char * f) Returns a pointer to the system-dependent numeric permissions/protection string for file f, or NULL upon failure. Used if CK_PERMS is defined.char *ziperm(char * f) Returns a pointer to the system-dependent symbolic permissions/protection string for file f, or NULL upon failure. Used if CK_PERMS is defined. Example: In UNIX zgperm(f) might return "100770", but ziperm() might return "-rwxrwx---". In VMS, zgperm() would return a hexadecimal string, but ziperm() would return something like "(RWED,RWED,RE,)".char *zgtdir() Returns a pointer to the name of the current directory, folder, etc, or a NULL pointer if the current directory cannot be determined. If possible, the directory specification should be (a) fully specified, e.g. as a complete pathname, and (b) be suitable for appending a filename. Thus, for example, UNIX directory names should end with '/'. VMS directory names should look like DEV:[NAME] (rather than, say, NAME.DIR;1).char *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -