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