📄 curs_terminfo.3x.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"><!-- **************************************************************************** * Copyright (c) 1999-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * **************************************************************************** * @Id: curs_terminfo.3x,v 1.18 2003/12/27 18:48:59 tom Exp @--><HTML><HEAD><TITLE>curs_terminfo 3x</TITLE><link rev=made href="mailto:bug-ncurses@gnu.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD><BODY><H1>curs_terminfo 3x</H1><HR><PRE><!-- Manpage converted by man2html 3.0.1 --><STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG> <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG></PRE><H2>NAME</H2><PRE> <STRONG>del_curterm</STRONG>, <STRONG>mvcur</STRONG>, <STRONG>putp</STRONG>, <STRONG>restartterm</STRONG>, <STRONG>set_curterm</STRONG>, <STRONG>set-</STRONG> <STRONG>term</STRONG>, <STRONG>setupterm</STRONG>, <STRONG>tigetflag</STRONG>, <STRONG>tigetnum</STRONG>, <STRONG>tigetstr</STRONG>, <STRONG>tparm</STRONG>, <STRONG>tputs</STRONG>, <STRONG>vid_attr</STRONG>, <STRONG>vid_puts</STRONG>, <STRONG>vidattr</STRONG>, <STRONG>vidputs</STRONG> - <STRONG>curses</STRONG> interfaces to terminfo database</PRE><H2>SYNOPSIS</H2><PRE> <STRONG>#include</STRONG> <STRONG><curses.h></STRONG> <STRONG>#include</STRONG> <STRONG><term.h></STRONG> <STRONG>int</STRONG> <STRONG>setupterm(char</STRONG> <STRONG>*</STRONG><EM>term</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>fildes</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>errret</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>setterm(char</STRONG> <STRONG>*</STRONG><EM>term</EM><STRONG>);</STRONG> <STRONG>TERMINAL</STRONG> <STRONG>*set_curterm(TERMINAL</STRONG> <STRONG>*</STRONG><EM>nterm</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>del_curterm(TERMINAL</STRONG> <STRONG>*</STRONG><EM>oterm</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>restartterm(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>term</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>fildes</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>*</STRONG><EM>errret</EM><STRONG>);</STRONG> <STRONG>char</STRONG> <STRONG>*tparm(char</STRONG> <STRONG>*</STRONG><EM>str</EM><STRONG>,</STRONG> <STRONG>...);</STRONG> <STRONG>int</STRONG> <STRONG>tputs(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>str</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>affcnt</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG> <STRONG>int</STRONG> <STRONG>putp(const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>str</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>vidputs(chtype</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(int));</STRONG> <STRONG>int</STRONG> <STRONG>vidattr(chtype</STRONG> <EM>attrs</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>vid_puts(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <STRONG>(*</STRONG><EM>putc</EM><STRONG>)(char));</STRONG> <STRONG>int</STRONG> <STRONG>vid_attr(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG><EM>opts</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>mvcur(int</STRONG> <EM>oldrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>oldcol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>newrow</EM>, int <EM>newcol</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>tigetflag(char</STRONG> <STRONG>*</STRONG><EM>capname</EM><STRONG>);</STRONG> <STRONG>int</STRONG> <STRONG>tigetnum(char</STRONG> <STRONG>*</STRONG><EM>capname</EM><STRONG>);</STRONG> <STRONG>char</STRONG> <STRONG>*tigetstr(char</STRONG> <STRONG>*</STRONG><EM>capname</EM><STRONG>);</STRONG></PRE><H2>DESCRIPTION</H2><PRE> These low-level routines must be called by programs that have to deal directly with the <STRONG>terminfo</STRONG> database to handle certain terminal capabilities, such as programming func- tion keys. For all other functionality, <STRONG>curses</STRONG> routines are more suitable and their use is recommended. Initially, <STRONG>setupterm</STRONG> should be called. Note that <STRONG>setupterm</STRONG> is automatically called by <STRONG>initscr</STRONG> and <STRONG>newterm</STRONG>. This defines the set of terminal-dependent variables [listed in <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>]. The <STRONG>terminfo</STRONG> variables <STRONG>lines</STRONG> and <STRONG>columns</STRONG> are initialized by <STRONG>setupterm</STRONG> as follows: If <STRONG>use_env(FALSE)</STRONG> has been called, values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in <STRONG>terminfo</STRONG> are used. Otherwise, if the environment variables <STRONG>LINES</STRONG> and <STRONG>COLUMNS</STRONG> exist, their val- ues are used. If these environment variables do not exist and the program is running in a window, the current window size is used. Otherwise, if the environment variables do not exist, the values for <STRONG>lines</STRONG> and <STRONG>columns</STRONG> specified in the <STRONG>terminfo</STRONG> database are used. The header files <STRONG>curses.h</STRONG> and <STRONG>term.h</STRONG> should be included (in this order) to get the definitions for these strings, numbers, and flags. Parameterized strings should be passed through <STRONG>tparm</STRONG> to instantiate them. All <STRONG>terminfo</STRONG> strings [including the output of <STRONG>tparm</STRONG>] should be printed with <STRONG>tputs</STRONG> or <STRONG>putp</STRONG>. Call the <STRONG>reset_shell_mode</STRONG> to restore the tty modes before exiting [see <STRONG><A HREF="curs_kernel.3x.html">curs_kernel(3x)</A></STRONG>]. Pro- grams which use cursor addressing should output <STRONG>enter_ca_mode</STRONG> upon startup and should output <STRONG>exit_ca_mode</STRONG> before exiting. Programs desiring shell escapes should call <STRONG>reset_shell_mode</STRONG> and output <STRONG>exit_ca_mode</STRONG> before the shell is called and should output <STRONG>enter_ca_mode</STRONG> and call <STRONG>reset_prog_mode</STRONG> after returning from the shell. The <STRONG>setupterm</STRONG> routine reads in the <STRONG>terminfo</STRONG> database, ini- tializing the <STRONG>terminfo</STRONG> structures, but does not set up the output virtualization structures used by <STRONG>curses</STRONG>. The ter- minal type is the character string <EM>term</EM>; if <EM>term</EM> is null, the environment variable <STRONG>TERM</STRONG> is used. All output is to file descriptor <STRONG>fildes</STRONG> which is initialized for output. If <EM>errret</EM> is not null, then <STRONG>setupterm</STRONG> returns <STRONG>OK</STRONG> or <STRONG>ERR</STRONG> and stores a status value in the integer pointed to by <EM>errret</EM>. A return value of <STRONG>OK</STRONG> combined with status of <STRONG>1</STRONG> in <EM>errret</EM> is normal. If <STRONG>ERR</STRONG> is returned, examine <EM>errret</EM>: <STRONG>1</STRONG> means that the terminal is hardcopy, cannot be used for curses applications. <STRONG>0</STRONG> means that the terminal could not be found, or that it is a generic type, having too little information for curses applications to run. <STRONG>-1</STRONG> means that the <STRONG>terminfo</STRONG> database could not be found. If <EM>errret</EM> is null, <STRONG>setupterm</STRONG> prints an error message upon finding an error and exits. Thus, the simplest call is: <STRONG>setupterm((char</STRONG> <STRONG>*)0,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0);</STRONG>, which uses all the defaults and sends the output to <STRONG>std-</STRONG> <STRONG>out</STRONG>. The <STRONG>setterm</STRONG> routine is being replaced by <STRONG>setupterm</STRONG>. The call: <STRONG>setupterm(</STRONG><EM>term</EM><STRONG>,</STRONG> <STRONG>1,</STRONG> <STRONG>(int</STRONG> <STRONG>*)0)</STRONG> provides the same functionality as <STRONG>setterm(</STRONG><EM>term</EM><STRONG>)</STRONG>. The <STRONG>setterm</STRONG> routine is included here for BSD compatibility, and is not recommended for new programs. The <STRONG>set_curterm</STRONG> routine sets the variable <STRONG>cur_term</STRONG> to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -