1 # $Id: magic,v 1.3 2020/02/02 23:34:34 tom Exp $
2 ##############################################################################
3 # Copyright 2020 Thomas E. Dickey #
4 # Copyright 2015,2018 Free Software Foundation, Inc. #
6 # Permission is hereby granted, free of charge, to any person obtaining a #
7 # copy of this software and associated documentation files (the "Software"), #
8 # to deal in the Software without restriction, including without limitation #
9 # the rights to use, copy, modify, merge, publish, distribute, distribute #
10 # with modifications, sublicense, and/or sell copies of the Software, and to #
11 # permit persons to whom the Software is furnished to do so, subject to the #
12 # following conditions: #
14 # The above copyright notice and this permission notice shall be included in #
15 # all copies or substantial portions of the Software. #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
20 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
22 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
23 # DEALINGS IN THE SOFTWARE. #
25 # Except as contained in this notice, the name(s) of the above copyright #
26 # holders shall not be used in advertising or otherwise to promote the sale, #
27 # use or other dealings in this Software without prior written #
29 ##############################################################################
30 # for reference, from file 5.30:
31 #------------------------------------------------------------------------------
32 # @File: terminfo,v 1.7 2016/03/17 21:02:29 christos Exp @
33 # terminfo: file(1) magic for terminfo
35 # URL: https://invisible-island.net/ncurses/man/term.5.html
36 # URL: https://invisible-island.net/ncurses/man/scr_dump.5.html
38 # Workaround for Targa image type by Joerg Jenderek
39 # GRR: line below too general as it catches also
40 # Targa image type 1 with 26 long identification field
43 # 5th character of terminal name list, but not Targa image pixel size (15 16 24 32)
45 # namelist, if more than 1 separated by "|" like "st|stterm| simpleterm 0.4.1"
46 >>12 regex \^[a-zA-Z0-9][a-zA-Z0-9.][^|]* Compiled terminfo entry "%-s"
47 !:mime application/x-terminfo
51 #------------------------------------------------------------------------------
52 # The following was added for ncurses6 development:
53 #------------------------------------------------------------------------------
56 # imitate the legacy compiled-format, to get the entry-name printed
58 # namelist, if more than 1 separated by "|" like "st|stterm| simpleterm 0.4.1"
59 >>12 regex \^[a-zA-Z0-9][a-zA-Z0-9.][^|]* Compiled 32-bit terminfo entry "%-s"
60 !:mime application/x-terminfo2
62 # While the compiled terminfo uses little-endian format irregardless of
63 # platform, SystemV screen dumps do not. They came later, and that detail was
66 # AIX and HPUX use the SVr4 big-endian format
67 # Solaris uses the SVr3 formats (sparc and x86 differ endian-ness)
68 0 beshort 0433 SVr2 curses screen image, big-endian
69 0 beshort 0434 SVr3 curses screen image, big-endian
70 0 beshort 0435 SVr4 curses screen image, big-endian
72 0 leshort 0433 SVr2 curses screen image, little-endian
73 0 leshort 0434 SVr3 curses screen image, little-endian
74 0 leshort 0435 SVr4 curses screen image, little-endian
76 # Rather than SVr4, Solaris "xcurses" writes this header:
77 0 regex \^MAX=[0-9]+,[0-9]+$
78 >1 regex \^BEG=[0-9]+,[0-9]+$
79 >2 regex \^SCROLL=[0-9]+,[0-9]+$
80 >3 regex \^VMIN=[0-9]+$
81 >4 regex \^VTIME=[0-9]+$
82 >5 regex \^FLAGS=0x[[:xdigit:]]+$
83 >6 regex \^FG=[0-9],[0-9]+$
84 >7 regex \^BG=[0-9]+,[0-9]+, Solaris xcurses screen image
86 # ncurses5 (and before) did not use a magic number, making screen dumps "data".
87 # ncurses6 (2015) uses this format, ignoring byte-order
88 0 string \210\210\210\210ncurses ncurses6 screen image
90 # PDCurses added this in 2005
91 0 string PDC\001 PDCurses screen image