📄 ckcplm.txt
字号:
zhome() Returns a pointer to a string containing the user's home directory, or NULL upon error. Should be formatted like zgtdir() (q.v.).intzinfill() This function is used by the macro zminchar(), which is defined in ckcker.h. zminchar() manages its own buffer, and calls zinfill() to fill it whenever it becomes empty. It is only used for sending files, and reads characters only from file number ZIFILE. zinfill() returns -1 upon end of file, -2 upon fatal error, and -3 upon timeout (e.g. when reading from a pipe); otherwise it returns the first character from the buffer it just read.intzkself() Kills the current job, session, process, etc, logs out, disappears. Used by the Kermit server when it receives a BYE command. On failure, returns -1. On success, does not return at all! This function should not be called until all other steps have been taken to close files, etc.VOIDzstrip(fn,&fn2) char *fn1, **fn2; Strip device and directory, etc, from file specification, leaving only the filename. For example DUA0:[PROGRAMS]OOFA.C;3 becomes OOFA.C, or /usr/fdc/oofa.c becomes oofa.c. Returns pointer to result in fn2.VOIDzltor(fn,fn2) char *fn1, *fn2; Local-To-Remote filename translation. Translates the local filename fn into a format suitable for transmission to an arbitrary type of computer, and copies the result into the buffer pointed to by fn2. Translation may involve (a) stripping the device and/or directory/path name, (b) converting lowercase to uppercase, (c) removing spaces and strange characters, or converting them to some innocuous alphabetic character like X, (d) discarding or converting extra periods (there should not be more than one). Does its best. Returns no value. name2 is a pointer to a buffer, furnished by the caller, into which zltor() writes the resulting name. No length checking is done.#ifdef NZLTORVOIDnzltor(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int convert,pathnames,max; Replaces zltor. This new version handles pathnames and checks length. fn1 and fn2 are as in zltor. This version is called unconditionally for each file, rather than only when filename conversion is enabled. Pathnames can have the following values: PATH_OFF: Pathname, if any, is to be stripped PATH_REL: The relative pathname is to be included PATH_ABS: The full pathname is to be included After handling pathnames, conversion is done to the result as in the zltor description if convert != 0; if relative or absolute pathnames are included, they are converted to UNIX format, i.e. with slash (/) as the directory separator. The max parameter specifies the maximum size of fn2.#endif /* NZLTOR */intnzxpand(fn,flags) char *fn; int flags; Replaces zxpand(), which is obsolete as of C-Kermit 7.0. Call with: s = pointer to filename or pattern. flags = option bits: flags & ZX_FILONLY Match regular files flags & ZX_DIRONLY Match directories flags & ZX_RECURSE Descend through directory tree flags & ZX_MATCHDOT Match "dot files" flags & ZX_NOBACKUP Don't match "backup files" Returns the number of files that match s, with data structures set up so that first file (if any) will be returned by the next znext() call. If ZX_FILONLY and ZX_DIRONLY are both set, or neither one is set, files and directories are matched. NOTE: It is essential that the number returned by nzxpand() reflect the actual number of filenames that will be returned by znext calls(). In other words: for (n = nzxpand(string,flags); n > 0; n--) { znext(buf); printf("%s\n", buf); } should print all the file names; no more, no less. NOTE 2: In UNIX, DOS, OS-9, etc, where directories contain entries for themselves (.) and the superior directory (..), these should NOT be included in the list under any circumstances, including when ZX_MATCHDOT is set. NOTE 3: Additional option bits might be added in the future, e.g. for sorting (sort by date/name/size, reverse/ascending, etc).intzmail(addr,fn) char *addr, fn; Send the local, existing file fn as e-mail to the address addr. Returns: Returns 0 on success 2 if mail delivered but temp file can't be deleted -2 if mail can't be deliveredintzmkdir(path) char *path; The path can be a file specification that might contain directory information, in which the filename is expected to be included, or an unambiguous directory specification (e.g. in UNIX it must end with "/"). This routine attempts to create any directories in the given path that don't already exist. Returns: 0 or greater success: no directories needed creation, or else all directories that needed creation were created successfully; the return code is the number of directories that were created. -1 on failure to create any of the needed directories.intzrmdir(path) char *path; Attempts to remove the given directory. Returns 0 on success, -1 on failure. The detailed semantics are open -- should it fail if the directory contains any files or subdirectories, etc. It is probably best for this routine to behave in whatever manner is customary on the underlying platform; e.g. in UNIX, VMS, DOS, etc, where directories can not be removed unless they are empty.VOIDznewn(fn,s) char *fn, **s; Transforms the name fn into a filename which is guaranteed to be unique. If the file fn does not exist, then the new name will be the same as fn. Otherwise, it will be different. Does its best, returns no value. New name is created in caller's space. Call like this: znewn(old,&new);. The second parameter is a pointer to the new name. This pointer is set by znewn() to point to a static string in its own space.intznext(fn) char *fn; Copies the next file name from a file list created by zxpand() into the string pointed to by fn (see zxpand). If no more files, then the null string is placed there. Returns 0 if there are no more filenames, with 0th element the array pointed to by fn set to NUL. If there is a filename, it is stored in the array pointed to by fn, and a positive number is returned. NOTE: This is a change from earlier definitions of this function (pre-1999), which returned the number of files remaining; thus 0 was the return value when returning the final file. However, no mainline code ever depended on the return value, so this change should be safe.intzopeni(n,fn) int n; char *fn; Opens the file named fn for input as file number n. Returns: 0 on failure. 1 on success.(zopeno - the second two parameters are new to C-Kermit 5A)intzopeno(n,fn,zz,fcb) int n; char *name; struct zattr *zz; struct filinfo *fcb; Attempts to open the named file for output as file number n. zz is a Kermit file attribute structure as defined in ckcdeb.h, containing various information about the file, including its size, creation date, and so forth. This function should attempt to honor as many of these as possible. fcb is a "file control block" in the traditional sense, defined in ckcdeb.h, containing information of interest to complicated file systems like VAX/VMS, IBM MVS, etc, like blocksize, record length, organization, record format, carriage control, disposition (like create vs append), etc. Returns: 0 on failure. 1 on success.intzoutdump() Dumps an output buffer. Used with the macro zmchout() defined in ckcker.h. Used only with file number ZOFILE, i.e. the file that is being received by Kermit during file transfer. Returns: -1 on failure. 0 on success.intzprint(p,fn) char *p, *f; Prints the file with name fn on a local printer, with options p. Returns: Returns 0 on success 3 if file sent to printer but can't be deleted -3 if file can't be printedintzrename(fn,fn2) char *fn, *fn2; Changes the name of file fn to fn2. If fn2 is the name of an existing directory, or a file-structured device, then file fn1 is moved to that directory or device, keeping its original name. If fn2 lacks a directory separator when passed to this function, an appropriate one is supplied. Returns: -1 on failure. 0 on success.intzcopy(source,dest) char * source, * dest; Copies the source file to the destination. One file only. No wildcards. The destination string may be a filename or a directory name. Returns: 0 on success. <0 on failure: -2 = source file is not a regular file. -3 = source file not found. -4 = permission denied. -5 = source and destination are the same file. -6 = i/o error. -1 = other error.VOIDzrtol(fn,fn2) char *fn, *fn2; Remote-To-Local filename translation. Translates a "standard" filename (see zrtol) to a local filename. For example, in Unix this function might convert an all-uppercase name to lowercase, but leave lower- or mix-case names alone. Does its best, returns no value. New name is in string pointed to by fn2. No length checking is done.#ifdef NZLTORnzrtol(fn,fn2,convert,pathnames,max) char *fn1,*fn2; int convert,pathnames,max; Replaces zrtol. Like zrtol but handles pathnames and checks length. See nzltor for detailed description of parameters.#endif /* NZLTOR */intzsattr(xx) struct zattr *xx; { Fills in a Kermit file attribute structure for the file which is to be sent, namely the currently open ZIFILE. Returns: -1 on failure. 0 on success with the structure filled in. If any string member is null, then it should be ignored by the caller. If any numeric member is -1, then it should be ignored by the caller.intzshcmd(s) char *s; s contains to pointer to a command to be executed by the host computer's shell, command parser, or operating system. If the system allows the user to choose from a variety of command processors (shells), then this function should employ the user's preferred shell. If possible, the user's job (environment, process, etc) should be set up to catch keyboard interruption signals to allow the user to halt the system command and return to Kermit. The command must run in ordinary, unprivileged user mode. If possible, this function should return -1 on failure to start the command, or else it should return 1 if the command succeeded and 0 if it failed.intpexitstatus zshcmd() and zsyscmd() should set this to the command's actual exit status code if possible.intzsyscmd(s) char *s; s contains to pointer to a command to be executed by the host computer's shell, command parser, or operating system. If the system allows the user to choose from a variety of command processors (shells), then this function should employ the system standard shell (e.g. /bin/sh for Unix), so that the results will always be the same for everybody. If possible, the user's job (environment, process, etc) should be set up to catch keyboard interruption signals to allow the user to halt the system command and return to Kermit. The command must run in ordinary, unprivileged user mode. If possible, this function should return -1 on failure to start the command, or else it should return 1 if the command succeeded and 0 if it failed.VOIDz_exec(s,args) char * s; char * args[]; This one executes the command s (which is searched for using the system's normal searching mechanism, such as PATH in UNIX), with the given argument vector, which follows the conventions of UNIX argv[]: the name of the command pointed to by element 0, the first arg by element 1, and so on. A null args[] pointer indicates the end of the arugment list. All open files must remain open so the exec'd process can use them. Returns only if unsuccessful.intzsinl(n,s,x) int n, x; char *s; Reads a line from file number n. Writes the line into the address s provided by the caller. Writing terminates when newline is read, but with newline discarded. Writing also terminates upon EOF or if length x is exhausted. Returns: -1 on EOF or error. 0 on success.intzsout(n,s) int n; char *s; Writes the string s out to file number n. Returns: -1 on failure. 0 on success.intzsoutl(n,s) int n; char *s; Writes the string s out to file number n and adds a line (record) terminator (boundary) appropriate for the system and the file format. Returns: -1 on failure. 0 on success.intzsoutx(n,s,x) int n, x; char *s; Writes exactly x characters from string s to file number n. If s has fewer than x characters, then the entire string s is written. Returns: -1 on error. >= 0 on success, the number of characters actually written.intzstime(f,yy,x) char *f; struct zattr *yy; int x; Sets the creation date (and other attributes) of an existing file, or compares a file's creation date with a given date. Call with:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -