⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckcplm.doc

📁 linux终端仿真程序
💻 DOC
📖 第 1 页 / 共 5 页
字号:
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.intzsyscmd(s) char *s;  *NEW*  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.intzsinl(n,s,x) int n, x; char *s;  *NEW*  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;  *NEW*  Sets the creation date of an existing file, or compares a file's creation  date with a given date.  Call with:  f  = pointer to name of existing file.  yy = pointer to a Kermit file attribute structure in which yy->date.val       is a date of the form yyyymmdd hh:mm:ss, e.g. 19900208 13:00:00, which       is to be used for setting the date.  x  = is a function code: 0 means to set the file's creation date as given.       1 means compare the given date with the file creation date.        Returns:  -1 on any kind of error.   0 if x is 0 and the file date was set successfully.   0 if x is 1 and date from attribute structure > file creation date.   1 if x is 1 and date from attribute structure <= file creation date.VOIDzstrip(name,name2) char *name, **name2;  *NEW*  Strips pathname from filename "name".  Constructs the resulting string  in a static buffer in its own space and returns a pointer to it in name2.  Also strips device name, file version numbers, and other "non-name" material.*NEW* (zxcmd - arguments are new, writing to a command is new)intzxcmd(n,s) char *s;  Runs a system command so its output can be accessed as if it were file n.  The command is run in ordinary, unprivileged user mode.  If n is ZSTDIO or ZCTERM, returns -1.  If n is ZIFILE or ZRFILE, then Kermit reads from the command, otherwise  Kermit writes to the command.  Returns 0 on error, 1 on success.intzxpand(fn) char *fn;  Expands a wildcard string into an array of strings.  Returns the number of files that match fn1, with data structures set up  so that first filename (if any) will be returned by the next znext() call.  If no files match, or if there is any kind of error, zxpand returns 0.intxsystem(cmd) char *cmd;  Executes the system command without redirecting any of its i/o, similar  (well, identical) to system() in Unix.  But before passing the command to  the system, xsystem() ensures that all privileges are turned off, so that  the system command will execute in ordinary unprivileged user mode.B.1.5 Security/Privilege Functions (all *NEW*)These functions are used by C-Kermit to adapt itself to operating systemswhere the program can be made to run in a "privileged" mode.  C-Kermitshould NOT read and write files or start subprocesses as a privileged program.This would present a serious threat to system security.  The security packagehas been installed to prevent such security breaches by turning off theprogram's special privileges at all times except when they are needed.In UNIX, the only need Kermit has for privileged status is access to the UUCPlockfile directory, in order to read, create, and destroy lockfiles, and toopen communication devices that are normally protected against the user.Therefore, privileges should only be enabled for these operations and disabledat all other times.  This relieves the programmer of the responsibility ofputting expensive and unreliable access checks around every file access andsubprocess creation.Strictly speaking, these functions are not required in all C-Kermitimplementations, because their use (so far, at least) is internal to the group3 modules.  However, they should be included in all C-Kermit implementationsfor operating systems that support the notion of a privileged program (UNIX,RSTS/E, what else?).intpriv_ini()  *NEW*  Determine whether the program is running in privileged status.  If so,  turn off the privileges, in such a way that they can be turned on again  when needed.  Called from sysinit() at program startup time.  Returns:    0 on success    nonzero on failure, in which case the program should halt immediately.intpriv_on()  *NEW*  If the program is not privileged, this function does nothing.  If the  program is privileged, this function returns it to privileged status.  priv_ini() must have been called first.  Returns:    0 on success    nonzero on failureintpriv_off()  *NEW*  Turns privileges off (if they are on) in such a way that they can be  turned back on again.  Returns:    0 on success    nonzero on failureintpriv_can()  *NEW*  Turns privileges off in such a way that they cannot be turned back on.  Returns:    0 on success    nonzero on failureintpriv_chk()  *NEW*  Attempts to turns privileges off in such a way that they can be turned on  again later.  Then checks to make sure that they were really turned off.  If they were not really turned off, then they are cancelled permanently.  Returns:    0 on success    nonzero on failureB.2.  Console-Related Functions.These relate to the program's "console", or controlling terminal, i.e. theterminal that the user is logged in on and types commands at, or on a PC orworkstation, the actual keyboard and screen.intconbin(esc) char esc;  Puts the console into "binary" mode, so that Kermit's command parser can  control echoing and other treatment of characters that the user types.  esc is the character that will be used to get Kermit's attention during  packet mode; puts this in a global place.  Sets the ckxech variable.  Returns:  -1 on error.   0 on success.intconcb(esc) char esc;  Put console in "cbreak" (single-character wakeup) mode.  That is, ensure  that each console character is available to the program immediately when the  user types it.  Otherwise just like conbin().  Returns:  -1 on error.   0 on success.intconchk()  Returns a number, 0 or greater, the number of characters waiting to be read  from the console, i.e. the number of characters that the user has typed that  have not been read yet.longcongspd();   *NEW*  Returns the speed ("baud rate") of the controlling terminal, if known,  otherwise -1L.intcongks(timo) int timo;   *NEW*  Get Keyboard Scancode.  Reads a keyboard scan code from the physical console  keyboard.  If the timo parameter is greater than zero, then times out and  returns -2 if no character appears within the given number of seconds.  Upon  any other kind of error, returns -1.  Upon success returns a scan code,  which may be any positive integer.  For situations where scan codes cannot  be read (for example, when an ASCII terminal is used as the job's  controlling terminal), this function is identical to coninc(), i.e. it  returns an 8-bit character value.  congks() is for use with workstations  whose keyboards have Alternate, Command, Option, and similar modifier keys,  and Function keys that generate codes greater than 255.intcongm()  Console get modes.  Gets the current console terminal modes and saves them   so that conres() can restore them later.  Returns 1 if it got the modes OK,  0 if it did nothing (e.g. because Kermit is not connected with any terminal),  -1 on error.intconinc(timo) int timo;  Console Input Character.  Reads a character from the console.  If the timo  parameter is greater than zero, then coninc() times out and returns -2 if no  character appears within the given number of seconds.  Upon any other kind  of error, returns -1.  Upon success, returns the character itself, with a  value in the range 0-255 decimal.VOIDconint(f,s) SIGTYP (*f)(), (*s)();  *NEW*  Sets the console to generate an interrupt if the user types a keyboard  interrupt character, and to transfer control the signal-handling function f.  For systems with job control, s is the address of the function that suspends  the job.  Sets the global variable "backgrd" to zero if Kermit is running in  the foreground, and to nonzero if Kermit is running in the background.  See ckcdeb.h for the definition of SIGTYP.  No return value.VOIDconnoi()  Console no interrupts.  Disable keyboard interrupts on the console.  No return value.intconoc(c) char c;  Write character c to the console terminal.  Returns:  0 on failure, 1 on success.intconol(s) char *s;  Write string s to the console.  Returns -1 on error, 0 or greater on  success.intconola(s) char *s[]; {  Write an array of strings to the console.  Returns -1 on error, 0 or greater  on success.intconoll(s) char *s;  Write string s to the console, followed by the necessary line termination  characters to put the console cursor at the beginning of the next line.  Returns -1 on error, 0 or greater on success.intconres()  Restore the console terminal to the modes obtained by congm().  Returns:  -1 on error, 0 on success.intconxo(x,s) int x; char *s;  Write x characters from string s to the console.  Returns 0 or greater on  success, -1 on error.char *conkbg();  *NEW*  Returns a pointer to the designator of the console keyboard type.  For example, on a PC, this function would return "88", "101", etc.  Upon failure, returns a pointer to the empty string.B.3 - Communication Device FunctionsThe communication device is the device used for terminal emulation and filetransfer.  It may or may not be the same device as the console, and it mayor may not be a terminal device (it could also be a network device).  Forbrevity, the communication device is referred to here as the "tty".  When thecommunication device is the same as the console device, Kermit is said to bein remote mode.  When the two devices are different, Kermit is in local mode.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -