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

📄 termcap.texi

📁 linux下bash的源码
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
\input texinfo  @c -*-texinfo-*-@setfilename termcap@settitle The Termcap Library@smallbook@ifinfoThis file documents the termcap library of the GNU system.Copyright (C) 1988 Free Software Foundation, Inc.Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.@ignorePermission is granted to process this file through TeX and print theresults, provided the printed document carries copying permissionnotice identical to this one except for the removal of this paragraph(this paragraph not being relevant to the printed manual).@end ignorePermission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that the entireresulting derived work is distributed under the terms of a permissionnotice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions,except that this permission notice may be stated in a translation approvedby the Foundation.@end ifinfo@setchapternewpage odd@c @shorttitlepage The Termcap Manual@titlepage@ignore@sp 6@center @titlefont{Termcap}@sp 1@center The Termcap Library and Data Base@sp 4@center Second Edition@sp 1@center December 1992@sp 5@center Richard M. Stallman@sp 1@center Free Software Foundation@end ignore@c Real title page@title The Termcap Manual@subtitle The Termcap Library and Data Base@subtitle Second Edition@subtitle December 1992@author Richard M. Stallman@page@vskip 0pt plus 1filllCopyright @copyright{} 1988 Free Software Foundation, Inc.Published by the Free Software Foundation(675 Mass Ave, Cambridge MA 02139).Printed copies are available for $10 each.Permission is granted to make and distribute verbatim copies ofthis manual provided the copyright notice and this permission noticeare preserved on all copies.Permission is granted to copy and distribute modified versions of thismanual under the conditions for verbatim copying, provided that the entireresulting derived work is distributed under the terms of a permissionnotice identical to this one.Permission is granted to copy and distribute translations of this manualinto another language, under the above conditions for modified versions,except that this permission notice may be stated in a translation approvedby the Foundation.@sp 2Cover art by Etienne Suvasa.@end titlepage@page@synindex vr fn@node Top, Introduction, (dir), (dir)@menu* Introduction::  What is termcap?  Why this manual?* Library::     The termcap library functions.* Data Base::   What terminal descriptions in @file{/etc/termcap} look like.* Capabilities::  Definitions of the individual terminal capabilities:                 how to write them in descriptions, and how to use                 their values to do display updating.* Summary::     Brief table of capability names and their meanings.* Var Index::   Index of C functions and variables.* Cap Index::   Index of termcap capabilities.* Index::       Concept index. --- The Detailed Node Listing ---The Termcap Library* Preparation::  Preparing to use the termcap library.* Find::        Finding the description of the terminal being used.* Interrogate::  Interrogating the description for particular capabilities.* Initialize::  Initialization for output using termcap.* Padding::     Outputting padding.* Parameters::  Encoding parameters such as cursor positions.Padding* Why Pad::     Explanation of padding.* Not Enough::  When there is not enough padding.* Describe Padding::  The data base says how much padding a terminal needs.* Output Padding::    Using @code{tputs} to output the needed padding.Filling In Parameters* Encode Parameters::  The language for encoding parameters.* Using Parameters::   Outputting a string command with parameters.Sending Display Commands with Parameters* tparam::      The general case, for GNU termcap only.* tgoto::       The special case of cursor motion.The Format of the Data Base* Format::      Overall format of a terminal description.* Capability Format::  Format of capabilities within a description.* Naming::      Naming conventions for terminal types.* Inheriting::  Inheriting part of a description froma related terminal type.* Changing::    When changes in the data base take effect.Definitions of the Terminal Capabilities* Basic::       Basic characteristics.* Screen Size::  Screen size, and what happens when it changes.* Cursor Motion::  Various ways to move the cursor.* Wrapping::    What happens if you write a character in the last column.* Scrolling::   Pushing text up and down on the screen.* Windows::     Limiting the part of the window that output affects.* Clearing::    Erasing one or many lines.* Insdel Line::  Making new blank lines in mid-screen; deleting lines.* Insdel Char::  Inserting and deleting characters within a line.* Standout::    Highlighting some of the text.* Underlining::  Underlining some of the text.* Cursor Visibility::  Making the cursor more or less easy to spot.* Bell::        Attracts user's attention; not localized on the screen.* Keypad::      Recognizing when function keys or arrows are typed.* Meta Key::    @key{META} acts like an extra shift key.* Initialization::  Commands used to initialize or reset the terminal.* Pad Specs::   Info for the kernel on how much padding is needed.* Status Line::  A status line displays ``background'' information.* Half-Line::   Moving by half-lines, for superscripts and subscripts.* Printer::     Controlling auxiliary printers of display terminals.@end menu@node Introduction, Library, Top, Top@unnumbered Introduction@cindex termcap@dfn{Termcap} is a library and data base that enables programs to usedisplay terminals in a terminal-independent manner.  It originated inBerkeley Unix.The termcap data base describes the capabilities of hundreds of differentdisplay terminals in great detail.  Some examples of the informationrecorded for a terminal could include how many columns wide it is, whatstring to send to move the cursor to an arbitrary position (including howto encode the row and column numbers), how to scroll the screen up one orseveral lines, and how much padding is needed for such a scrollingoperation.The termcap library is provided for easy access this data base in programsthat want to do terminal-independent character-based display output.This manual describes the GNU version of the termcap library, which hassome extensions over the Unix version.  All the extensions are identifiedas such, so this manual also tells you how to use the Unix termcap.The GNU version of the termcap library is available free as source code,for use in free programs, and runs on Unix and VMS systems (at least).  Youcan find it in the GNU Emacs distribution in the files @file{termcap.c} and@file{tparam.c}.This manual was written for the GNU project, whose goal is to develop acomplete free operating system upward-compatible with Unix for userprograms.  The project is approximately two thirds complete.  For moreinformation on the GNU project, including the GNU Emacs editor and themostly-portable optimizing C compiler, send one dollar to@displayFree Software Foundation675 Mass AveCambridge, MA 02139@end display@node Library, Data Base, Introduction, Top@chapter The Termcap LibraryThe termcap library is the application programmer's interface to thetermcap data base.  It contains functions for the following purposes:@itemize @bullet@itemFinding the description of the user's terminal type (@code{tgetent}).@itemInterrogating the description for information on various topics(@code{tgetnum}, @code{tgetflag}, @code{tgetstr}).@itemComputing and performing padding (@code{tputs}).@itemEncoding numeric parameters such as cursor positions into theterminal-specific form required for display commands (@code{tparam},@code{tgoto}).@end itemize@menu* Preparation::  Preparing to use the termcap library.* Find::        Finding the description of the terminal being used.* Interrogate::  Interrogating the description for particular capabilities.* Initialize::  Initialization for output using termcap.* Padding::     Outputting padding.* Parameters::  Encoding parameters such as cursor positions.@end menu@node Preparation, Find,  , Library@section Preparing to Use the Termcap LibraryTo use the termcap library in a program, you need two kinds of preparation:@itemize @bullet@itemThe compiler needs declarations of the functions and variables in thelibrary.On GNU systems, it suffices to include the header file@file{termcap.h} in each source file that uses these functions andvariables.@refillOn Unix systems, there is often no such header file.  Then you mustexplictly declare the variables as external.  You can do likewise forthe functions, or let them be implicitly declared and cast theirvalues from type @code{int} to the appropriate type.We illustrate the declarations of the individual termcap libraryfunctions with ANSI C prototypes because they show how to pass thearguments.  If you are not using the GNU C compiler, you probablycannot use function prototypes, so omit the argument types and namesfrom your declarations.@itemThe linker needs to search the library.  Usually either@samp{-ltermcap} or @samp{-ltermlib} as an argument when linking willdo this.@refill@end itemize@node Find, Interrogate, Preparation, Library@section Finding a Terminal Description: @code{tgetent}@findex tgetentAn application program that is going to use termcap must first look up thedescription of the terminal type in use.  This is done by calling@code{tgetent}, whose declaration in ANSI Standard C looks like:@exampleint tgetent (char *@var{buffer}, char *@var{termtype});@end example@noindentThis function finds the description and remembers it internally so thatyou can interrogate it about specific terminal capabilities(@pxref{Interrogate}).The argument @var{termtype} is a string which is the name for the type ofterminal to look up.  Usually you would obtain this from the environmentvariable @code{TERM} using @code{getenv ("TERM")}.If you are using the GNU version of termcap, you can alternatively ask@code{tgetent} to allocate enough space.  Pass a null pointer for@var{buffer}, and @code{tgetent} itself allocates the storage using@code{malloc}.  In this case the returned value on success is the addressof the storage, cast to @code{int}.  But normally there is no need for youto look at the address.  Do not free the storage yourself.@refillWith the Unix version of termcap, you must allocate space for thedescription yourself and pass the address of the space as the argument@var{buffer}.  There is no way you can tell how much space is needed, sothe convention is to allocate a buffer 2048 characters long and assume thatis enough.  (Formerly the convention was to allocate 1024 characters andassume that was enough.  But one day, for one kind of terminal, that wasnot enough.)No matter how the space to store the description has been obtained,termcap records its address internally for use when you later interrogatethe description with @code{tgetnum}, @code{tgetstr} or @code{tgetflag}.  Ifthe buffer was allocated by termcap, it will be freed by termcap too if youcall @code{tgetent} again.  If the buffer was provided by you, you mustmake sure that its contents remain unchanged for as long as you still planto interrogate the description.@refillThe return value of @code{tgetent} is @minus{}1 if there is some difficultyaccessing the data base of terminal types, 0 if the data base is accessiblebut the specified type is not defined in it, and some other valueotherwise.

⌨️ 快捷键说明

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