{
    "mode": "man",
    "parameter": "terminfo",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/terminfo/5/json",
    "generated": "2026-05-30T04:01:25Z",
    "synopsis": "/etc/terminfo/*/*",
    "sections": {
        "NAME": {
            "content": "terminfo - terminal capability database\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "/etc/terminfo/*/*\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Terminfo is a database describing terminals, used by screen-oriented programs such as nvi(1),\nlynx(1), mutt(1), and other curses applications, using high-level calls to libraries such  as\nncurses(3NCURSES).   It is also used via low-level calls by non-curses applications which may\nbe screen-oriented (such as clear(1)) or non-screen (such as tabs(1)).\n\nTerminfo describes terminals by giving a set of capabilities which they have,  by  specifying\nhow  to  perform screen operations, and by specifying padding requirements and initialization\nsequences.\n\nThis manual describes ncurses version 6.3 (patch 20211021).\n",
            "subsections": [
                {
                    "name": "Terminfo Entry Syntax",
                    "content": "Entries in terminfo consist of a sequence of fields:\n\n•   Each field ends with a comma “,” (embedded commas may be  escaped  with  a  backslash  or\nwritten as “\\054”).\n\n•   White space between fields is ignored.\n\n•   The first field in a terminfo entry begins in the first column.\n\n•   Newlines  and  leading whitespace (spaces or tabs) may be used for formatting entries for\nreadability.  These are removed from parsed entries.\n\nThe infocmp -f and -W options rely on this to format if-then-else expressions, or to  en‐\nforce  maximum  line-width.   The resulting formatted terminal description can be read by\ntic.\n\n•   The first field for each terminal gives the names which are known for the terminal, sepa‐\nrated by “|” characters.\n\nThe first name given is the most common abbreviation for the terminal (its primary name),\nthe last name given should be a long name  fully  identifying  the  terminal  (see  long‐‐\nname(3X)),  and  all  others  are  treated as synonyms (aliases) for the primary terminal\nname.\n\nX/Open Curses advises that all names but the last should be in lower case and contain  no\nblanks; the last name may well contain upper case and blanks for readability.\n\nThis  implementation  is  not  so  strict;  it  allows mixed case in the primary name and\naliases.  If the last name has no embedded blanks, it allows that to be both an alias and\na verbose name (but will warn about this ambiguity).\n\n•   Lines beginning with a “#” in the first column are treated as comments.\n\nWhile  comment  lines  are  legal  at  any  point,  the output of captoinfo and infotocap\n(aliases for tic) will move comments so they occur only between entries.\n\nTerminal names (except for the last, verbose entry) should be chosen using the following con‐\nventions.   The  particular piece of hardware making up the terminal should have a root name,\nthus “hp2621”.  This name should not contain hyphens.  Modes that the hardware can be in,  or\nuser preferences, should be indicated by appending a hyphen and a mode suffix.  Thus, a vt100\nin 132-column mode would be vt100-w.  The following suffixes should be used where possible:\n\nSuffix                  Meaning                   Example\n-nn      Number of lines on the screen            aaa-60\n-np      Number of pages of memory                c100-4p\n-am      With automargins (usually the default)   vt100-am\n-m       Mono mode; suppress color                ansi-m\n-mc      Magic cookie; spaces when highlighting   wy30-mc\n-na      No arrow keys (leave them in local)      c100-na\n-nam     Without automatic margins                vt100-nam\n-nl      No status line                           att4415-nl\n-ns      No status line                           hp2626-ns\n-rv      Reverse video                            c100-rv\n-s       Enable status line                       vt100-s\n-vb      Use visible bell instead of beep         wy370-vb\n-w       Wide mode (> 80 columns, usually 132)    vt100-w\n\nFor more on terminal naming conventions, see the term(7) manual page.\n"
                },
                {
                    "name": "Terminfo Capabilities Syntax",
                    "content": "The terminfo entry consists of several capabilities, i.e., features that the terminal has, or\nmethods for exercising the terminal's features.\n\nAfter the first field (giving the name(s) of the terminal entry), there should be one or more\ncapability fields.  These are boolean, numeric or string names with corresponding values:\n\n•   Boolean capabilities are true when present, false when  absent.   There  is  no  explicit\nvalue for boolean capabilities.\n\n•   Numeric  capabilities  have  a  “#”  following the name, then an unsigned decimal integer\nvalue.\n\n•   String capabilities have a “=” following the name, then an string of characters making up\nthe capability value.\n\nString  capabilities  can  be  split into multiple lines, just as the fields comprising a\nterminal entry can be split into multiple lines.  While blanks  between  fields  are  ig‐\nnored, blanks embedded within a string value are retained, except for leading blanks on a\nline.\n\nAny capability can be canceled, i.e., suppressed from the terminal entry,  by  following  its\nname with “@” rather than a capability value.\n"
                },
                {
                    "name": "Similar Terminals",
                    "content": "If  there are two very similar terminals, one (the variant) can be defined as being just like\nthe other (the base) with certain exceptions.  In the definition of the variant,  the  string\ncapability use can be given with the name of the base terminal:\n\n•   The capabilities given before use override those in the base type named by use.\n\n•   If  there  are multiple use capabilities, they are merged in reverse order.  That is, the\nrightmost use reference is processed first, then the one to its left, and so forth.\n\n•   Capabilities given explicitly in the entry override those brought in by use references.\n\nA capability can be canceled by placing xx@ to the left of the use reference that imports it,\nwhere xx is the capability.  For example, the entry\n\n2621-nl, smkx@, rmkx@, use=2621,\n\ndefines  a  2621-nl that does not have the smkx or rmkx capabilities, and hence does not turn\non the function key labels when in visual mode.  This is useful for  different  modes  for  a\nterminal, or for different user preferences.\n\nAn entry included via use can contain canceled capabilities, which have the same effect as if\nthose cancels were inline in the using terminal entry.\n"
                },
                {
                    "name": "Predefined Capabilities",
                    "content": "The following is a complete table of the capabilities  included  in  a  terminfo  description\nblock and available to terminfo-using code.  In each line of the table,\n\nThe  variable  is the name by which the programmer (at the terminfo level) accesses the capa‐\nbility.\n\nThe capname is the short name used in the text of the database, and is used by a  person  up‐\ndating  the database.  Whenever possible, capnames are chosen to be the same as or similar to\nthe ANSI X3.64-1979 standard (now superseded by ECMA-48, which uses identical or very similar\nnames).  Semantics are also intended to match those of the specification.\n\nThe  termcap  code  is  the  old termcap capability name (some capabilities are new, and have\nnames which termcap did not originate).\n\nCapability names have no hard length limit, but an informal limit of 5  characters  has  been\nadopted to keep them short and to allow the tabs in the source file Caps to line up nicely.\n\nFinally,  the  description field attempts to convey the semantics of the capability.  You may\nfind some codes in the description field:\n\n(P)    indicates that padding may be specified\n\n#[1-9] in the description field indicates that the string is passed  through  tparm(3X)  with\nparameters as given (#i).\n\nIf  no  parameters are listed in the description, passing the string through tparm(3X)\nmay give unexpected results, e.g., if it contains percent (%%) signs.\n\n(P*)   indicates that padding may vary in proportion to the number of lines affected\n\n(#i)   indicates the ith parameter.\n\n\nThese are the boolean capabilities:\n\n\nVariable            Cap-      TCap       Description\nBooleans            name      Code\nautoleftmargin            bw        bw     cub1 wraps from col‐\numn 0 to last column\nautorightmargin           am        am     terminal has auto‐\nmatic margins\nbackcolorerase            bce       ut     screen erased with\nbackground color\ncanchange                  ccc       cc     terminal can re-de‐\nfine existing colors\nceolstandoutglitch        xhp       xs     standout not erased\nby overwriting (hp)\ncoladdrglitch             xhpa      YA     only positive motion\nfor hpa/mhpa caps\ncpichangesres             cpix      YF     changing character\npitch changes reso‐\nlution\ncrcancelsmicromode       crxm      YB     using cr turns off\nmicro mode\ndesttabsmagicsmso        xt        xt     tabs destructive,\nmagic so char\n(t1061)\neatnewlineglitch          xenl      xn     newline ignored af‐\nter 80 cols (con‐\ncept)\neraseoverstrike            eo        eo     can erase over‐\nstrikes with a blank\ngenerictype                gn        gn     generic line type\nhardcopy                   hc        hc     hardcopy terminal\nhardcursor                 chts      HC     cursor is hard to\nsee\n\n\nhasmetakey                km        km     Has a meta key\n(i.e., sets 8th-bit)\nhasprintwheel             daisy     YC     printer needs opera‐\ntor to change char‐\nacter set\nhasstatusline             hs        hs     has extra status\nline\nhuelightnesssaturation    hls       hl     terminal uses only\nHLS color notation\n(Tektronix)\ninsertnullglitch          in        in     insert mode distin‐\nguishes nulls\nlpichangesres             lpix      YG     changing line pitch\nchanges resolution\nmemoryabove                da        da     display may be re‐\ntained above the\nscreen\nmemorybelow                db        db     display may be re‐\ntained below the\nscreen\nmoveinsertmode            mir       mi     safe to move while\nin insert mode\nmovestandoutmode          msgr      ms     safe to move while\nin standout mode\nneedsxonxoff              nxon      nx     padding will not\nwork, xon/xoff re‐\nquired\nnoescctlc                 xsb       xb     beehive (f1=escape,\nf2=ctrl C)\nnopadchar                 npc       NP     pad character does\nnot exist\nnondestscrollregion      ndscr     ND     scrolling region is\nnon-destructive\nnonrevrmcup               nrrmc     NR     smcup does not re‐\nverse rmcup\noverstrike                 os        os     terminal can over‐\nstrike\nprtrsilent                 mc5i      5i     printer will not\necho on screen\nrowaddrglitch             xvpa      YD     only positive motion\nfor vpa/mvpa caps\nsemiautorightmargin      sam       YE     printing in last\ncolumn causes cr\nstatuslineescok          eslok     es     escape can be used\non the status line\ntildeglitch                hz        hz     cannot print ~'s\n(Hazeltine)\ntransparentunderline       ul        ul     underline character\noverstrikes\nxonxoff                    xon       xo     terminal uses\nxon/xoff handshaking\n\nThese are the numeric capabilities:\n\n\nVariable            Cap-      TCap       Description\nNumeric            name      Code\ncolumns                     cols      co     number of columns in\na line\ninittabs                   it        it     tabs initially every\n# spaces\nlabelheight                lh        lh     rows in each label\nlabelwidth                 lw        lw     columns in each la‐\nbel\nlines                       lines     li     number of lines on\nscreen or page\n\nlinesofmemory             lm        lm     lines of memory if >\nline. 0 means varies\nmagiccookieglitch         xmc       sg     number of blank\ncharacters left by\nsmso or rmso\nmaxattributes              ma        ma     maximum combined at‐\ntributes terminal\ncan handle\nmaxcolors                  colors    Co     maximum number of\ncolors on screen\nmaxpairs                   pairs     pa     maximum number of\ncolor-pairs on the\nscreen\nmaximumwindows             wnum      MW     maximum number of\ndefinable windows\nnocolorvideo              ncv       NC     video attributes\nthat cannot be used\nwith colors\nnumlabels                  nlab      Nl     number of labels on\nscreen\npaddingbaudrate           pb        pb     lowest baud rate\nwhere padding needed\nvirtualterminal            vt        vt     virtual terminal\nnumber (CB/unix)\nwidthstatusline           wsl       ws     number of columns in\nstatus line\n\nThe following numeric capabilities are present in the SVr4.0 term structure, but are not  yet\ndocumented in the man page.  They came in with SVr4's printer support.\n\n\nVariable            Cap-      TCap       Description\nNumeric            name      Code\nbitimageentwining         bitwin    Yo     number of passes for\neach bit-image row\nbitimagetype              bitype    Yp     type of bit-image\ndevice\nbuffercapacity             bufsz     Ya     numbers of bytes\nbuffered before\nprinting\nbuttons                     btns      BT     number of buttons on\nmouse\ndothorzspacing            spinh     Yc     spacing of dots hor‐\nizontally in dots\nper inch\ndotvertspacing            spinv     Yb     spacing of pins ver‐\ntically in pins per\ninch\nmaxmicroaddress           maddr     Yd     maximum value in mi‐\ncro...address\nmaxmicrojump              mjump     Ye     maximum value in\nparm...micro\nmicrocolsize              mcs       Yf     character step size\nwhen in micro mode\nmicrolinesize             mls       Yg     line step size when\nin micro mode\nnumberofpins              npins     Yh     numbers of pins in\nprint-head\noutputreschar             orc       Yi     horizontal resolu‐\ntion in units per\nline\noutputreshorzinch        orhi      Yk     horizontal resolu‐\ntion in units per\ninch\noutputresline             orl       Yj     vertical resolution\nin units per line\n\noutputresvertinch        orvi      Yl     vertical resolution\nin units per inch\nprintrate                  cps       Ym     print rate in char‐\nacters per second\nwidecharsize              widcs     Yn     character step size\nwhen in double wide\nmode\n\nThese are the string capabilities:\n\n\nVariable            Cap-      TCap       Description\nString             name      Code\nacschars                   acsc      ac     graphics charset\npairs, based on\nvt100\nbacktab                    cbt       bt     back tab (P)\nbell                        bel       bl     audible signal\n(bell) (P)\ncarriagereturn             cr        cr     carriage return (P*)\n(P*)\nchangecharpitch           cpi       ZA     Change number of\ncharacters per inch\nto #1\nchangelinepitch           lpi       ZB     Change number of\nlines per inch to #1\nchangereshorz             chr       ZC     Change horizontal\nresolution to #1\nchangeresvert             cvr       ZD     Change vertical res‐\nolution to #1\nchangescrollregion        csr       cs     change region to\nline #1 to line #2\n(P)\ncharpadding                rmp       rP     like ip but when in\ninsert mode\nclearalltabs              tbc       ct     clear all tab stops\n(P)\nclearmargins               mgc       MC     clear right and left\nsoft margins\nclearscreen                clear     cl     clear screen and\nhome cursor (P*)\nclrbol                     el1       cb     Clear to beginning\nof line\nclreol                     el        ce     clear to end of line\n(P)\nclreos                     ed        cd     clear to end of\nscreen (P*)\ncolumnaddress              hpa       ch     horizontal position\n#1, absolute (P)\ncommandcharacter           cmdch     CC     terminal settable\ncmd character in\nprototype !?\ncreatewindow               cwin      CW     define a window #1\nfrom #2,#3 to #4,#5\ncursoraddress              cup       cm     move to row #1 col‐\numns #2\ncursordown                 cud1      do     down one line\ncursorhome                 home      ho     home cursor (if no\ncup)\ncursorinvisible            civis     vi     make cursor invisi‐\nble\ncursorleft                 cub1      le     move left one space\ncursormemaddress          mrcup     CM     memory relative cur‐\nsor addressing, move\nto row #1 columns #2\n\n\ncursornormal               cnorm     ve     make cursor appear\nnormal (undo\ncivis/cvvis)\ncursorright                cuf1      nd     non-destructive\nspace (move right\none space)\ncursortoll                ll        ll     last line, first\ncolumn (if no cup)\ncursorup                   cuu1      up     up one line\ncursorvisible              cvvis     vs     make cursor very\nvisible\ndefinechar                 defc      ZE     Define a character\n#1, #2 dots wide,\ndescender #3\ndeletecharacter            dch1      dc     delete character\n(P*)\ndeleteline                 dl1       dl     delete line (P*)\ndialphone                  dial      DI     dial number #1\ndisstatusline             dsl       ds     disable status line\ndisplayclock               dclk      DK     display clock\ndownhalfline              hd        hd     half a line down\nenaacs                     enacs     eA     enable alternate\nchar set\nenteraltcharsetmode      smacs     as     start alternate\ncharacter set (P)\nenterammode               smam      SA     turn on automatic\nmargins\nenterblinkmode            blink     mb     turn on blinking\nenterboldmode             bold      md     turn on bold (extra\nbright) mode\nentercamode               smcup     ti     string to start pro‐\ngrams using cup\nenterdeletemode           smdc      dm     enter delete mode\nenterdimmode              dim       mh     turn on half-bright\nmode\nenterdoublewidemode       swidm     ZF     Enter double-wide\nmode\nenterdraftquality         sdrfq     ZG     Enter draft-quality\nmode\nenterinsertmode           smir      im     enter insert mode\nenteritalicsmode          sitm      ZH     Enter italic mode\nenterleftwardmode         slm       ZI     Start leftward car‐\nriage motion\nentermicromode            smicm     ZJ     Start micro-motion\nmode\nenternearletterquality   snlq      ZK     Enter NLQ mode\nenternormalquality        snrmq     ZL     Enter normal-quality\nmode\nenterprotectedmode        prot      mp     turn on protected\nmode\nenterreversemode          rev       mr     turn on reverse\nvideo mode\nentersecuremode           invis     mk     turn on blank mode\n(characters invisi‐\nble)\nentershadowmode           sshm      ZM     Enter shadow-print\nmode\nenterstandoutmode         smso      so     begin standout mode\nentersubscriptmode        ssubm     ZN     Enter subscript mode\nentersuperscriptmode      ssupm     ZO     Enter superscript\nmode\nenterunderlinemode        smul      us     begin underline mode\nenterupwardmode           sum       ZP     Start upward car‐\nriage motion\nenterxonmode              smxon     SX     turn on xon/xoff\nhandshaking\n\nerasechars                 ech       ec     erase #1 characters\n(P)\nexitaltcharsetmode       rmacs     ae     end alternate char‐\nacter set (P)\nexitammode                rmam      RA     turn off automatic\nmargins\nexitattributemode         sgr0      me     turn off all at‐\ntributes\nexitcamode                rmcup     te     strings to end pro‐\ngrams using cup\nexitdeletemode            rmdc      ed     end delete mode\nexitdoublewidemode        rwidm     ZQ     End double-wide mode\nexitinsertmode            rmir      ei     exit insert mode\nexititalicsmode           ritm      ZR     End italic mode\nexitleftwardmode          rlm       ZS     End left-motion mode\nexitmicromode             rmicm     ZT     End micro-motion\nmode\nexitshadowmode            rshm      ZU     End shadow-print\nmode\nexitstandoutmode          rmso      se     exit standout mode\nexitsubscriptmode         rsubm     ZV     End subscript mode\nexitsuperscriptmode       rsupm     ZW     End superscript mode\nexitunderlinemode         rmul      ue     exit underline mode\nexitupwardmode            rum       ZX     End reverse charac‐\nter motion\nexitxonmode               rmxon     RX     turn off xon/xoff\nhandshaking\nfixedpause                 pause     PA     pause for 2-3 sec‐\nonds\nflashhook                  hook      fh     flash switch hook\nflashscreen                flash     vb     visible bell (may\nnot move cursor)\nformfeed                   ff        ff     hardcopy terminal\npage eject (P*)\nfromstatusline            fsl       fs     return from status\nline\ngotowindow                 wingo     WG     go to window #1\nhangup                      hup       HU     hang-up phone\ninit1string                is1       i1     initialization\nstring\ninit2string                is2       is     initialization\nstring\ninit3string                is3       i3     initialization\nstring\ninitfile                   if        if     name of initializa‐\ntion file\ninitprog                   iprog     iP     path name of program\nfor initialization\ninitializecolor            initc     Ic     initialize color #1\nto (#2,#3,#4)\ninitializepair             initp     Ip     Initialize color\npair #1 to\nfg=(#2,#3,#4),\nbg=(#5,#6,#7)\ninsertcharacter            ich1      ic     insert character (P)\ninsertline                 il1       al     insert line (P*)\ninsertpadding              ip        ip     insert padding after\ninserted character\nkeya1                      ka1       K1     upper left of keypad\nkeya3                      ka3       K3     upper right of key‐\npad\nkeyb2                      kb2       K2     center of keypad\nkeybackspace               kbs       kb     backspace key\nkeybeg                     kbeg      @1     begin key\nkeybtab                    kcbt      kB     back-tab key\nkeyc1                      kc1       K4     lower left of keypad\n\nkeyc3                      kc3       K5     lower right of key‐\npad\nkeycancel                  kcan      @2     cancel key\nkeycatab                   ktbc      ka     clear-all-tabs key\nkeyclear                   kclr      kC     clear-screen or\nerase key\nkeyclose                   kclo      @3     close key\nkeycommand                 kcmd      @4     command key\nkeycopy                    kcpy      @5     copy key\nkeycreate                  kcrt      @6     create key\nkeyctab                    kctab     kt     clear-tab key\nkeydc                      kdch1     kD     delete-character key\nkeydl                      kdl1      kL     delete-line key\nkeydown                    kcud1     kd     down-arrow key\nkeyeic                     krmir     kM     sent by rmir or smir\nin insert mode\nkeyend                     kend      @7     end key\nkeyenter                   kent      @8     enter/send key\nkeyeol                     kel       kE     clear-to-end-of-line\nkey\nkeyeos                     ked       kS     clear-to-end-of-\nscreen key\nkeyexit                    kext      @9     exit key\nkeyf0                      kf0       k0     F0 function key\nkeyf1                      kf1       k1     F1 function key\nkeyf10                     kf10      k;     F10 function key\nkeyf11                     kf11      F1     F11 function key\nkeyf12                     kf12      F2     F12 function key\nkeyf13                     kf13      F3     F13 function key\nkeyf14                     kf14      F4     F14 function key\nkeyf15                     kf15      F5     F15 function key\nkeyf16                     kf16      F6     F16 function key\nkeyf17                     kf17      F7     F17 function key\nkeyf18                     kf18      F8     F18 function key\nkeyf19                     kf19      F9     F19 function key\nkeyf2                      kf2       k2     F2 function key\nkeyf20                     kf20      FA     F20 function key\nkeyf21                     kf21      FB     F21 function key\nkeyf22                     kf22      FC     F22 function key\nkeyf23                     kf23      FD     F23 function key\nkeyf24                     kf24      FE     F24 function key\nkeyf25                     kf25      FF     F25 function key\nkeyf26                     kf26      FG     F26 function key\nkeyf27                     kf27      FH     F27 function key\nkeyf28                     kf28      FI     F28 function key\nkeyf29                     kf29      FJ     F29 function key\nkeyf3                      kf3       k3     F3 function key\nkeyf30                     kf30      FK     F30 function key\nkeyf31                     kf31      FL     F31 function key\nkeyf32                     kf32      FM     F32 function key\nkeyf33                     kf33      FN     F33 function key\nkeyf34                     kf34      FO     F34 function key\nkeyf35                     kf35      FP     F35 function key\nkeyf36                     kf36      FQ     F36 function key\nkeyf37                     kf37      FR     F37 function key\nkeyf38                     kf38      FS     F38 function key\nkeyf39                     kf39      FT     F39 function key\nkeyf4                      kf4       k4     F4 function key\nkeyf40                     kf40      FU     F40 function key\nkeyf41                     kf41      FV     F41 function key\nkeyf42                     kf42      FW     F42 function key\nkeyf43                     kf43      FX     F43 function key\nkeyf44                     kf44      FY     F44 function key\nkeyf45                     kf45      FZ     F45 function key\nkeyf46                     kf46      Fa     F46 function key\nkeyf47                     kf47      Fb     F47 function key\n\nkeyf48                     kf48      Fc     F48 function key\nkeyf49                     kf49      Fd     F49 function key\nkeyf5                      kf5       k5     F5 function key\nkeyf50                     kf50      Fe     F50 function key\nkeyf51                     kf51      Ff     F51 function key\nkeyf52                     kf52      Fg     F52 function key\nkeyf53                     kf53      Fh     F53 function key\nkeyf54                     kf54      Fi     F54 function key\nkeyf55                     kf55      Fj     F55 function key\nkeyf56                     kf56      Fk     F56 function key\nkeyf57                     kf57      Fl     F57 function key\nkeyf58                     kf58      Fm     F58 function key\nkeyf59                     kf59      Fn     F59 function key\nkeyf6                      kf6       k6     F6 function key\nkeyf60                     kf60      Fo     F60 function key\nkeyf61                     kf61      Fp     F61 function key\nkeyf62                     kf62      Fq     F62 function key\nkeyf63                     kf63      Fr     F63 function key\nkeyf7                      kf7       k7     F7 function key\nkeyf8                      kf8       k8     F8 function key\nkeyf9                      kf9       k9     F9 function key\nkeyfind                    kfnd      @0     find key\nkeyhelp                    khlp      %1     help key\nkeyhome                    khome     kh     home key\nkeyic                      kich1     kI     insert-character key\nkeyil                      kil1      kA     insert-line key\nkeyleft                    kcub1     kl     left-arrow key\nkeyll                      kll       kH     lower-left key (home\ndown)\nkeymark                    kmrk      %2     mark key\nkeymessage                 kmsg      %3     message key\nkeymove                    kmov      %4     move key\nkeynext                    knxt      %5     next key\nkeynpage                   knp       kN     next-page key\nkeyopen                    kopn      %6     open key\nkeyoptions                 kopt      %7     options key\nkeyppage                   kpp       kP     previous-page key\nkeyprevious                kprv      %8     previous key\nkeyprint                   kprt      %9     print key\nkeyredo                    krdo      %0     redo key\nkeyreference               kref      &1     reference key\nkeyrefresh                 krfr      &2     refresh key\nkeyreplace                 krpl      &3     replace key\nkeyrestart                 krst      &4     restart key\nkeyresume                  kres      &5     resume key\nkeyright                   kcuf1     kr     right-arrow key\nkeysave                    ksav      &6     save key\nkeysbeg                    kBEG      &9     shifted begin key\nkeyscancel                 kCAN      &0     shifted cancel key\nkeyscommand                kCMD      *1     shifted command key\nkeyscopy                   kCPY      *2     shifted copy key\nkeyscreate                 kCRT      *3     shifted create key\nkeysdc                     kDC       *4     shifted delete-char‐\nacter key\nkeysdl                     kDL       *5     shifted delete-line\nkey\nkeyselect                  kslt      *6     select key\nkeysend                    kEND      *7     shifted end key\nkeyseol                    kEOL      *8     shifted clear-to-\nend-of-line key\nkeysexit                   kEXT      *9     shifted exit key\nkeysf                      kind      kF     scroll-forward key\nkeysfind                   kFND      *0     shifted find key\nkeyshelp                   kHLP      #1     shifted help key\nkeyshome                   kHOM      #2     shifted home key\n\n\nkeysic                     kIC       #3     shifted insert-char‐\nacter key\nkeysleft                   kLFT      #4     shifted left-arrow\nkey\nkeysmessage                kMSG      %a     shifted message key\nkeysmove                   kMOV      %b     shifted move key\nkeysnext                   kNXT      %c     shifted next key\nkeysoptions                kOPT      %d     shifted options key\nkeysprevious               kPRV      %e     shifted previous key\nkeysprint                  kPRT      %f     shifted print key\nkeysr                      kri       kR     scroll-backward key\nkeysredo                   kRDO      %g     shifted redo key\nkeysreplace                kRPL      %h     shifted replace key\nkeysright                  kRIT      %i     shifted right-arrow\nkey\nkeysrsume                  kRES      %j     shifted resume key\nkeyssave                   kSAV      !1     shifted save key\nkeyssuspend                kSPD      !2     shifted suspend key\nkeystab                    khts      kT     set-tab key\nkeysundo                   kUND      !3     shifted undo key\nkeysuspend                 kspd      &7     suspend key\nkeyundo                    kund      &8     undo key\nkeyup                      kcuu1     ku     up-arrow key\nkeypadlocal                rmkx      ke     leave 'key‐\nboardtransmit' mode\nkeypadxmit                 smkx      ks     enter 'key‐\nboardtransmit' mode\nlabf0                      lf0       l0     label on function\nkey f0 if not f0\nlabf1                      lf1       l1     label on function\nkey f1 if not f1\nlabf10                     lf10      la     label on function\nkey f10 if not f10\nlabf2                      lf2       l2     label on function\nkey f2 if not f2\nlabf3                      lf3       l3     label on function\nkey f3 if not f3\nlabf4                      lf4       l4     label on function\nkey f4 if not f4\nlabf5                      lf5       l5     label on function\nkey f5 if not f5\nlabf6                      lf6       l6     label on function\nkey f6 if not f6\nlabf7                      lf7       l7     label on function\nkey f7 if not f7\nlabf8                      lf8       l8     label on function\nkey f8 if not f8\nlabf9                      lf9       l9     label on function\nkey f9 if not f9\nlabelformat                fln       Lf     label format\nlabeloff                   rmln      LF     turn off soft labels\nlabelon                    smln      LO     turn on soft labels\nmetaoff                    rmm       mo     turn off meta mode\nmetaon                     smm       mm     turn on meta mode\n(8th-bit on)\nmicrocolumnaddress        mhpa      ZY     Like columnaddress\nin micro mode\nmicrodown                  mcud1     ZZ     Like cursordown in\nmicro mode\nmicroleft                  mcub1     Za     Like cursorleft in\nmicro mode\nmicroright                 mcuf1     Zb     Like cursorright in\nmicro mode\nmicrorowaddress           mvpa      Zc     Like rowaddress #1\nin micro mode\n\n\nmicroup                    mcuu1     Zd     Like cursorup in\nmicro mode\nnewline                     nel       nw     newline (behave like\ncr followed by lf)\norderofpins               porder    Ze     Match software bits\nto print-head pins\norigcolors                 oc        oc     Set all color pairs\nto the original ones\norigpair                   op        op     Set default pair to\nits original value\npadchar                    pad       pc     padding char (in‐\nstead of null)\nparmdch                    dch       DC     delete #1 characters\n(P*)\nparmdeleteline            dl        DL     delete #1 lines (P*)\nparmdowncursor            cud       DO     down #1 lines (P*)\nparmdownmicro             mcud      Zf     Like parmdowncur‐\nsor in micro mode\nparmich                    ich       IC     insert #1 characters\n(P*)\nparmindex                  indn      SF     scroll forward #1\nlines (P)\nparminsertline            il        AL     insert #1 lines (P*)\nparmleftcursor            cub       LE     move #1 characters\nto the left (P)\nparmleftmicro             mcub      Zg     Like parmleftcur‐\nsor in micro mode\nparmrightcursor           cuf       RI     move #1 characters\nto the right (P*)\nparmrightmicro            mcuf      Zh     Like parmrightcur‐\nsor in micro mode\nparmrindex                 rin       SR     scroll back #1 lines\n(P)\nparmupcursor              cuu       UP     up #1 lines (P*)\nparmupmicro               mcuu      Zi     Like parmupcursor\nin micro mode\npkeykey                    pfkey     pk     program function key\n#1 to type string #2\npkeylocal                  pfloc     pl     program function key\n#1 to execute string\n#2\npkeyxmit                   pfx       px     program function key\n#1 to transmit\nstring #2\nplabnorm                   pln       pn     program label #1 to\nshow string #2\nprintscreen                mc0       ps     print contents of\nscreen\nprtrnon                    mc5p      pO     turn on printer for\n#1 bytes\nprtroff                    mc4       pf     turn off printer\nprtron                     mc5       po     turn on printer\npulse                       pulse     PU     select pulse dialing\nquickdial                  qdial     QD     dial number #1 with‐\nout checking\nremoveclock                rmclk     RC     remove clock\nrepeatchar                 rep       rp     repeat char #1 #2\ntimes (P*)\nreqforinput               rfi       RF     send next input char\n(for ptys)\nreset1string               rs1       r1     reset string\nreset2string               rs2       r2     reset string\nreset3string               rs3       r3     reset string\nresetfile                  rf        rf     name of reset file\n\n\n\nrestorecursor              rc        rc     restore cursor to\nposition of last\nsavecursor\nrowaddress                 vpa       cv     vertical position #1\nabsolute (P)\nsavecursor                 sc        sc     save current cursor\nposition (P)\nscrollforward              ind       sf     scroll text up (P)\nscrollreverse              ri        sr     scroll text down (P)\nselectcharset             scs       Zj     Select character\nset, #1\nsetattributes              sgr       sa     define video at‐\ntributes #1-#9 (PG9)\nsetbackground              setb      Sb     Set background color\n#1\nsetbottommargin           smgb      Zk     Set bottom margin at\ncurrent line\nsetbottommarginparm      smgbp     Zl     Set bottom margin at\nline #1 or (if smgtp\nis not given) #2\nlines from bottom\nsetclock                   sclk      SC     set clock, #1 hrs #2\nmins #3 secs\nsetcolorpair              scp       sp     Set current color\npair to #1\nsetforeground              setf      Sf     Set foreground color\n#1\nsetleftmargin             smgl      ML     set left soft margin\nat current col‐\numn.     (ML is not\nin BSD termcap).\nsetleftmarginparm        smglp     Zm     Set left (right)\nmargin at column #1\nsetrightmargin            smgr      MR     set right soft mar‐\ngin at current col‐\numn\nsetrightmarginparm       smgrp     Zn     Set right margin at\ncolumn #1\nsettab                     hts       st     set a tab in every\nrow, current columns\nsettopmargin              smgt      Zo     Set top margin at\ncurrent line\nsettopmarginparm         smgtp     Zp     Set top (bottom)\nmargin at row #1\nsetwindow                  wind      wi     current window is\nlines #1-#2 cols\n#3-#4\nstartbitimage             sbim      Zq     Start printing bit\nimage graphics\nstartcharsetdef          scsd      Zr     Start character set\ndefinition #1, with\n#2 characters in the\nset\nstopbitimage              rbim      Zs     Stop printing bit\nimage graphics\nstopcharsetdef           rcsd      Zt     End definition of\ncharacter set #1\nsubscriptcharacters        subcs     Zu     List of subscript‐\nable characters\nsuperscriptcharacters      supcs     Zv     List of superscript‐\nable characters\ntab                         ht        ta     tab to next 8-space\nhardware tab stop\nthesecausecr              docr      Zw     Printing any of\nthese characters\ncauses CR\n\ntostatusline              tsl       ts     move to status line,\ncolumn #1\ntone                        tone      TO     select touch tone\ndialing\nunderlinechar              uc        uc     underline char and\nmove past it\nuphalfline                hu        hu     half a line up\nuser0                       u0        u0     User string #0\nuser1                       u1        u1     User string #1\nuser2                       u2        u2     User string #2\nuser3                       u3        u3     User string #3\nuser4                       u4        u4     User string #4\nuser5                       u5        u5     User string #5\nuser6                       u6        u6     User string #6\nuser7                       u7        u7     User string #7\nuser8                       u8        u8     User string #8\nuser9                       u9        u9     User string #9\nwaittone                   wait      WA     wait for dial-tone\nxoffcharacter              xoffc     XF     XOFF character\nxoncharacter               xonc      XN     XON character\nzeromotion                 zerom     Zx     No motion for subse‐\nquent character\n\nThe following string capabilities are present in the SVr4.0 term structure, but  were  origi‐\nnally not documented in the man page.\n\n\nVariable            Cap-       TCap      Description\nString             name       Code\naltscancodeesc            scesa      S8     Alternate escape\nfor scancode emu‐\nlation\nbitimagecarriagereturn   bicr       Yv     Move to beginning\nof same row\nbitimagenewline           binel      Zz     Move to next row\nof the bit image\nbitimagerepeat            birep      Xy     Repeat bit image\ncell #1 #2 times\ncharsetnames              csnm       Zy     Produce #1'th item\nfrom list of char‐\nacter set names\ncodesetinit               csin       ci     Init sequence for\nmultiple codesets\ncolornames                 colornm    Yw     Give name for\ncolor #1\ndefinebitimageregion     defbi      Yx     Define rectangular\nbit image region\ndevicetype                 devt       dv     Indicate lan‐\nguage/codeset sup‐\nport\ndisplaypcchar             dispc      S1     Display PC charac‐\nter #1\nendbitimageregion        endbi      Yy     End a bit-image\nregion\nenterpccharsetmode       smpch      S2     Enter PC character\ndisplay mode\nenterscancodemode         smsc       S4     Enter PC scancode\nmode\nexitpccharsetmode        rmpch      S3     Exit PC character\ndisplay mode\nexitscancodemode          rmsc       S5     Exit PC scancode\nmode\ngetmouse                   getm       Gm     Curses should get\nbutton events, pa‐\nrameter #1 not\ndocumented.\n\nkeymouse                   kmous      Km     Mouse event has\noccurred\nmouseinfo                  minfo      Mi     Mouse status in‐\nformation\npctermoptions             pctrm      S6     PC terminal op‐\ntions\npkeyplab                   pfxl       xl     Program function\nkey #1 to type\nstring #2 and show\nstring #3\nreqmousepos               reqmp      RQ     Request mouse po‐\nsition\nscancodeescape             scesc      S7     Escape for scan‐\ncode emulation\nset0desseq                s0ds       s0     Shift to codeset 0\n(EUC set 0, ASCII)\nset1desseq                s1ds       s1     Shift to codeset 1\nset2desseq                s2ds       s2     Shift to codeset 2\nset3desseq                s3ds       s3     Shift to codeset 3\nsetabackground            setab      AB     Set background\ncolor to #1, using\nANSI escape\nsetaforeground            setaf      AF     Set foreground\ncolor to #1, using\nANSI escape\nsetcolorband              setcolor   Yz     Change to ribbon\ncolor #1\nsetlrmargin               smglr      ML     Set both left and\nright margins to\n#1, #2.  (ML is\nnot in BSD term‐\ncap).\nsetpagelength             slines     YZ     Set page length to\n#1 lines\nsettbmargin               smgtb      MT     Sets both top and\nbottom margins to\n#1, #2\n\nThe  XSI Curses standard added these hardcopy capabilities.  They were used in some post-4.1\nversions of System V curses, e.g., Solaris 2.5 and IRIX 6.x.  Except  for  YI,  the  ncurses\ntermcap  names  for  them  are invented.  According to the XSI Curses standard, they have no\ntermcap names.  If your compiled terminfo entries use these, they may not be binary-compati‐\nble with System V terminfo entries after SVr4.1; beware!\n\n\nVariable            Cap-      TCap       Description\nString             name      Code\nenterhorizontalhlmode    ehhlm     Xh     Enter horizontal\nhighlight mode\nenterlefthlmode          elhlm     Xl     Enter left highlight\nmode\nenterlowhlmode           elohlm    Xo     Enter low highlight\nmode\nenterrighthlmode         erhlm     Xr     Enter right high‐\nlight mode\nentertophlmode           ethlm     Xt     Enter top highlight\nmode\nenterverticalhlmode      evhlm     Xv     Enter vertical high‐\nlight mode\nsetaattributes            sgr1      sA     Define second set of\nvideo attributes\n#1-#6\n\n\n\n\n\nsetpgleninch              slength   YI     Set page length to\n#1 hundredth of an\ninch (some implemen‐\ntations use sL for\ntermcap).\n"
                },
                {
                    "name": "User-Defined Capabilities",
                    "content": "The  preceding  section listed the predefined capabilities.  They deal with some special fea‐\ntures for terminals no longer (or possibly never) produced.  Occasionally there  are  special\nfeatures  of newer terminals which are awkward or impossible to represent by reusing the pre‐\ndefined capabilities.\n\nncurses addresses this limitation by allowing user-defined capabilities.  The tic and infocmp\nprograms provide the -x option for this purpose.  When -x is set, tic treats unknown capabil‐\nities as user-defined.  That is, if tic encounters a capability name which it does not recog‐\nnize,  it  infers  its type (boolean, number or string) from the syntax and makes an extended\ntable entry for that capability.  The useextendednames(3X) function makes this  information\nconditionally  available to applications.  The ncurses library provides the data leaving most\nof the behavior to applications:\n\n•   User-defined capability strings whose name begins with “k” are treated as function keys.\n\n•   The types (boolean, number, string) determined by tic can be inferred by successful calls\non tigetflag, etc.\n\n•   If  the  capability  name  happens to be two characters, the capability is also available\nthrough the termcap interface.\n\nWhile termcap is said to be extensible because it does not use a predefined set of  capabili‐\nties,  in  practice  it  has been limited to the capabilities defined by terminfo implementa‐\ntions.  As a rule, user-defined capabilities intended for use by termcap applications  should\nbe limited to booleans and numbers to avoid running past the 1023 byte limit assumed by term‐\ncap implementations and their applications.  In particular, providing extended sets of  func‐\ntion  keys (past the 60 numbered keys and the handful of special named keys) is best done us‐\ning the longer names available using terminfo.\n"
                },
                {
                    "name": "A Sample Entry",
                    "content": "The following entry, describing an ANSI-standard terminal, is representative of what  a  ter‐‐\nminfo entry for a modern terminal typically looks like.\n\nansi|ansi/pc-term compatible with color,\nam, mc5i, mir, msgr,\ncolors#8, cols#80, it#8, lines#24, ncv#3, pairs#64,\nacsc=+\\020\\,\\021-\\030.^Y0\\333`\\004a\\261f\\370g\\361h\\260\nj\\331k\\277l\\332m\\300n\\305o~p\\304q\\304r\\304st\\303\nu\\264v\\301w\\302x\\263y\\363z\\362{\\343|\\330}\\234~\\376,\nbel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, clear=\\E[H\\E[J,\ncr=^M, cub=\\E[%p1%dD, cub1=\\E[D, cud=\\E[%p1%dB, cud1=\\E[B,\ncuf=\\E[%p1%dC, cuf1=\\E[C, cup=\\E[%i%p1%d;%p2%dH,\ncuu=\\E[%p1%dA, cuu1=\\E[A, dch=\\E[%p1%dP, dch1=\\E[P,\ndl=\\E[%p1%dM, dl1=\\E[M, ech=\\E[%p1%dX, ed=\\E[J, el=\\E[K,\nel1=\\E[1K, home=\\E[H, hpa=\\E[%i%p1%dG, ht=\\E[I, hts=\\EH,\nich=\\E[%p1%d@, il=\\E[%p1%dL, il1=\\E[L, ind=^J,\nindn=\\E[%p1%dS, invis=\\E[8m, kbs=^H, kcbt=\\E[Z, kcub1=\\E[D,\nkcud1=\\E[B, kcuf1=\\E[C, kcuu1=\\E[A, khome=\\E[H, kich1=\\E[L,\nmc4=\\E[4i, mc5=\\E[5i, nel=\\r\\E[S, op=\\E[39;49m,\nrep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, rin=\\E[%p1%dT,\nrmacs=\\E[10m, rmpch=\\E[10m, rmso=\\E[m, rmul=\\E[m,\ns0ds=\\E(B, s1ds=\\E)B, s2ds=\\E*B, s3ds=\\E+B,\nsetab=\\E[4%p1%dm, setaf=\\E[3%p1%dm,\nsgr=\\E[0;10%?%p1%t;7%;\n%?%p2%t;4%;\n%?%p3%t;7%;\n%?%p4%t;5%;\n%?%p6%t;1%;\n%?%p7%t;8%;\n%?%p9%t;11%;m,\nsgr0=\\E[0;10m, smacs=\\E[11m, smpch=\\E[11m, smso=\\E[7m,\nsmul=\\E[4m, tbc=\\E[3g, u6=\\E[%i%d;%dR, u7=\\E[6n,\nu8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd,\n\nEntries may continue onto multiple lines by placing white space at the beginning of each line\nexcept the first.  Comments may be included on lines beginning  with  “#”.   Capabilities  in\nterminfo are of three types:\n\n•   Boolean capabilities which indicate that the terminal has some particular feature,\n\n•   numeric  capabilities  giving  the size of the terminal or the size of particular delays,\nand\n\n•   string capabilities, which give a sequence which can be used to perform particular termi‐\nnal operations.\n"
                },
                {
                    "name": "Types of Capabilities",
                    "content": "All  capabilities have names.  For instance, the fact that ANSI-standard terminals have auto‐\nmatic margins (i.e., an automatic return and line-feed when the end of a line is reached)  is\nindicated by the capability am.  Hence the description of ansi includes am.  Numeric capabil‐\nities are followed by the character “#” and then a positive value.  Thus  cols,  which  indi‐\ncates  the number of columns the terminal has, gives the value “80” for ansi.  Values for nu‐\nmeric capabilities may be specified in decimal, octal or hexadecimal, using the C programming\nlanguage conventions (e.g., 255, 0377 and 0xff or 0xFF).\n\nFinally,  string valued capabilities, such as el (clear to end of line sequence) are given by\nthe two-character code, an “=”, and then a string ending at the next following “,”.\n\nA number of escape sequences are provided in the string valued capabilities for easy encoding\nof characters there:\n\n•   Both \\E and \\e map to an ESCAPE character,\n\n•   ^x maps to a control-x for any appropriate x, and\n\n•   the sequences\n\n\\n, \\l, \\r, \\t, \\b, \\f, and \\s\n\nproduce\n\nnewline, line-feed, return, tab, backspace, form-feed, and space,\n\nrespectively.\n\nX/Open  Curses  does not say what “appropriate x” might be.  In practice, that is a printable\nASCII graphic character.  The special case “^?” is interpreted as DEL (127).   In  all  other\ncases,  the character value is AND'd with 0x1f, mapping to ASCII control codes in the range 0\nthrough 31.\n\nOther escapes include\n\n•   \\^ for ^,\n\n•   \\\\ for \\,\n\n•   \\, for comma,\n\n•   \\: for :,\n\n•   and \\0 for null.\n\n\\0 will produce \\200, which does not terminate a string but behaves as a  null  character\non most terminals, providing CS7 is specified.  See stty(1).\n\nThe  reason  for  this quirk is to maintain binary compatibility of the compiled terminfo\nfiles with other implementations, e.g., the SVr4 systems, which document this.   Compiled\nterminfo  files  use  null-terminated strings, with no lengths.  Modifying this would re‐\nquire a new binary format, which would not work with other implementations.\n\nFinally, characters may be given as three octal digits after a \\.\n\nA delay in milliseconds may appear anywhere in a string capability, enclosed in $<..>  brack‐\nets,  as  in el=\\EK$<5>, and padding characters are supplied by tputs(3X) to provide this de‐\nlay.\n\n•   The delay must be a number with at most one decimal place of precision; it  may  be  fol‐\nlowed by suffixes “*” or “/” or both.\n\n•   A “*” indicates that the padding required is proportional to the number of lines affected\nby the operation, and the amount given is the per-affected-unit  padding  required.   (In\nthe case of insert character, the factor is still the number of lines affected.)\n\nNormally,  padding  is advisory if the device has the xon capability; it is used for cost\ncomputation but does not trigger delays.\n\n•   A “/” suffix indicates that the padding is mandatory and forces a delay of the given num‐\nber of milliseconds even on devices for which xon is present to indicate flow control.\n\nSometimes individual capabilities must be commented out.  To do this, put a period before the\ncapability name.  For example, see the second ind in the example above.\n"
                },
                {
                    "name": "Fetching Compiled Descriptions",
                    "content": "The ncurses library searches for terminal descriptions in several places.  It uses  only  the\nfirst description found.  The library has a compiled-in list of places to search which can be\noverridden by environment variables.  Before starting to search,  ncurses  eliminates  dupli‐\ncates in its search list.\n\n•   If  the  environment variable TERMINFO is set, it is interpreted as the pathname of a di‐\nrectory containing the compiled description you are working on.  Only that  directory  is\nsearched.\n\n•   If  TERMINFO is not set, ncurses will instead look in the directory $HOME/.terminfo for a\ncompiled description.\n\n•   Next, if the environment variable TERMINFODIRS is set, ncurses will interpret  the  con‐\ntents of that variable as a list of colon-separated directories (or database files) to be\nsearched.\n\nAn empty directory name (i.e., if the variable begins or ends with a colon,  or  contains\nadjacent colons) is interpreted as the system location /etc/terminfo.\n\n•   Finally, ncurses searches these compiled-in locations:\n\n•   a list of directories (no default value), and\n\n•   the system terminfo directory, /etc/terminfo (the compiled-in default).\n"
                },
                {
                    "name": "Preparing Descriptions",
                    "content": "We now outline how to prepare descriptions of terminals.  The most effective way to prepare a\nterminal description is by imitating the description of a similar terminal in terminfo and to\nbuild  up  a  description gradually, using partial descriptions with vi or some other screen-\noriented program to check that they are correct.  Be aware that a very unusual  terminal  may\nexpose deficiencies in the ability of the terminfo file to describe it or bugs in the screen-\nhandling code of the test program.\n\nTo get the padding for insert line right (if the terminal manufacturer did not document it) a\nsevere  test  is  to edit a large file at 9600 baud, delete 16 or so lines from the middle of\nthe screen, then hit the “u” key several times quickly.  If the terminal messes up, more pad‐\nding is usually needed.  A similar test can be used for insert character.\n"
                },
                {
                    "name": "Basic Capabilities",
                    "content": "The  number of columns on each line for the terminal is given by the cols numeric capability.\nIf the terminal is a CRT, then the number of lines on the screen is given by the lines  capa‐\nbility.   If  the terminal wraps around to the beginning of the next line when it reaches the\nright margin, then it should have the am capability.  If the terminal can clear  its  screen,\nleaving  the  cursor in the home position, then this is given by the clear string capability.\nIf the terminal overstrikes (rather than clearing a position when a character is struck over)\nthen  it should have the os capability.  If the terminal is a printing terminal, with no soft\ncopy unit, give it both hc and os.  (os applies to storage scope terminals, such as TEKTRONIX\n4010  series, as well as hard copy and APL terminals.)  If there is a code to move the cursor\nto the left edge of the current row, give this as cr.  (Normally this will  be  carriage  re‐\nturn,  control/M.)   If  there  is a code to produce an audible signal (bell, beep, etc) give\nthis as bel.\n\nIf there is a code to move the cursor one position to the left (such as backspace) that capa‐\nbility  should  be given as cub1.  Similarly, codes to move to the right, up, and down should\nbe given as cuf1, cuu1, and cud1.  These local cursor motions should not alter the text  they\npass over, for example, you would not normally use “cuf1= ” because the space would erase the\ncharacter moved over.\n\nA very important point here is that the local cursor motions encoded in  terminfo  are  unde‐\nfined  at  the  left  and  top  edges  of  a  CRT terminal.  Programs should never attempt to\nbackspace around the left edge, unless bw is given, and never attempt to go  up  locally  off\nthe  top.   In  order  to  scroll text up, a program will go to the bottom left corner of the\nscreen and send the ind (index) string.\n\nTo scroll text down, a program goes to the top left corner of the screen  and  sends  the  ri\n(reverse  index)  string.   The strings ind and ri are undefined when not on their respective\ncorners of the screen.\n\nParameterized versions of the scrolling sequences are indn and rin which have the same seman‐\ntics as ind and ri except that they take one parameter, and scroll that many lines.  They are\nalso undefined except at the appropriate edge of the screen.\n\nThe am capability tells whether the cursor sticks at the right edge of the screen  when  text\nis  output, but this does not necessarily apply to a cuf1 from the last column.  The only lo‐\ncal motion which is defined from the left edge is if bw is given, then a cub1 from  the  left\nedge  will move to the right edge of the previous row.  If bw is not given, the effect is un‐\ndefined.  This is useful for drawing a box around the edge of the screen,  for  example.   If\nthe  terminal has switch selectable automatic margins, the terminfo file usually assumes that\nthis is on; i.e., am.  If the terminal has a command which moves to the first column  of  the\nnext  line,  that  command  can be given as nel (newline).  It does not matter if the command\nclears the remainder of the current line, so if the terminal has no cr and lf it may still be\npossible to craft a working nel out of one or both of them.\n\nThese  capabilities  suffice to describe hard-copy and “glass-tty” terminals.  Thus the model\n33 teletype is described as\n\n33|tty33|tty|model 33 teletype,\nbel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\n\nwhile the Lear Siegler ADM-3 is described as\n\nadm3|3|lsi adm3,\nam, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,\nind=^J, lines#24,\n"
                },
                {
                    "name": "Parameterized Strings",
                    "content": "Cursor addressing and other strings requiring parameters in the terminal are described  by  a\nparameterized  string capability, with printf-like escapes such as %x in it.  For example, to\naddress the cursor, the cup capability is given, using two parameters: the row and column  to\naddress  to.  (Rows and columns are numbered from zero and refer to the physical screen visi‐\nble to the user, not to any unseen memory.)  If the terminal has memory relative  cursor  ad‐\ndressing, that can be indicated by mrcup.\n\nThe  parameter  mechanism uses a stack and special % codes to manipulate it.  Typically a se‐\nquence will push one of the parameters onto the stack and  then  print  it  in  some  format.\nPrint  (e.g.,  “%d”)  is  a special case.  Other operations, including “%t” pop their operand\nfrom the stack.  It is noted that more complex operations are often necessary, e.g.,  in  the\nsgr string.\n\nThe % encodings have the following meanings:\n\n%%   outputs “%”\n\n%[[:]flags][width[.precision]][doxXs]\nas in printf(3), flags are [-+#] and space.  Use a “:” to allow the next character to be\na “-” flag, avoiding interpreting “%-” as an operator.\n\n%c   print pop() like %c in printf\n\n%s   print pop() like %s in printf\n\n%p[1-9]\npush i'th parameter\n\n%P[a-z]\nset dynamic variable [a-z] to pop()\n\n%g[a-z]/\nget dynamic variable [a-z] and push it\n\n%P[A-Z]\nset static variable [a-z] to pop()\n\n%g[A-Z]\nget static variable [a-z] and push it\n\nThe terms “static” and “dynamic” are misleading.  Historically,  these  are  simply  two\ndifferent  sets  of  variables,  whose  values are not reset between calls to tparm(3X).\nHowever, that fact is not documented in other implementations.  Relying on it  will  ad‐\nversely impact portability to other implementations:\n\n•   SVr2 curses supported dynamic variables.  Those are set only by a %P operator.  A %g\nfor a given variable without first setting it with %P will  give  unpredictable  re‐\nsults,  because  dynamic  variables are an uninitialized local array on the stack in\nthe tparm function.\n\n•   SVr3.2 curses supported static variables.  Those are an array in the TERMINAL struc‐\nture  (declared in term.h), and are zeroed automatically when the setupterm function\nallocates the data.\n\n•   SVr4 curses made no further improvements to the dynamic/static variable feature.\n\n•   Solaris XPG4 curses does not distinguish between dynamic and static variables.  They\nare the same.  Like SVr4 curses, XPG4 curses does not initialize these explicitly.\n\n•   Before  version  6.3, ncurses stores both dynamic and static variables in persistent\nstorage, initialized to zeros.\n\n•   Beginning with version 6.3, ncurses stores static and dynamic variables in the  same\nmanner  as  SVr4.  Unlike other implementations, ncurses zeros dynamic variables be‐\nfore the first %g or %P operator.\n\n%'c' char constant c\n\n%{nn}\ninteger constant nn\n\n%l   push strlen(pop)\n\n%+, %-, %*, %/, %m\narithmetic (%m is mod): push(pop() op pop())\n\n%&, %|, %^\nbit operations (AND, OR and exclusive-OR): push(pop() op pop())\n\n%=, %>, %<\nlogical operations: push(pop() op pop())\n\n%A, %O\nlogical AND and OR operations (for conditionals)\n\n%!, %~\nunary operations (logical and bit complement): push(op pop())\n\n%i   add 1 to first two parameters (for ANSI terminals)\n\n%? expr %t thenpart %e elsepart %;\nThis forms an if-then-else.  The %e elsepart is optional.   Usually  the  %?  expr  part\npushes  a  value onto the stack, and %t pops it from the stack, testing if it is nonzero\n(true).  If it is zero (false), control passes to the %e (else) part.\n\nIt is possible to form else-if's a la Algol 68:\n%? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %;\n\nwhere ci are conditions, bi are bodies.\n\nUse the -f option of tic or infocmp  to  see  the  structure  of  if-then-else's.   Some\nstrings,  e.g.,  sgr  can  be  very complicated when written on one line.  The -f option\nsplits the string into lines with the parts indented.\n\nBinary operations are in postfix form with the operands in the usual order.  That is, to  get\nx-5 one would use “%gx%{5}%-”.  %P and %g variables are persistent across escape-string eval‐\nuations.\n\nConsider the HP2645, which, to get to row 3 and column 12, needs to be sent \\E&a12c03Y padded\nfor  6  milliseconds.  Note that the order of the rows and columns is inverted here, and that\nthe  row  and  column  are  printed  as   two   digits.    Thus   its   cup   capability   is\n“cup=6\\E&%p2%2dc%p1%2dY”.\n\nThe Microterm ACT-IV needs the current row and column sent preceded by a ^T, with the row and\ncolumn simply encoded in binary, “cup=^T%p1%c%p2%c”.  Terminals which use  “%c”  need  to  be\nable to backspace the cursor (cub1), and to move the cursor up one line on the screen (cuu1).\nThis is necessary because it is not always safe to transmit \\n ^D and \\r, as the  system  may\nchange  or  discard  them.  (The library routines dealing with terminfo set tty modes so that\ntabs are never expanded, so \\t is safe to send.  This turns out to be essential for  the  Ann\nArbor 4080.)\n\nA  final  example  is  the LSI ADM-3a, which uses row and column offset by a blank character,\nthus “cup=\\E=%p1%' '%+%c%p2%' '%+%c”.  After sending “\\E=”, this pushes the first  parameter,\npushes  the ASCII value for a space (32), adds them (pushing the sum on the stack in place of\nthe two previous values) and outputs that value as a character.  Then the same  is  done  for\nthe second parameter.  More complex arithmetic is possible using the stack.\n"
                },
                {
                    "name": "Cursor Motions",
                    "content": "If  the terminal has a fast way to home the cursor (to very upper left corner of screen) then\nthis can be given as home; similarly a fast way of getting to the lower left-hand corner  can\nbe  given  as  ll;  this may involve going up with cuu1 from the home position, but a program\nshould never do this itself (unless ll does) because it can make no assumption about the  ef‐\nfect  of  moving  up  from the home position.  Note that the home position is the same as ad‐\ndressing to (0,0): to the top left corner of the screen, not of memory.  (Thus, the  \\EH  se‐\nquence on HP terminals cannot be used for home.)\n\nIf  the  terminal  has row or column absolute cursor addressing, these can be given as single\nparameter capabilities hpa (horizontal position absolute) and vpa  (vertical  position  abso‐\nlute).  Sometimes these are shorter than the more general two parameter sequence (as with the\nhp2645) and can be used in preference to cup.   If  there  are  parameterized  local  motions\n(e.g., move n spaces to the right) these can be given as cud, cub, cuf, and cuu with a single\nparameter indicating how many spaces to move.  These are primarily  useful  if  the  terminal\ndoes not have cup, such as the TEKTRONIX 4025.\n\nIf the terminal needs to be in a special mode when running a program that uses these capabil‐\nities, the codes to enter and exit this mode can be given as smcup and rmcup.   This  arises,\nfor  example, from terminals like the Concept with more than one page of memory.  If the ter‐\nminal has only memory relative cursor addressing and not screen relative cursor addressing, a\none  screen-sized  window must be fixed into the terminal for cursor addressing to work prop‐\nerly.  This is also used for the TEKTRONIX 4025, where smcup sets the command character to be\nthe  one  used by terminfo.  If the smcup sequence will not restore the screen after an rmcup\nsequence is output (to the state prior to outputting rmcup), specify nrrmc.\n"
                },
                {
                    "name": "Margins",
                    "content": "SVr4 (and X/Open Curses) list several string capabilities for setting margins.  Two were  in‐\ntended for use with terminals, and another six were intended for use with printers.\n\n•   The two terminal capabilities assume that the terminal may have the capability of setting\nthe left and/or right margin at the current cursor column position.\n\n•   The printer capabilities assume that the printer may have two types of capability:\n\n•   the ability to set a top and/or bottom margin using the current line position, and\n\n•   parameterized capabilities for setting the top, bottom, left, right margins given the\nnumber of rows or columns.\n\nIn practice, the categorization into “terminal” and “printer” is not suitable:\n\n•   The AT&T SVr4 terminal database uses smgl four times, for AT&T hardware.\n\nThree of the four are printers.  They lack the ability to set left/right margins by spec‐\nifying the column.\n\n•   Other (non-AT&T) terminals may support margins but using different assumptions from AT&T.\n\nFor instance, the DEC VT420 supports left/right margins, but only using a column  parame‐\nter.   As  an  added complication, the VT420 uses two settings to fully enable left/right\nmargins (left/right margin mode, and origin mode).  The former enables the margins, which\ncauses  printed  text to wrap within margins, but the latter is needed to prevent cursor-\naddressing outside those margins.\n\n•   Both DEC VT420 left/right margins are set with a single control sequence.  If  either  is\nomitted, the corresponding margin is set to the left or right edge of the display (rather\nthan leaving the margin unmodified).\n\nThese are the margin-related capabilities:\n\nName       Description\n──────────────────────────────────────────────────────\nsmgl       Set left margin at current column\nsmgr       Set right margin at current column\nsmgb       Set bottom margin at current line\nsmgt       Set top margin at current line\nsmgbp      Set bottom margin at line N\nsmglp      Set left margin at column N\nsmgrp      Set right margin at column N\nsmgtp      Set top margin at line N\nsmglr      Set both left and right margins to L and R\nsmgtb      Set both top and bottom margins to T and B\n\nWhen writing an application that uses these string capabilities, the pairs  should  be  first\nchecked to see if each capability in the pair is set or only one is set:\n\n•   If  both  smglp and smgrp are set, each is used with a single argument, N, that gives the\ncolumn number of the left and right margin, respectively.\n\n•   If both smgtp and smgbp are set, each is used to set the top and bottom  margin,  respec‐\ntively:\n\n•   smgtp is used with a single argument, N, the line number of the top margin.\n\n•   smgbp  is  used  with two arguments, N and M, that give the line number of the bottom\nmargin, the first counting from the top of the page and the second counting from  the\nbottom.   This accommodates the two styles of specifying the bottom margin in differ‐\nent manufacturers' printers.\n\nWhen designing a terminfo entry for a printer that has a settable bottom margin, only the\nfirst  or  second  argument should be used, depending on the printer.  When developing an\napplication that uses smgbp to set the bottom margin, both arguments must be given.\n\nConversely, when only one capability in the pair is set:\n\n•   If only one of smglp and smgrp is set, then it is used with  two  arguments,  the  column\nnumber of the left and right margins, in that order.\n\n•   Likewise,  if only one of smgtp and smgbp is set, then it is used with two arguments that\ngive the top and bottom margins, in that order, counting from the top of the page.\n\nWhen designing a terminfo entry for a printer that requires setting both left  and  right\nor  top and bottom margins simultaneously, only one capability in the pairs smglp and sm‐‐\ngrp or smgtp and smgbp should be defined, leaving the other unset.\n\nExcept for very old terminal descriptions, e.g., those developed for SVr4,  the  scheme  just\ndescribed  should  be considered obsolete.  An improved set of capabilities was added late in\nthe SVr4 releases (smglr and smgtb), which explicitly use  two  parameters  for  setting  the\nleft/right or top/bottom margins.\n\nWhen setting margins, the line- and column-values are zero-based.\n\nThe  mgc string capability should be defined.  Applications such as tabs(1) rely upon this to\nreset all margins.\n"
                },
                {
                    "name": "Area Clears",
                    "content": "If the terminal can clear from the current position to the end of the line, leaving the  cur‐\nsor where it is, this should be given as el.  If the terminal can clear from the beginning of\nthe line to the current position inclusive, leaving the cursor where it is,  this  should  be\ngiven as el1.  If the terminal can clear from the current position to the end of the display,\nthen this should be given as ed.  Ed is only defined from the first column of a line.  (Thus,\nit  can  be  simulated  by  a  request to delete a large number of lines, if a true ed is not\navailable.)\n"
                },
                {
                    "name": "Insert/delete line and vertical motions",
                    "content": "If the terminal can open a new blank line before the line where the cursor is, this should be\ngiven  as il1; this is done only from the first position of a line.  The cursor must then ap‐\npear on the newly blank line.  If the terminal can delete the line which the  cursor  is  on,\nthen this should be given as dl1; this is done only from the first position on the line to be\ndeleted.  Versions of il1 and dl1 which take a single parameter and  insert  or  delete  that\nmany lines can be given as il and dl.\n\nIf  the terminal has a settable scrolling region (like the vt100) the command to set this can\nbe described with the csr capability, which takes two parameters: the top and bottom lines of\nthe scrolling region.  The cursor position is, alas, undefined after using this command.\n\nIt  is possible to get the effect of insert or delete line using csr on a properly chosen re‐\ngion; the sc and rc (save and restore cursor) commands may be useful for ensuring  that  your\nsynthesized  insert/delete string does not move the cursor.  (Note that the ncurses(3NCURSES)\nlibrary does this synthesis automatically, so you need not compose insert/delete strings  for\nan entry with csr).\n\nYet  another  way  to construct insert and delete might be to use a combination of index with\nthe memory-lock feature found on some terminals (like the  HP-700/90  series,  which  however\nalso has insert/delete).\n\nInserting  lines  at the top or bottom of the screen can also be done using ri or ind on many\nterminals without a true insert/delete line, and is often faster even on terminals with those\nfeatures.\n\nThe  boolean  nondestscrollregion  should be set if each scrolling window is effectively a\nview port on a screen-sized canvas.  To test for this capability, create a  scrolling  region\nin  the  middle of the screen, write something to the bottom line, move the cursor to the top\nof the region, and do ri followed by dl1 or ind.  If the data scrolled off the bottom of  the\nregion  by the ri re-appears, then scrolling is non-destructive.  System V and XSI Curses ex‐\npect that ind, ri, indn, and rin will simulate  destructive  scrolling;  their  documentation\ncautions  you not to define csr unless this is true.  This curses implementation is more lib‐\neral and will do explicit erases after scrolling if ndsrc is defined.\n\nIf the terminal has the ability to define a window as part of memory, which all commands  af‐\nfect,  it  should  be  given  as  the parameterized string wind.  The four parameters are the\nstarting and ending lines in memory and the starting and ending columns in  memory,  in  that\norder.\n\nIf  the  terminal can retain display memory above, then the da capability should be given; if\ndisplay memory can be retained below, then db should be given.  These indicate that  deleting\na  line  or  scrolling may bring non-blank lines up from below or that scrolling back with ri\nmay bring down non-blank lines.\n"
                },
                {
                    "name": "Insert/Delete Character",
                    "content": "There are two basic kinds of intelligent terminals with respect  to  insert/delete  character\nwhich  can  be  described using terminfo.  The most common insert/delete character operations\naffect only the characters on the current line and shift characters off the end of  the  line\nrigidly.   Other terminals, such as the Concept 100 and the Perkin Elmer Owl, make a distinc‐\ntion between typed and untyped blanks on the screen, shifting upon an insert or  delete  only\nto  an  untyped  blank  on  the screen which is either eliminated, or expanded to two untyped\nblanks.\n\nYou can determine the kind of terminal you have by clearing the screen and then  typing  text\nseparated  by  cursor motions.  Type “abc    def” using local cursor motions (not spaces) be‐\ntween the “abc” and the “def”.  Then position the cursor before the “abc” and put the  termi‐\nnal  in  insert  mode.  If typing characters causes the rest of the line to shift rigidly and\ncharacters to fall off the end, then your terminal does not distinguish  between  blanks  and\nuntyped positions.  If the “abc” shifts over to the “def” which then move together around the\nend of the current line and onto the next as you insert, you have the second type  of  termi‐\nnal, and should give the capability in, which stands for “insert null”.\n\nWhile  these  are  two logically separate attributes (one line versus multi-line insert mode,\nand special treatment of untyped spaces) we have seen no terminals whose insert  mode  cannot\nbe described with the single attribute.\n\nTerminfo  can  describe  both terminals which have an insert mode, and terminals which send a\nsimple sequence to open a blank position on the current line.  Give as smir the  sequence  to\nget  into insert mode.  Give as rmir the sequence to leave insert mode.  Now give as ich1 any\nsequence needed to be sent just before sending the character to be inserted.  Most  terminals\nwith  a true insert mode will not give ich1; terminals which send a sequence to open a screen\nposition should give it here.\n\nIf your terminal has both, insert mode is  usually  preferable  to  ich1.   Technically,  you\nshould  not  give  both unless the terminal actually requires both to be used in combination.\nAccordingly, some non-curses applications get confused if both are present;  the  symptom  is\ndoubled  characters  in  an  update using insert.  This requirement is now rare; most ich se‐\nquences do not require previous smir, and most smir insert modes do not require  ich1  before\neach  character.  Therefore, the new curses actually assumes this is the case and uses either\nrmir/smir or ich/ich1 as appropriate (but not both).  If you have to write  an  entry  to  be\nused under new curses for a terminal old enough to need both, include the rmir/smir sequences\nin ich1.\n\nIf post insert padding is needed, give this as a number of milliseconds in ip (a  string  op‐\ntion).   Any  other  sequence which may need to be sent after an insert of a single character\nmay also be given in ip.  If your terminal needs both to be placed into an “insert mode”  and\na special code to precede each inserted character, then both smir/rmir and ich1 can be given,\nand both will be used.  The ich capability, with one parameter, n, will repeat the effects of\nich1 n times.\n\nIf  padding  is  necessary  between characters typed while not in insert mode, give this as a\nnumber of milliseconds padding in rmp.\n\nIt is occasionally necessary to move around while in insert mode to delete characters on  the\nsame  line  (e.g.,  if there is a tab after the insertion position).  If your terminal allows\nmotion while in insert mode you can give the capability mir to speed  up  inserting  in  this\ncase.   Omitting  mir  will affect only speed.  Some terminals (notably Datamedia's) must not\nhave mir because of the way their insert mode works.\n\nFinally, you can specify dch1 to delete a single character, dch with  one  parameter,  n,  to\ndelete  n  characters,  and delete mode by giving smdc and rmdc to enter and exit delete mode\n(any mode the terminal needs to be placed in for dch1 to work).\n\nA command to erase n characters (equivalent to outputting n blanks without moving the cursor)\ncan be given as ech with one parameter.\n"
                },
                {
                    "name": "Highlighting, Underlining, and Visible Bells",
                    "content": "If  your  terminal has one or more kinds of display attributes, these can be represented in a\nnumber of different ways.  You should choose one display form as standout mode,  representing\na good, high contrast, easy-on-the-eyes, format for highlighting error messages and other at‐\ntention getters.  (If you have a choice, reverse video plus half-bright is good,  or  reverse\nvideo  alone.)  The sequences to enter and exit standout mode are given as smso and rmso, re‐\nspectively.  If the code to change into or out of standout mode leaves one or even two  blank\nspaces  on  the  screen, as the TVI 912 and Teleray 1061 do, then xmc should be given to tell\nhow many spaces are left.\n\nCodes to begin underlining and end underlining can be given as smul  and  rmul  respectively.\nIf  the  terminal has a code to underline the current character and move the cursor one space\nto the right, such as the Microterm Mime, this can be given as uc.\n\nOther capabilities to enter various highlighting modes include blink (blinking) bold (bold or\nextra  bright)  dim  (dim or half-bright) invis (blanking or invisible text) prot (protected)\nrev (reverse video) sgr0 (turn off all attribute modes) smacs (enter alternate character  set\nmode)  and  rmacs  (exit alternate character set mode).  Turning on any of these modes singly\nmay or may not turn off other modes.\n\nIf there is a sequence to set arbitrary combinations of modes, this should be  given  as  sgr\n(set  attributes), taking 9 parameters.  Each parameter is either 0 or nonzero, as the corre‐\nsponding attribute is on or off.  The 9 parameters are, in order:  standout,  underline,  re‐\nverse, blink, dim, bold, blank, protect, alternate character set.  Not all modes need be sup‐\nported by sgr, only those for which corresponding separate attribute commands exist.\n\nFor example, the DEC vt220 supports most of the modes:\n\ntparm parameter      attribute        escape sequence\n\nnone                 none             \\E[0m\np1                   standout         \\E[0;1;7m\np2                   underline        \\E[0;4m\np3                   reverse          \\E[0;7m\np4                   blink            \\E[0;5m\np5                   dim              not available\np6                   bold             \\E[0;1m\np7                   invis            \\E[0;8m\np8                   protect          not used\np9                   altcharset       ^O (off) ^N (on)\n\nWe begin each escape sequence by turning off any existing modes, since there is no quick  way\nto  determine  whether  they are active.  Standout is set up to be the combination of reverse\nand bold.  The vt220 terminal has a protect mode, though it is not commonly used in  sgr  be‐\ncause  it  protects  characters  on the screen from the host's erasures.  The altcharset mode\nalso is different in that it is either ^O or ^N, depending on whether it is off  or  on.   If\nall modes are turned on, the resulting sequence is \\E[0;1;4;5;7;8m^N.\n\nSome sequences are common to different modes.  For example, ;7 is output when either p1 or p3\nis true, that is, if either standout or reverse modes are turned on.\n\nWriting out the above sequences, along with their dependencies yields\n\nsequence             when to output      terminfo translation\n\n\\E[0                 always              \\E[0\n;1                   if p1 or p6         %?%p1%p6%|%t;1%;\n;4                   if p2               %?%p2%|%t;4%;\n;5                   if p4               %?%p4%|%t;5%;\n;7                   if p1 or p3         %?%p1%p3%|%t;7%;\n;8                   if p7               %?%p7%|%t;8%;\nm                    always              m\n^N or ^O             if p9 ^N, else ^O   %?%p9%t^N%e^O%;\n\nPutting this all together into the sgr sequence gives:\n\nsgr=\\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%;\n%?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\\016%e\\017%;,\n\nRemember that if you specify sgr, you must also specify  sgr0.   Also,  some  implementations\nrely  on sgr being given if sgr0 is, Not all terminfo entries necessarily have an sgr string,\nhowever.  Many terminfo entries are derived from termcap entries which have  no  sgr  string.\nThe  only  drawback  to  adding an sgr string is that termcap also assumes that sgr0 does not\nexit alternate character set mode.\n\nTerminals with the “magic cookie” glitch (xmc) deposit special “cookies”  when  they  receive\nmode-setting  sequences, which affect the display algorithm rather than having extra bits for\neach character.  Some terminals, such as the HP 2621, automatically leave standout mode  when\nthey move to a new line or the cursor is addressed.  Programs using standout mode should exit\nstandout mode before moving the cursor or sending a newline, unless the msgr capability,  as‐\nserting that it is safe to move in standout mode, is present.\n\nIf  the  terminal  has  a way of flashing the screen to indicate an error quietly (a bell re‐\nplacement) then this can be given as flash; it must not move the cursor.\n\nIf the cursor needs to be made more visible than normal when it is not on the bottom line (to\nmake,  for  example, a non-blinking underline into an easier to find block or blinking under‐\nline) give this sequence as cvvis.  If there is a way to make the cursor  completely  invisi‐\nble,  give  that  as civis.  The capability cnorm should be given which undoes the effects of\nboth of these modes.\n\nIf your terminal correctly generates underlined characters (with  no  special  codes  needed)\neven  though  it does not overstrike, then you should give the capability ul.  If a character\noverstriking another leaves both characters on the screen, specify  the  capability  os.   If\noverstrikes are erasable with a blank, then this should be indicated by giving eo.\n"
                },
                {
                    "name": "Keypad and Function Keys",
                    "content": "If the terminal has a keypad that transmits codes when the keys are pressed, this information\ncan be given.  Note that it is not possible to handle terminals where the keypad  only  works\nin  local  (this  applies, for example, to the unshifted HP 2621 keys).  If the keypad can be\nset to transmit or not transmit, give these codes as smkx and rmkx.  Otherwise the keypad  is\nassumed to always transmit.\n\nThe  codes  sent  by  the left arrow, right arrow, up arrow, down arrow, and home keys can be\ngiven as kcub1, kcuf1, kcuu1, kcud1, and khome respectively.  If there are function keys such\nas  f0, f1, ..., f10, the codes they send can be given as kf0, kf1, ..., kf10.  If these keys\nhave labels other than the default f0 through f10, the labels can be given as lf0, lf1,  ...,\nlf10.\n\nThe codes transmitted by certain other special keys can be given:\n\n•   kll (home down),\n\n•   kbs (backspace),\n\n•   ktbc (clear all tabs),\n\n•   kctab (clear the tab stop in this column),\n\n•   kclr (clear screen or erase key),\n\n•   kdch1 (delete character),\n\n•   kdl1 (delete line),\n\n•   krmir (exit insert mode),\n\n•   kel (clear to end of line),\n\n•   ked (clear to end of screen),\n\n•   kich1 (insert character or enter insert mode),\n\n•   kil1 (insert line),\n\n•   knp (next page),\n\n•   kpp (previous page),\n\n•   kind (scroll forward/down),\n\n•   kri (scroll backward/up),\n\n•   khts (set a tab stop in this column).\n\nIn  addition,  if  the  keypad  has a 3 by 3 array of keys including the four arrow keys, the\nother five keys can be given as ka1, ka3, kb2, kc1, and kc3.  These keys are useful when  the\neffects of a 3 by 3 directional pad are needed.\n\nStrings  to program function keys can be given as pfkey, pfloc, and pfx.  A string to program\nscreen labels should be specified as pln.  Each of these strings takes  two  parameters:  the\nfunction  key  number  to program (from 0 to 10) and the string to program it with.  Function\nkey numbers out of this range may program undefined keys in a terminal dependent manner.  The\ndifference  between  the  capabilities  is that pfkey causes pressing the given key to be the\nsame as the user typing the given string; pfloc causes the string to be executed by the  ter‐\nminal in local; and pfx causes the string to be transmitted to the computer.\n\nThe  capabilities  nlab,  lw and lh define the number of programmable screen labels and their\nwidth and height.  If there are commands to turn the labels on and off, give them in smln and\nrmln.   smln  is normally output after one or more pln sequences to make sure that the change\nbecomes visible.\n"
                },
                {
                    "name": "Tabs and Initialization",
                    "content": "A few capabilities are used only for tabs:\n\n•   If the terminal has hardware tabs, the command to advance to the next  tab  stop  can  be\ngiven as ht (usually control/I).\n\n•   A “back-tab” command which moves leftward to the preceding tab stop can be given as cbt.\n\nBy  convention,  if  the teletype modes indicate that tabs are being expanded by the com‐\nputer rather than being sent to the terminal, programs should not use ht or cbt  even  if\nthey are present, since the user may not have the tab stops properly set.\n\n•   If  the terminal has hardware tabs which are initially set every n spaces when the termi‐\nnal is powered up, the numeric parameter it is given, showing the number  of  spaces  the\ntabs are set to.\n\nThe  it  capability  is normally used by the tset command to determine whether to set the\nmode for hardware tab expansion, and whether to set the tab stops.  If the  terminal  has\ntab  stops  that can be saved in non-volatile memory, the terminfo description can assume\nthat they are properly set.\n\nOther capabilities include\n\n•   is1, is2, and is3, initialization strings for the terminal,\n\n•   iprog, the path name of a program to be run to initialize the terminal,\n\n•   and if, the name of a file containing long initialization strings.\n\nThese strings are expected to set the terminal into modes consistent with  the  rest  of  the\nterminfo description.  They are normally sent to the terminal, by the init option of the tput\nprogram, each time the user logs in.  They will be printed in the following order:\n\nrun the program\niprog\n\noutput\nis1 and\nis2\n\nset the margins using\nmgc or\nsmglp and smgrp or\nsmgl and smgr\n\nset tabs using\ntbc and hts\n\nprint the file\nif\n\nand finally output\nis3.\n\nMost initialization is done with is2.  Special terminal modes can be set up without duplicat‐\ning strings by putting the common sequences in is2 and special cases in is1 and is3.\n\nA set of sequences that does a harder reset from a totally unknown state can be given as rs1,\nrs2, rf and rs3, analogous to is1 , is2 , if and is3 respectively.  These strings are  output\nby  reset  option of tput, or by the reset program (an alias of tset), which is used when the\nterminal gets into a wedged state.  Commands are normally placed in rs1, rs2 rs3 and rf  only\nif  they  produce  annoying effects on the screen and are not necessary when logging in.  For\nexample, the command to set the vt100 into 80-column mode would normally be part of is2,  but\nit  causes  an annoying glitch of the screen and is not normally needed since the terminal is\nusually already in 80-column mode.\n\nThe reset program writes strings including iprog, etc., in the same order as  the  init  pro‐\ngram,  using rs1, etc., instead of is1, etc.  If any of rs1, rs2, rs3, or rf reset capability\nstrings are missing, the reset program falls back upon the corresponding initialization capa‐\nbility string.\n\nIf  there  are  commands  to set and clear tab stops, they can be given as tbc (clear all tab\nstops) and hts (set a tab stop in the current column of every row).  If a  more  complex  se‐\nquence is needed to set the tabs than can be described by this, the sequence can be placed in\nis2 or if.\n\nThe tput reset command uses the same capability strings as the reset  command,  although  the\ntwo programs (tput and reset) provide different command-line options.\n\nIn practice, these terminfo capabilities are not often used in initialization of tabs (though\nthey are required for the tabs program):\n\n•   Almost all hardware terminals (at least those which supported tabs) initialized those  to\nevery eight columns:\n\nThe only exception was the AT&T 2300 series, which set tabs to every five columns.\n\n•   In particular, developers of the hardware terminals which are commonly used as models for\nmodern terminal emulators provided documentation demonstrating that  eight  columns  were\nthe standard.\n\n•   Because  of  this,  the  terminal  initialization  programs  tput  and  tset  use the tbc\n(clearalltabs) and hts (settab) capabilities directly only when the it (inittabs) ca‐\npability is set to a value other than eight.\n"
                },
                {
                    "name": "Delays and Padding",
                    "content": "Many  older and slower terminals do not support either XON/XOFF or DTR handshaking, including\nhard copy terminals and some very archaic CRTs (including, for example, DEC  VT100s).   These\nmay require padding characters after certain cursor motions and screen changes.\n\nIf  the  terminal uses xon/xoff handshaking for flow control (that is, it automatically emits\n^S back to the host when its input buffers are close to full), set xon.  This capability sup‐\npresses  the  emission of padding.  You can also set it for memory-mapped console devices ef‐\nfectively that do not have a speed limit.  Padding information should still  be  included  so\nthat  routines can make better decisions about relative costs, but actual pad characters will\nnot be transmitted.\n\nIf pb (padding baud rate) is given, padding is suppressed at baud rates below  the  value  of\npb.   If  the  entry has no padding baud rate, then whether padding is emitted or not is com‐\npletely controlled by xon.\n\nIf the terminal requires other than a null (zero) character as a pad, then this can be  given\nas pad.  Only the first character of the pad string is used.\n"
                },
                {
                    "name": "Status Lines",
                    "content": "Some  terminals  have an extra “status line” which is not normally used by software (and thus\nnot counted in the terminal's lines capability).\n\nThe simplest case is a status line which is cursor-addressable  but  not  part  of  the  main\nscrolling  region  on the screen; the Heathkit H19 has a status line of this kind, as would a\n24-line VT100 with a 23-line scrolling region set up on initialization.   This  situation  is\nindicated by the hs capability.\n\nSome terminals with status lines need special sequences to access the status line.  These may\nbe expressed as a string with single parameter tsl which takes the cursor to  a  given  zero-\norigin  column  on the status line.  The capability fsl must return to the main-screen cursor\npositions before the last tsl.  You may need to embed the string values of sc  (save  cursor)\nand rc (restore cursor) in tsl and fsl to accomplish this.\n\nThe  status  line  is normally assumed to be the same width as the width of the terminal.  If\nthis is untrue, you can specify it with the numeric capability wsl.\n\nA command to erase or blank the status line may be specified as dsl.\n\nThe boolean capability eslok specifies that escape sequences, tabs, etc., work ordinarily  in\nthe status line.\n\nThe  ncurses  implementation does not yet use any of these capabilities.  They are documented\nhere in case they ever become important.\n"
                },
                {
                    "name": "Line Graphics",
                    "content": "Many terminals have alternate character sets useful for forms-drawing.  Terminfo  and  curses\nhave  built-in  support  for most of the drawing characters supported by the VT100, with some\ncharacters from the AT&T 4410v1 added.  This alternate character set may be specified by  the\nacsc capability.\n\nGlyph                       ACS            Ascii     acsc     acsc\nName                        Name           Default   Char     Value\n────────────────────────────────────────────────────────────────────\narrow pointing right        ACSRARROW     >         +        0x2b\narrow pointing left         ACSLARROW     <         ,        0x2c\narrow pointing up           ACSUARROW     ^         -        0x2d\narrow pointing down         ACSDARROW     v         .        0x2e\nsolid square block          ACSBLOCK      #         0        0x30\ndiamond                     ACSDIAMOND    +         `        0x60\nchecker board (stipple)     ACSCKBOARD    :         a        0x61\ndegree symbol               ACSDEGREE     \\         f        0x66\nplus/minus                  ACSPLMINUS    #         g        0x67\nboard of squares            ACSBOARD      #         h        0x68\nlantern symbol              ACSLANTERN    #         i        0x69\nlower right corner          ACSLRCORNER   +         j        0x6a\nupper right corner          ACSURCORNER   +         k        0x6b\nupper left corner           ACSULCORNER   +         l        0x6c\nlower left corner           ACSLLCORNER   +         m        0x6d\nlarge plus or crossover     ACSPLUS       +         n        0x6e\nscan line 1                 ACSS1         ~         o        0x6f\nscan line 3                 ACSS3         -         p        0x70\nhorizontal line             ACSHLINE      -         q        0x71\nscan line 7                 ACSS7         -         r        0x72\nscan line 9                 ACSS9                  s        0x73\ntee pointing right          ACSLTEE       +         t        0x74\ntee pointing left           ACSRTEE       +         u        0x75\ntee pointing up             ACSBTEE       +         v        0x76\ntee pointing down           ACSTTEE       +         w        0x77\nvertical line               ACSVLINE      |         x        0x78\nless-than-or-equal-to       ACSLEQUAL     <         y        0x79\ngreater-than-or-equal-to    ACSGEQUAL     >         z        0x7a\ngreek pi                    ACSPI         *         {        0x7b\nnot-equal                   ACSNEQUAL     !         |        0x7c\nUK pound sign               ACSSTERLING   f         }        0x7d\nbullet                      ACSBULLET     o         ~        0x7e\n\nA few notes apply to the table itself:\n\n•   X/Open  Curses  incorrectly states that the mapping for lantern is uppercase “I” although\nUnix implementations use the lowercase “i” mapping.\n\n•   The DEC VT100 implemented graphics using the alternate character set feature, temporarily\nswitching  modes  and  sending  characters in the range 0x60 (96) to 0x7e (126) (the acsc\nValue column in the table).\n\n•   The AT&T terminal added graphics characters outside that range.\n\nSome of the characters within the range do not match the VT100; presumably they were used\nin  the  AT&T terminal: board of squares replaces the VT100 newline symbol, while lantern\nsymbol replaces the VT100 vertical tab symbol.  The other VT100 symbols for control char‐\nacters (horizontal tab, carriage return and line-feed) are not (re)used in curses.\n\nThe best way to define a new device's graphics set is to add a column to a copy of this table\nfor your terminal, giving the character which (when  emitted  between  smacs/rmacs  switches)\nwill be rendered as the corresponding graphic.  Then read off the VT100/your terminal charac‐\nter pairs right to left in sequence; these become the ACSC string.\n"
                },
                {
                    "name": "Color Handling",
                    "content": "The curses library functions initpair and initcolor manipulate the color  pairs  and  color\nvalues  discussed  in this section (see curscolor(3X) for details on these and related func‐\ntions).\n\nMost color terminals are either “Tektronix-like” or “HP-like”:\n\n•   Tektronix-like terminals have a predefined set of N colors (where N is  usually  8),  and\ncan  set  character-cell  foreground and background characters independently, mixing them\ninto N * N color-pairs.\n\n•   On HP-like terminals, the user must set each color pair  up  separately  (foreground  and\nbackground  are  not independently settable).  Up to M color-pairs may be set up from 2*M\ndifferent colors.  ANSI-compatible terminals are Tektronix-like.\n\nSome basic color capabilities are independent of the color method.  The numeric  capabilities\ncolors  and pairs specify the maximum numbers of colors and color-pairs that can be displayed\nsimultaneously.  The op (original pair) string resets foreground  and  background  colors  to\ntheir  default  values  for  the terminal.  The oc string resets all colors or color-pairs to\ntheir default values for the terminal.  Some terminals (including many PC terminal emulators)\nerase  screen  areas with the current background color rather than the power-up default back‐\nground; these should have the boolean capability bce.\n\nWhile the curses library works with color pairs (reflecting the inability of some devices  to\nset foreground and background colors independently), there are separate capabilities for set‐\nting these features:\n\n•   To change the current foreground or background color on a  Tektronix-type  terminal,  use\nsetaf  (set ANSI foreground) and setab (set ANSI background) or setf (set foreground) and\nsetb (set background).  These take one parameter, the color number.  The SVr4  documenta‐\ntion  describes only setaf/setab; the XPG4 draft says that \"If the terminal supports ANSI\nescape sequences to set background and foreground, they should  be  coded  as  setaf  and\nsetab, respectively.\n\n•   If  the  terminal  supports other escape sequences to set background and foreground, they\nshould be coded as setf and setb, respectively.  The vidputs and  the  refresh(3X)  func‐\ntions use the setaf and setab capabilities if they are defined.\n\nThe  setaf/setab  and  setf/setb  capabilities take a single numeric argument each.  Argument\nvalues 0-7 of setaf/setab are portably defined as follows (the middle column is the  symbolic\n#define  available in the header for the curses or ncurses libraries).  The terminal hardware\nis free to map these as it likes, but the RGB  values  indicate  normal  locations  in  color\nspace.\n\nColor       #define       Value       RGB\nblack     COLORBLACK       0     0, 0, 0\nred       COLORRED         1     max,0,0\ngreen     COLORGREEN       2     0,max,0\nyellow    COLORYELLOW      3     max,max,0\nblue      COLORBLUE        4     0,0,max\nmagenta   COLORMAGENTA     5     max,0,max\ncyan      COLORCYAN        6     0,max,max\nwhite     COLORWHITE       7     max,max,max\n\nThe argument values of setf/setb historically correspond to a different mapping, i.e.,\n\nColor       #define       Value       RGB\nblack     COLORBLACK       0     0, 0, 0\nblue      COLORBLUE        1     0,0,max\ngreen     COLORGREEN       2     0,max,0\ncyan      COLORCYAN        3     0,max,max\nred       COLORRED         4     max,0,0\nmagenta   COLORMAGENTA     5     max,0,max\nyellow    COLORYELLOW      6     max,max,0\nwhite     COLORWHITE       7     max,max,max\n\nIt is important to not confuse the two sets of color capabilities; otherwise red/blue will be\ninterchanged on the display.\n\nOn an HP-like terminal, use scp with a color-pair number parameter to set which color pair is\ncurrent.\n\nSome terminals allow the color values to be modified:\n\n•   On  a  Tektronix-like terminal, the capability ccc may be present to indicate that colors\ncan be modified.  If so, the initc capability will take a color number  (0  to  colors  -\n1)and  three more parameters which describe the color.  These three parameters default to\nbeing interpreted as RGB (Red, Green, Blue) values.  If the  boolean  capability  hls  is\npresent,  they  are  instead as HLS (Hue, Lightness, Saturation) indices.  The ranges are\nterminal-dependent.\n\n•   On an HP-like terminal, initp may give a capability for changing a color-pair value.   It\nwill take seven parameters; a color-pair number (0 to maxpairs - 1), and two triples de‐\nscribing first background and then foreground colors.  These  parameters  must  be  (Red,\nGreen, Blue) or (Hue, Lightness, Saturation) depending on hls.\n\nOn  some  color terminals, colors collide with highlights.  You can register these collisions\nwith the ncv capability.  This is a bit-mask of attributes not to be used when colors are en‐\nabled.  The correspondence with the attributes understood by curses is as follows:\n\nAttribute              Bit   Decimal      Set by\nASTANDOUT             0     1            sgr\nAUNDERLINE            1     2            sgr\nAREVERSE              2     4            sgr\nABLINK                3     8            sgr\nADIM                  4     16           sgr\nABOLD                 5     32           sgr\nAINVIS                6     64           sgr\nAPROTECT              7     128          sgr\nAALTCHARSET           8     256          sgr\nAHORIZONTAL           9     512          sgr1\nALEFT                 10    1024         sgr1\nALOW                  11    2048         sgr1\nARIGHT                12    4096         sgr1\nATOP                  13    8192         sgr1\nAVERTICAL             14    16384        sgr1\nAITALIC               15    32768        sitm\n\nFor  example,  on  many IBM PC consoles, the underline attribute collides with the foreground\ncolor blue and is not available in color mode.  These should have an ncv capability of 2.\n\nSVr4 curses does nothing with ncv, ncurses recognizes it and optimizes the output in favor of\ncolors.\n"
                },
                {
                    "name": "Miscellaneous",
                    "content": "If  the terminal requires other than a null (zero) character as a pad, then this can be given\nas pad.  Only the first character of the pad string is used.  If the terminal does not have a\npad character, specify npc.  Note that ncurses implements the termcap-compatible PC variable;\nthough the application may set this value to something other than a null, ncurses  will  test\nnpc first and use napms if the terminal has no pad character.\n\nIf the terminal can move up or down half a line, this can be indicated with hu (half-line up)\nand hd (half-line down).  This is primarily useful for superscripts and subscripts  on  hard-\ncopy terminals.  If a hard-copy terminal can eject to the next page (form feed), give this as\nff (usually control/L).\n\nIf there is a command to repeat a given character a given  number  of  times  (to  save  time\ntransmitting  a  large number of identical characters) this can be indicated with the parame‐\nterized string rep.  The first parameter is the character to be repeated and  the  second  is\nthe  number  of  times  to  repeat  it.   Thus,  tparm(repeatchar,  'x',  10) is the same as\n“xxxxxxxxxx”.\n\nIf the terminal has a settable command character, such as the TEKTRONIX 4025, this can be in‐\ndicated  with  cmdch.  A prototype command character is chosen which is used in all capabili‐\nties.  This character is given in the cmdch capability to identify it.  The following conven‐\ntion  is supported on some UNIX systems: The environment is to be searched for a CC variable,\nand if found, all occurrences of the prototype character are replaced with the  character  in\nthe environment variable.\n\nTerminal  descriptions  that  do  not  represent  a  specific kind of known terminal, such as\nswitch, dialup, patch, and network, should include the gn (generic) capability so  that  pro‐\ngrams  can complain that they do not know how to talk to the terminal.  (This capability does\nnot apply to virtual terminal descriptions for which the escape sequences are known.)\n\nIf the terminal has a “meta key” which acts as a shift key, setting the 8th bit of any  char‐\nacter  transmitted, this fact can be indicated with km.  Otherwise, software will assume that\nthe 8th bit is parity and it will usually be cleared.  If strings exist to  turn  this  “meta\nmode” on and off, they can be given as smm and rmm.\n\nIf  the  terminal has more lines of memory than will fit on the screen at once, the number of\nlines of memory can be indicated with lm.  A value of lm#0 indicates that the number of lines\nis not fixed, but that there is still more memory than fits on the screen.\n\nIf the terminal is one of those supported by the UNIX virtual terminal protocol, the terminal\nnumber can be given as vt.\n\nMedia copy strings which control an auxiliary printer connected to the terminal can be  given\nas  mc0:  print  the  contents of the screen, mc4: turn off the printer, and mc5: turn on the\nprinter.  When the printer is on, all text sent to the terminal will be sent to the  printer.\nIt is undefined whether the text is also displayed on the terminal screen when the printer is\non.  A variation mc5p takes one parameter, and leaves the printer on for as  many  characters\nas  the  value of the parameter, then turns the printer off.  The parameter should not exceed\n255.  All text, including mc4, is transparently passed to the printer while an mc5p is in ef‐\nfect.\n"
                },
                {
                    "name": "Glitches and Braindamage",
                    "content": "Hazeltine terminals, which do not allow “~” characters to be displayed should indicate hz.\n\nTerminals  which  ignore  a  line-feed  immediately after an am wrap, such as the Concept and\nvt100, should indicate xenl.\n\nIf el is required to get rid of standout (instead of merely writing normal  text  on  top  of\nit), xhp should be given.\n\nTeleray  terminals,  where  tabs turn all characters moved over to blanks, should indicate xt\n(destructive tabs).  Note: the variable indicating this  is  now  “desttabsmagicsmso”;  in\nolder versions, it was telerayglitch.  This glitch is also taken to mean that it is not pos‐\nsible to position the cursor on top of a “magic cookie”, that to erase standout  mode  it  is\ninstead  necessary  to  use  delete and insert line.  The ncurses implementation ignores this\nglitch.\n\nThe Beehive Superbee, which is unable to correctly transmit the escape or  control/C  charac‐\nters,  has  xsb,  indicating  that the f1 key is used for escape and f2 for control/C.  (Only\ncertain Superbees have this problem, depending on the ROM.)  Note that in older terminfo ver‐\nsions, this capability was called “beehiveglitch”; it is now “noescctlc”.\n\nOther specific terminal problems may be corrected by adding more capabilities of the form xx.\n"
                },
                {
                    "name": "Pitfalls of Long Entries",
                    "content": "Long  terminfo  entries  are  unlikely to be a problem; to date, no entry has even approached\nterminfo's 4096-byte string-table maximum.  Unfortunately, the termcap translations are  much\nmore strictly limited (to 1023 bytes), thus termcap translations of long terminfo entries can\ncause problems.\n\nThe man pages for 4.3BSD and older versions of  tgetent  instruct  the  user  to  allocate  a\n1024-byte  buffer  for  the termcap entry.  The entry gets null-terminated by the termcap li‐\nbrary, so that makes the maximum safe length for a termcap entry 1k-1 (1023) bytes.   Depend‐\ning on what the application and the termcap library being used does, and where in the termcap\nfile the terminal type that tgetent is searching for is, several bad things can happen.\n\nSome termcap libraries print a warning message or exit if they find an  entry  that's  longer\nthan  1023 bytes; others do not; others truncate the entries to 1023 bytes.  Some application\nprograms allocate more than the recommended 1K for the termcap entry; others do not.\n\nEach termcap entry has two important sizes associated with it: before “tc” expansion, and af‐\nter “tc” expansion.  “tc” is the capability that tacks on another termcap entry to the end of\nthe current one, to add on its capabilities.  If a termcap entry does not use the “tc”  capa‐\nbility, then of course the two lengths are the same.\n\nThe “before tc expansion” length is the most important one, because it affects more than just\nusers of that particular terminal.  This  is  the  length  of  the  entry  as  it  exists  in\n/etc/termcap,  minus  the backslash-newline pairs, which tgetent strips out while reading it.\nSome termcap libraries strip off the final newline, too (GNU termcap does not).  Now suppose:\n\n•   a termcap entry before expansion is more than 1023 bytes long,\n\n•   and the application has only allocated a 1k buffer,\n\n•   and the termcap library (like the one in BSD/OS 1.1 and GNU) reads the whole  entry  into\nthe buffer, no matter what its length, to see if it is the entry it wants,\n\n•   and  tgetent  is  searching for a terminal type that either is the long entry, appears in\nthe termcap file after the long entry, or does not appear in the file  at  all  (so  that\ntgetent has to search the whole termcap file).\n\nThen  tgetent  will  overwrite memory, perhaps its stack, and probably core dump the program.\nPrograms like telnet are particularly vulnerable; modern telnets pass along values  like  the\nterminal  type  automatically.  The results are almost as undesirable with a termcap library,\nlike SunOS 4.1.3 and Ultrix 4.4, that prints warning messages when it reads  an  overly  long\ntermcap  entry.  If a termcap library truncates long entries, like OSF/1 3.0, it is immune to\ndying here but will return incorrect data for the terminal.\n\nThe “after tc expansion” length will have a similar effect to the above, but only for  people\nwho  actually  set TERM to that terminal type, since tgetent only does “tc” expansion once it\nis found the terminal type it was looking for, not while searching.\n\nIn summary, a termcap entry that is longer than 1023 bytes can cause, on various combinations\nof  termcap libraries and applications, a core dump, warnings, or incorrect operation.  If it\nis too long even before “tc” expansion, it will have this effect even for users of some other\nterminal types and users whose TERM variable does not have a termcap entry.\n\nWhen  in  -C (translate to termcap) mode, the ncurses implementation of tic(1) issues warning\nmessages when the pre-tc length of a termcap translation is too long.  The -c (check)  option\nalso checks resolved (after tc expansion) lengths.\n"
                },
                {
                    "name": "Binary Compatibility",
                    "content": "It  is  not  wise  to count on portability of binary terminfo entries between commercial UNIX\nversions.  The problem is that there are at least two versions of terminfo (under  HP-UX  and\nAIX)  which diverged from System V terminfo after SVr1, and have added extension capabilities\nto the string table that (in the binary format) collide with System V and XSI  Curses  exten‐\nsions.\n"
                }
            ]
        },
        "EXTENSIONS": {
            "content": "Searching  for terminal descriptions in $HOME/.terminfo and TERMINFODIRS is not supported by\nolder implementations.\n\nSome SVr4 curses implementations, and all previous to SVr4, do not interpret the  %A  and  %O\noperators in parameter strings.\n\nSVr4/XPG4  do  not specify whether msgr licenses movement while in an alternate-character-set\nmode (such modes may, among other things, map CR and NL to characters that do not trigger lo‐\ncal  motions).   The ncurses implementation ignores msgr in ALTCHARSET mode.  This raises the\npossibility that an XPG4 implementation making the opposite interpretation may need  terminfo\nentries made for ncurses to have msgr turned off.\n\nThe  ncurses  library  handles insert-character and insert-character modes in a slightly non-\nstandard way to get better update efficiency.  See  the  Insert/Delete  Character  subsection\nabove.\n\nThe parameter substitutions for setclock and displayclock are not documented in SVr4 or the\nXSI Curses standard.  They are deduced from the documentation for the AT&T 505 terminal.\n\nBe careful assigning the kmous capability.  The ncurses library  wants  to  interpret  it  as\nKEYMOUSE,  for  use by terminals and emulators like xterm that can return mouse-tracking in‐\nformation in the keyboard-input stream.\n\nX/Open Curses does not mention italics.  Portable applications must assume that numeric capa‐\nbilities  are  signed 16-bit values.  This includes the nocolorvideo (ncv) capability.  The\n32768 mask value used for italics with ncv can be confused with an absent or  cancelled  ncv.\nIf italics should work with colors, then the ncv value must be specified, even if it is zero.\n\nDifferent commercial ports of terminfo and curses support different subsets of the XSI Curses\nstandard and (in some cases) different extension sets.  Here is a summary, accurate as of Oc‐\ntober 1995:\n\n•   SVR4, Solaris, ncurses -- These support all SVr4 capabilities.\n\n•   SGI  --  Supports  the  SVr4  set,  adds  one  undocumented  extended  string  capability\n(setpglen).\n\n•   SVr1, Ultrix -- These support a restricted subset of terminfo capabilities.  The booleans\nend with xonxoff; the numerics with widthstatusline; and the strings with prtrnon.\n\n•   HP/UX  --  Supports the SVr1 subset, plus the SVr[234] numerics numlabels, labelheight,\nlabelwidth, plus function keys 11 through 63, plus plabnorm, labelon,  and  labeloff,\nplus some incompatible extensions in the string table.\n\n•   AIX  --  Supports the SVr1 subset, plus function keys 11 through 63, plus a number of in‐\ncompatible string table extensions.\n\n•   OSF -- Supports both the SVr4 set and the AIX extensions.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/terminfo/?/*        files containing terminal descriptions\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "infocmp(1), tabs(1), tic(1), ncurses(3NCURSES), color(3NCURSES),  cursesvariables(3NCURSES),\nprintf(3), terminfovariables(3NCURSES).  term(5).  usercaps(5).\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.  Based on pcurses by Pavel Curtis.\n\n\n\nterminfo(5)",
            "subsections": []
        }
    },
    "summary": "terminfo - terminal capability database",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "infocmp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/infocmp/1/json"
        },
        {
            "name": "tabs",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tabs/1/json"
        },
        {
            "name": "tic",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tic/1/json"
        },
        {
            "name": "ncurses",
            "section": "3NCURSES",
            "url": "https://www.chedong.com/phpMan.php/man/ncurses/3NCURSES/json"
        },
        {
            "name": "color",
            "section": "3NCURSES",
            "url": "https://www.chedong.com/phpMan.php/man/color/3NCURSES/json"
        },
        {
            "name": "cursesvariables",
            "section": "3NCURSES",
            "url": "https://www.chedong.com/phpMan.php/man/cursesvariables/3NCURSES/json"
        },
        {
            "name": "printf",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/printf/3/json"
        },
        {
            "name": "terminfovariables",
            "section": "3NCURSES",
            "url": "https://www.chedong.com/phpMan.php/man/terminfovariables/3NCURSES/json"
        },
        {
            "name": "term",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/term/5/json"
        },
        {
            "name": "usercaps",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/usercaps/5/json"
        }
    ]
}