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

📄 ckcplm.doc

📁 linux终端仿真程序
💻 DOC
📖 第 1 页 / 共 5 页
字号:
intttchk()  Returns the number of characters that have arrived at the communication  device but have not yet been read by ttinc, ttinl, and friends.  If  communication input is buffered (and it should be), this is the sum of the  number of unread characters in Kermit's buffer PLUS the number of unread  characters in the operating system's internal buffer.intttclos()  Closes the communication device (tty or network).  If there were any kind of  exclusive access locks connected with the tty, these are released.  If the  tty has a modem connection, it is hung up.  For true tty devices, the  original tty device modes are restored.  Returns:  -1 on failure.   0 on success.intttflui()  Flush communications input buffer.  If any characters have arrived but have  not yet been read, discard these characters.  If communications input is  buffered by Kermit (and it should be), this function flushes Kermit's buffer  as well as the operating system's internal input buffer.  Returns:  -1 on failure.   0 on success.intttfluo()  *NEW*  Flush tty output buffer.  If any characters have been written but not  actually transmitted (e.g. because the system has been flow-controlled),  remove them from the system's output buffer.  (Note, this function is  not actually used, but it is recommended that all C-Kermit programmers  add it for future use, even if it is only a dummy function that returns 0  always.)intttgmdm()  *NEW*  Looks for the modem signals CTS, DSR, and CTS, and returns those that are  on in as its return value, in a bit mask as described for ttwmdm,  in which a bit is on (1) or off (0) according to whether the corresponding  signal is on (asserted) or off (not asserted).  Return values:  -3 Not implemented  -2 if the line does not have modem control  -1 on error  >= 0 on success, with bit mask containing the modem signals.longttgspd()  *NEW*  Returns the current tty speed in BITS (not CHARACTERS) per second, or -1  if it is not known or if the tty is really a network, or upon any kind of  error.  On success, the speed returned is the actual number of bits per  second, like 1200, 9600, 19200, etc.intttgwsiz()  *NEW*  Get terminal window size.  Returns -1 on error, 0 if the window size can't  be obtained, 1 if the window size has been successfully obtained.  Upon  success, the external global variables tt_rows and tt_cols are set to the  number of screen rows and number of screen columns, respectively.  As this function is not implemented in all ck*tio.c modules, calls to it  must be wrapped in #ifdef CK_TTGWSIZ..#endif.  NOTE: This function must  be available to use the TELNET NAWS feature (Negotiate About Window Size)  as well as Rlogin.inttthang()  Hang up the current tty device.  For real tty devices, turn off DTR for  about 1/3-1/2 second (or other length of time, depending on the system).  If the tty is really a network connection, close it.  Returns:  -1 on failure.   0 if it does not even try to hang up.   1 if it believes it hung up successfully.VOIDttimoff()  *NEW*  Turns off all pending timer interrupts.intttinc(timo) int timo;  *NEW* (function is old, return codes are new)  Reads one character from the communication device.  If timo is greater than  zero, wait the given number of seconds and then time out if no character  arrives, otherwise wait forever for a character.  Returns:  -3 internal error (e.g. tty modes set wrong)  -2 communications disconnect  -1 timeout or other error  >= 0 the character that was read.  It is HIGHLY RECOMMENDED that ttinc() be internally buffered so that calls  to it are relatively inexpensive.  If it is possible to to implement ttinc()  as a macro, all the better, for example something like:  #define ttinc(t) ( (--txbufn >= 0) ? txbuf[ttbufp++] : txbufr(t) )  (see description of txbufr() below)*NEW* (ttinl - 5th arg, requirement not to destroy read-ahead characters)intttinl(dest,max,timo,eol,start) int max,timo; CHAR *dest, eol, start;   ttinl() is Kermit's packet reader.  Reads a packet from the communications  device, or up to max characters, whichever occurs first.  A line is a string  of characters starting with the start character up to and including the  character given in eol.  If timo is greater than zero, then this function  times out if the eol character is not encountered within the given number of  seconds.  The characters that were input are copied into "dest" with their  parity bits stripped if parity is not none.  The first character copied into  dest should be the start character, and the last should be the eol  character, followed by a null (0) character.  Returns the number of  characters read.  Characters after the eol must be available upon the next  call to this function.  (If they are discarded, sliding windows will not  work.)  Optionally, ttinl() can sense the parity of incoming packets.  If it  does this, then it should set the global variable ttprty accordingly.  This  function should be coded to be as efficient as possible, since it is at the  "inner loop" of packet reception.  Returns:   -1 Timeout or other possibly correctable error.   -2 Interrupted from keyboard.   -3 Uncorrectable i/o error -- connection lost, configuration problem, etc.   >= 0 on success, the number of characters that were actually read        and placed in the dest buffer, not counting the trailing null.  NOTE: This description is somewhat obsolete.  To implement "Doomsday  Kermit", ttinl() (at least for UNIX and VMS) has got its fingers even more  deeply into the packet format.  I would like to get rid of this function  entirely, and move all packet-related operations to rpack() where they  belong.  rpack() would simply call ttinc() to get each character.  But  that demands that ttinc() be efficient and fully buffered, going to the  operating system with relative infrequency.  See ttinc() and txbufr().intttoc(c) char c;  Outputs the character c to the communication line.  If the operation fails  to complete within two seconds, this function returns -1.  Otherwise it  returns the number of characters actually written to the tty (0 or 1).  This  function should only be used for interactive, character-mode operations, like  terminal connection, script execution, dialer i/o, where the overhead of the  signals and alarms does not create a bottleneck.  (THIS DESCRIPTION NEEDS  IMPROVEMENT -- If the operation fails within a "certain amount of time"...  which might be dependent on the communication method, speed, etc.  In  particular, flow-control deadlocks must be accounted for and broken out of  to prevent the program from hanging indefinitely, etc.)intttol(s,n) int n; char *s;  Kermit's packet writer.  Writes the first n characters of the "line" pointed  to by s.  NOTE: It is ttol's responsibility to write ALL of the characters,  not just some of them.  Returns:  -1 on a possibly correctable error (so it can be retried).  -3 on a fatal error, e.g. connection lost.  >= 0 on success, the actual number of characters written (the specific     number is not actually used for anything).*NEW* (ttopen - negative value for modem = network, new timeout feature)intttopen(ttname,lcl,modem,timo) char *ttname; int *lcl, modem, timo;  Opens a tty device, if it is not already open.  ttopen must check to make  sure the SAME device is not already open; if it is, ttopen returns   successfully without doing anything.  If a DIFFERENT device is currently  open, ttopen() must call ttclos() to close it before opening the new one.Parameters:    ttname: character string - device name or network host name.    lcl:   If called with lcl < 0, sets value of lcl as follows:      0: the terminal named by ttname is the job's controlling terminal.      1: the terminal named by ttname is not the job's controlling terminal.      If the line is already open, or if the requested line can't      be opened, then lcl remains (and is returned as) -1.    modem:      Less than zero: this is the negative of the network type,      and ttname is a network host name.  Network types (from ckcnet.h):        NET_TCPB 1   TCP/IP Berkeley (socket)  (implemented in ckutio.c)        NET_TCPA 2   TCP/IP AT&T (streams)     (not yet implemented)        NET_DEC  3   DECnet                    (not yet implemented)      Zero or greater: ttname is a terminal device name.          Zero means a direct connection (don't use modem signals).      Positive means use modem signals depending on the current setting      of ttcarr ( see ttscarr() ).    timo:      > 0: number of seconds to wait for open() to return before timing out.      <=0: no timer, wait forever (e.g. for incoming call).    For real tty devices, ttopen() attempts to gain exclusive access to the    tty device, for example in UNIX by creating a "lockfile" (in other    operating systems, like VMS, exclusive access probably requires no special    action).  Side effects:    Copies its arguments and the tty file descriptor to global variables that    are available to the other tty-related functions, with the lcl value    altered as described above.   Gets all parameters and settings associated    with the line and puts them in a global area, so that they can be restored    by ttres(), e.g. when the device is closed.  Returns:    0 on success   -5 if device is in use   -4 if access to device is denied   -3 if access to lock mechanism denied   -2 upon timeout waiting for device to open   -1 on other errorintttpkt(speed,flow,parity) long speed; int flow, parity;  Puts the currently open tty device into the appropriate modes for  transmitting Kermit packets.  The arguments are interpreted as follows:  speed: if speed > -1, and the device is a true tty device, and Kermit is in         local mode, ttpkt also sets the speed.  flow:  if in the range 0-3, ttpkt selects the corresponding type of flow         control.  Currently 0 is defined as no flow control, 1 is Xon/Xoff,         and no other types are defined.  If (and this is a horrible hack, but         it goes back many years and will be hard to eradicate) flow is 4,         then the appropriate tty modes are set for modem dialing, a special         case in which we talk to a modem-controlled line without requiring         carrier.  If flow is 5, then we require carrier.  parity:  This is simply copied into a global variable so that other         functions (like ttinl, ttinc, etc) can use it.  Side effects: Copies its arguments to global variables, flushes the terminal         device input buffer.    Returns:   -1 on error.    0 on success.intttsetflow(int)  Enables the given type of flow control on the open serial communications  device immediately.  Returns 0 on success, -1 on failure.  This definition added 6 Sep 96.intttres()  Restores the tty device to the modes and settings that were in effect at  the time it was opened (see ttopen).  Returns:  -1 on error.   0 on success.intttruncmd(string) char * string; *NEW*  Runs the given command on the local system, but redirects its input and  output to the communication (SET LINE, SET PORT, or SET HOST) device.  Returns 1 on success, 0 on failure.intttscarr(carrier) int carrier;  *NEW*  Copies its argument to a variable that is global to the other tty-related  functions, and then returns it.  The values for carrier are defined in  ckcdeb.h: CAR_ON, CAR_OFF, CAR_AUTO.  ttopen(), ttpkt(), and ttvt() use this  variable when deciding how to open the tty device and what modes to select.  The meanings are these:  CAR_OFF:  Ignore carrier at all times.  CAR_ON:   Require carrier at all times, except when dialing.            This means, for example, that ttopen() could hang forever waiting             for carrier if it is not present.  CAR_AUTO: If the modem type is zero (i.e. the connection is direct), this            is the same as CAR_OFF.  If the modem type is positive, then heed            carrier during CONNECT (ttvt mode), but ignore it at other times            (packet mode, during SET LINE, etc).  Compatible with pre-5A            versions of C-Kermit.  This should be the default carrier mode.  Kermit's DIAL command ignores the carrier setting, but ttopen(), ttvt(), and  ttpkt() all honor the carrier option in effect at the time they are called.  None of this applies to remote mode (the tty device is the job's controlling  terminal) or to network host connections (modem type is negative).intttsndb()  Send a BREAK signal on the tty device.  On a real tty device, send a real  BREAK lasting approximately 275 milliseconds.  If this is not possible,  simulate a BREAK by (for example) dropping down some very low baud rate,  like 50, and sending a bunch of null characters.  On a network connection,  do the appropriate network protocol for BREAK.  Returns:  -1 on error.   0 on success.intttsndlb() *NEW*  Like ttsndb(), but sends a "Long BREAK" (approx 1.5 seconds).  For network connections, it is identical to ttsndb().  Currently, this function is used only if CK_LBRK is defined (as it is  for UNIX and VAX/VMS).intttsspd(cps) int cps;  *NEW* (argument is now cps instead of bps)  For real tty devices only, set the device transmission speed to (note  carefully) TEN TIMES the argument.  The argument is in characters per  second, but transmission speeds are in bits per second.  cps are used rather  than bps because high speeds like 38400 are not expressible in a 16-bit int  but longs cannot be used because keyword-table values are ints and not longs.  If the argument is 7, then the bps is 75, not 70.  If the argument is 888,  this is a special code for 75/1200 split-speed operation (75 bps out, 1200  bps in).  Returns:  -1 on error, meaning the requested speed is not valid or available.  >= 0 on success (don't try to use this value for anything).intttvt(speed,flow) long speed; int flow;

⌨️ 快捷键说明

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