# @(#)22        1.10  src/bos/usr/bin/file/magic, cmdfiles, bos411, 9428A410j 2/7/94 17:42:40
#  COMPONENT_NAME: (CMDFILES) commands that manipulate files
# 
#  FUNCTIONS:  magic file
# 
#  ORIGINS: 3, 27, 71
# 
#  (C) COPYRIGHT International Business Machines Corp. 1985, 1994
#  All Rights Reserved
#  Licensed Materials - Property of IBM
# 
#  US Government Users Restricted Rights - Use, duplication or
#  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# (c) Copyright 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
# ALL RIGHTS RESERVED
#
#
# OSF/1 1.1
#
#                                                                   
#
#               file cmd's magic file
#
#       Basically, the fields of this file are as follows:
#               1 byte offset,
#               2 value type,
#               3 optional relational operator ("=" by default) and
#                 value to match (numeric or string constant),
#               4 string to be printed.
#
#       Numeric values may be decimal, octal, or hexadecimal.
#	Strings can be entered as hex values by preceding them with
#	'0x'.
#       Also, the last string may have one printf format specification.
#
#       The '>' in occasional column 1's is magic: it forces file to
#       continue scanning and matching additional lines. The first line
#       afterwards not so marked terminates the search.
#
#	3.2.X Magic Values
#
0	short		0x01df		executable (RISC System/6000) or object module
>12	long		>0		not stripped
0	short		0x0104		shared library
0	long		505		message catalog
0       string          0xabcdef        message catalog
0       long            0x000001f9      compiled message catalog
257	string		ustar		tar archive
0       long            0x09006bea      backup/restore format file
0	short		070707		cpio archive
0	string		070707		ASCII cpio archive
0	short		017436		packed text
0	string		<aiaff>		archive
0	string		Rast		RST format font raster
0	short		0x0103		executable (RT Version 2) or obj module
>2	byte		0x50		pure
>28	long		>0		not stripped
>6	short		>0		- version %ld
0	short		0x0105		ctab data
0	short		0xfe04		structured file
0	short		0x1f9d		compressed data
>2	byte		&0x80>0		block compressed
>2	byte		&0x1f>0		%d bit
#
0       string          <!OP		Interleaf "ascii" format
1       string          OPS		Interleaf binary format
1       string          [C		3812 print file
0	string		BEGIN		awk script
0	short		0xffd8		jpeg image file
0	string		%!PS		PostScript file
0	string		StartFontMetrics	Adobe PostScript Type1 font metrics file (afm) (afmbin)
0	string		STARTFONT	Bitmap Distribution Format (bdf) font file (X11)
1	string		fcp		(pcf) font file (X11R5) (LSB)
0	string		pcf		(pcf) font file (X11R5) (MSB)
0	string		D1.0		Speedo scalable font file (spd)
0	string		From		unix mail file
2	string		-lh		Lharc or LArc archive file
2	string		-lz		Lharc or LArc archive file
0	long		0x000001b3	MPEG (.mpg/.mpeg) compressed digital video
0	string		PK		PKZIP (.zip) compressed archive
1	string		PK		PKZIP (.zip) compressed archive
0	string		.snd		audio file (.au)
0	string		FORM		audio file (.iff)
0	string		RIFF		audio file (.wav)
0	string		Creative	Creative Voice File (.voc)
0       string          GIF		Graphics Interchange Format (GIF) file
0	string		ZOO 		Zoo archive file (PC)
0	short		0x1a08		Arc archive file (PC)
0       string          P1		Portable BitMap (PBM) file (ascii)
0       string          P2		Portable GrayMap (PGM) file (ascii)
0       string          P3		Portable PixMap (PPM) file (ascii)
0       string          P4		Portable BitMap (PBM) file (raw)
0       string          P5		Portable GrayMap (PGM) file (raw)
0       string          P6		Portable Pixmap (PPM) file (raw)
0	string		MZ		DOS executable (EXE)
0	byte		0xe9		DOS executable (COM)
0	byte		0xeb		DOS executable (COM)


#
#	OSF 1.1 Magic Values
#

#
# OSF/Rose for Big-endian machines.
#
0	long		0xbeefface	OSF/Rose object
>16	long		0x00000001	MIPS
>16	long		0x00000002	National 32x32
>16	long		0x00000003	Intel [34]86
>16	long		0x00000004	Motorola 68xxx
>28	long		0x00000002	Object file
>28	long		0x0000000c	Program file
>28	long		0x0000001c	Program file, unresolved references

#
# Archive files
#
0	string	!<arch>			archive
>8	string	__.SYMDEF		random library
>8	string 	__________E		- MIPS
0	long	0177555			very old pdp11 archive
0	short	0177545			old pdp11 archive/4.0 archive
0	string	<ar>			System V archive
>20	string	U			with mipsucode members
>21	string	L			with mipsel members
>21	string	B			with mipseb members
>19	string	L			and a EL hash table
>19	string	B			and a EB hash table
>22	string	X			-- out of date
0	long	0100554			apl workspace
0	short	017037			packed data
0	short	017777			compacted data (4.1bsd)
0	short	0116437			compressed data 
0	string	begin			uuencoded data

#
#  All sorts of scripts (with a single space after "#!")
#  0x232120 corresponds with "#! ", this value must be entered as hex
#  because space characters are used as delimiters.
#
0	string	0x232120		shell script 
>3      string  /bin/sh                 - sh (default shell)
>3      string  /sbin/sh                - sh (default shell)
>3      string  /usr/bin/sh             - sh (default shell)
>3      string  /bin/bsh                - bsh (Bourne shell)
>3      string  /sbin/bsh               - bsh (Bourne shell)
>3      string  /usr/bin/bsh            - bsh (Bourne shell)
>3      string  /bin/csh                - csh (C shell)
>3      string  /usr/bin/csh            - csh (C shell)
>3      string  /bin/ksh                - ksh (Korn shell)
>3      string  /usr/bin/ksh            - ksh (Korn shell)
>3      string  /bin/tcsh               - tcsh
>3      string  /usr/bin/tcsh           - tcsh
>3      string  /bin/rsh                - rsh (remote shell)
>3      string  /usr/bin/rsh            - rsh (remote shell)
>3      string  /bin/Rsh                - bsh (restricted)
>3      string  /usr/bin/Rsh            - bsh (restricted)
>3      string  /bin/psh                - psh (POSIX shell)
>3      string  /usr/bin/psh            - psh (POSIX shell)

#
#  All sorts of scripts (without space after "#!")
#
0	string	#!			shell script 
>2      string  /bin/sh                 - sh (default shell)
>2      string  /sbin/sh                - sh (default shell)
>2      string  /usr/bin/sh             - sh (default shell)
>2      string  /bin/bsh                - bsh (Bourne shell)
>2      string  /sbin/bsh               - bsh (Bourne shell)
>2      string  /usr/bin/bsh            - bsh (Bourne shell)
>2      string  /bin/csh                - csh (C shell)
>2      string  /usr/bin/csh            - csh (C shell)
>2      string  /bin/ksh                - ksh (Korn shell)
>2      string  /usr/bin/ksh            - ksh (Korn shell)
>2      string  /bin/tcsh               - tcsh
>2      string  /usr/bin/tcsh           - tcsh
>2      string  /bin/rsh                - rsh (remote shell)
>2      string  /usr/bin/rsh            - rsh (remote shell)
>2      string  /bin/Rsh                - bsh (restricted)
>2      string  /usr/bin/Rsh            - bsh (restricted)
>2      string  /bin/psh                - psh (POSIX shell)
>2      string  /usr/bin/psh            - psh (POSIX shell)

#
#  Various sorts of executable images.  
#
0	short	0401		Ultrix-11 Stand-alone or boot executable
0	short	0405		old overlay
#
0	short	0407		VAX executable (object file)
>8	short	>0		not stripped
#
0	long	0410		VAX pure executable
>16	long	>0		not stripped
>2	short	>0		- version %d
#
0	short	0411		pdp-11 separate I&D
>8	short	>0		not stripped
>15	byte	>0		- version %ld
#
0	short	0413		VAX demand paged pure executable
>2	short	02		POSIX
>2	short	01		SVID
>16	long	>0		not stripped
#
0	short	0430		Ultrix-11 overlay text kernel executable
0	short	0431		Ultrix-11 user overlay (separated I&D) executable
0	short	0437		pdp11 kernel overlay
0	short	0450		Ultrix-11 overlay kernel executable
0	short	0451		Ultrix-11 overlay kernel (separated I&D) executable
#
0	short	0510		ns16000
>28	short	0407		unpure text executable
>28	short	0410		pure executable
>28	short	0413		demand-paged executable
>12	long	>0		not stripped
>30	short	>0		- version %ld
>30	short	0		-
#
0	short	0515		ns16000
>28	short	0407		unpure text executable
>28	short	0410		pure executable
>28	short	0413		demand-paged executable
>12	long	>0		not stripped
>30	short	>0		- version %ld
>30	short	0		-
#
0	short	0524		ns32000
>18	short	&0004000	apc-II
>18	short	&0010000	xpc532
>18	short	&0020000	xpc w/381 fpu
>18	short	&0040000	xpc w/580 fpu
>20	short	0407		unpure text executable
>20	short	0410		pure executable
>20	short	0413		demand-paged executable
>20	short	0417		unsupported executable
>12	long	>0		not stripped
>22	short	0		-
# 
0	short	0525		ns32000
>18	short	&0004000	apc-II
>18	short	&0010000	xpc532
>18	short	&0020000	xpc w/381 fpu
>18	short	&0040000	xpc w/580 fpu
>20	short	0407		executable
>20	short	0410		pure executable
>20	short	0413		demand-paged executable
>20	short	0417		unsupported executable
>12	long	>0		not stripped
>22	short	0		-
#
0	short	0540		mipseb
>20	short	0407		executable
>20	short	0410		pure
>20	short	0413		demand paged
>8	long	>0		not stripped
>8	long	<0		not stripped
#
0	short	0542		mipsel
>20	short	0407		407
>20	short	0410		pure
>20	short	0413		demand paged
>8	long	0		executable
>8	long	>0		not stripped
>8	long	<0		not stripped
#
0	short	0565		i386 COFF object
#
0	short	0600		mipseb ucode
0	short	0602		mipsel ucode
#
0	short	060001		swapped mipseb
>20	short	03401		executable
>20	short	04001		pure
>20	short	05401		demand paged
>8	long	>0		not stripped
>8	long	<0		not stripped
#
0	short	061001		swapped mipsel
>20	short	03401		407
>20	short	04001		pure
>20	short	05401		demand paged
>8	long	0		executable
>8	long	>0		not stripped
>8	long	<0		not stripped
#
#  Various sorts of text and data files.
#
0	string	head		RCS file
#
0	long	04553207	X image
0       long    0xdeadbeef      core file

#
# From AIX PS/2 1.2.1
#

0	short		0x04fe		structured file
0	short		017437		packed text
0	short		0514		386 System V demand paged executable
>12	long		>0		not stripped
0	short		0537		370 XA sysV executable 
>12	long		>0		not stripped
>22	short		>0		- version %d
>30	long		>0		- 5.2 format
0	short		0535		370 sysV executable 
>12	long		>0		not stripped
>22	short		>0		- version %d
>30	long		>0		- 5.2 format
0	short		0532		370 XA sysV pure executable 
>12	long		>0		not stripped
>22	short		>0		- version %d
>30	long		>0		- 5.2 format
0	short		0530		370 sysV pure executable 
>12	long		>0		not stripped
>22	short		>0		- version %d
>30	long		>0		- 5.2 format
0	short		054001		370 sysV pure executable
>12	long		>0		not stripped
0	short		055001		370 XA sysV pure executable
>12	long		>0		not stripped
0	short		056401		370 sysV executable
>12	long		>0		not stripped
0	short		057401		370 XA sysV executable
>12	long		>0		not stripped
0	short		0502		basic-16 executable
>12	long		>0		not stripped
0	short		0503		basic-16 executable (TV)
>12	long		>0		not stripped
0	short		0511		x86 executable (TV)
>12	long		>0		not stripped
0	short		0550		3b20d executable
>12	long		>0		not stripped
0	short		0551		3b20d executable (TV)
>12	long		>0		not stripped
0	short		0560		3b5 executable
>12	long		>0		not stripped
0	short		0561		3b5 executable (TV)
>12	long		>0		not stripped
0	short		0570		vax sysV executable
>12	long		>0		not stripped
>22	short		>0		- version %ld
0	short		0575		vax sysV pure executable
>12	long		>0		not stripped
>22	short		>0		- version %ld
0	short		074001		vax SysV executable
>12	long		>0		not stripped
>22	short		>0		- version %d
0	short		076401		vax SysV pure executable
>12	long		>0		not stripped
>22	short		>0		- version %d
0	short		02401		vax bsd overlay
0	short		03401		vax bsd executable
>16	long		>0		not stripped
>2	short		>0		- version %d
0	short		04001		vax bsd pure executable
>16	long		>0		not stripped
>2	short		>0		- version %d
0	short		04401		vax bsd separate I&D executable
>16	long		>0		not stripped
>2	short		>0		- version %d
0	short		05401		vax bsd demand paged executable
>16	long		>0		not stripped
>2	short		>0		- version %d
0	short		046001		386 System V demand paged executable
>12	long		>0		not stripped
0	short		072401		386 AIX demand paged executable
>12	long		>0		not stripped
0	byte		0x80		8086 relocatable
0	short		0xff65		Xenix archive 
0	short		062777		Xenix archive
1	string		makefile	PBE makefile

#
#
#FrameMaker files
#
#

0      string          <MakerFile      FrameMaker document
>11    string          3.0              (3.0
>11    string          2.0              (2.0
>11    string          1.0              (1.0
>14    byte            x                 %c)
0      string          <MIFFile        FrameMaker MIF file
>9     string          3.0              (3.0)
>9     string          2.0              (2.0)
>9     string          1.0              (1.x)
0      string          <MakerDictionar FrameMaker Dictionary file
>17    string          2.0              (2.0)
>17    string          1.0              (1.x)
0      string          <MakerScreenFon FrameMaker Font file
>17    string          1.01             (%s)
0      string          <MML            FrameMaker MML file
0      string          <Book           FrameMaker Book file
>10    string          2.0              (2.0
>10    string          1.0              (1.0
>13    byte            x                 %c)
0      string          Maker Intermediate Print File   FrameMaker IPL file

