xref: /freebsd/contrib/ncurses/misc/magic (revision 21817992b3314c908ab50f0bb88d2ee750b9c4ac)
1# $Id: magic,v 1.5 2023/09/23 23:37:26 tom Exp $
2##############################################################################
3# Copyright 2020,2023 Thomas E. Dickey                                       #
4# Copyright 2015,2018 Free Software Foundation, Inc.                         #
5#                                                                            #
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:                                                      #
13#                                                                            #
14# The above copyright notice and this permission notice shall be included in #
15# all copies or substantial portions of the Software.                        #
16#                                                                            #
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.                                                  #
24#                                                                            #
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               #
28# authorization.                                                             #
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
34#
35# URL: https://invisible-island.net/ncurses/man/term.5.html
36# URL: https://invisible-island.net/ncurses/man/scr_dump.5.html
37#
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
41# and HELP.DSK
420	string		\032\001
43# 5th character of terminal name list, but not Targa image pixel size (15 16 24 32)
44>16	ubyte		>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
48# no extension
49#!:ext
50#
51#------------------------------------------------------------------------------
52# The following was added for ncurses6 development:
53#------------------------------------------------------------------------------
54#
550	string		\036\002
56# imitate the legacy compiled-format, to get the entry-name printed
57>16	ubyte		>32
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
61#
62# While the compiled terminfo uses little-endian format irregardless of
63# platform, System V screen dumps do not.  They came later, and that detail was
64# overlooked.
65#
66# AIX and HPUX use the SVr4 big-endian format
67# Solaris uses the SVr3 formats (sparc and x86 differ endian-ness)
680	beshort		0433 		SVr2 curses screen image, big-endian
690	beshort		0434		SVr3 curses screen image, big-endian
700	beshort		0435		SVr4 curses screen image, big-endian
71#
720	leshort		0433		SVr2 curses screen image, little-endian
730	leshort		0434		SVr3 curses screen image, little-endian
740	leshort		0435		SVr4 curses screen image, little-endian
75#
76# Rather than SVr4, Solaris "xcurses" writes this header:
770	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
85#
86# ncurses5 (and before) did not use a magic number, making screen dumps "data".
87# ncurses6 (2015) uses this format, ignoring byte-order
880	string	\210\210\210\210ncurses	ncurses6 screen image
89#
90# PDCurses added this in 2005
910	string		PDC\001		PDCurses screen image
92