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