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