?? magic.5
字號:
.\" SCCSID: @(#)MAGIC.5 11/3/88.TH magic 5.SH Namemagic \- magic file for the file command.SH Syntax.B /usr/lib/file/magic.SH Description.NXR "file command" "magic file".NXR "magic file"The magic file is used by the .PN filecommandto identify files that have some sort of .I magic number.A magic numberis any numeric or string constant that identifies the filecontaining the constant..PPThe .PN magic file is formatted as follows:.IP "Byte offset" 5The byte offset is where .PN magic information is found in the file. This is the number of bytes from the beginning of thefile to the first byte of the magic number or string. This may,optionally, be preceded by a right angle bracket (>) to indicate a continuationline to supply extra information in the printed message..IP "Value type" The value type is the type of the information to be found at thespecified byte offset. The file data is interpreted as the following valid types:.sp.RS 10.nfbyte Unsigned char typeshort Unsigned short typelong Long typestring Character (byte) string.fi.RE.IP "Optional operator"Describes how the value specified here should becompared with the data at the desired offset. Valid operatorcharacters are: an equal sign, a right angle bracket, and a left angle bracket(=, >, <). If none is specified, = is assumed..IP "Value" The value to match. Numeric values may be decimal, octal,or hexadecimal. String values are defined as regular expressions here.The regular expressions used here are extended in two ways fromregular expression definition in ed(1)..RS 10.IP "1." 4Normally unprintable characters may be escaped with a backslash (\\). Thespecial characters \\n, \\b, \\r, and \\f are allowed. An octalrepresentation can also be used to insert any desired byte value,except 0. Normally, regular expression cannot handle such character values. Because the backslash is used as an escapecharacter while the regular expression is being read in, normaloccurrences of a backslash in a regular expression must be escapedwith a second backslash. As an example, \\( must be written as \\\\(and \\. must be written as \\\\..IP "2." Text found in a file can also be inserted in the printed stringwith the use of the \\\\% delimiter. All text found between thesedelimiters is substituted into the print string. .IPThis regular expression search neverterminates until a match is explicitly found or rejected. The specialcharacter \\n isa valid character in the patterns. Therefore, the pattern .*should never be used here..RE.IP "major, minor type" The major and minor file type numbers arenot used by the .MS file 1 command..IP "String to print"Any desired text string. Data from the filecan be included with the use of continuation lines beginningwith a right angle bracket (>). Two types of continuation lines are possible,depending on the sign of the byte offset entry..IPIf the byte offsetis positive, the specified data can be printed in the stringwhen requested with an appropriate .MS printf 3format. .IPIf the offsetis a negative number, an internal routine will be calledto test if a particular string is necessary and, if so, to returnit. .IPThe byte offset number is an index to an internal table ofroutines available for use. Two such routines are currentlydefined, both for a.out images:.sp.br.B Byte Offset Returned String(s).sp.br\-1: ["old version 7 style symbol table"].br\-2: ["setuid "]["setgid "]["sticky "].SH ExamplesThe following is an example of a script.The second line adds setuid, setgid text, if appropriate:.EX 00 string ^#![ ]*\\%[^ \n]*\\% 7,4 %s>-2 long 0 7,4 %sscript.EEThe following is an example of an executable image:.EX 0>-1 long 0 12,3 %s0 short 0413 12,4 demand paged pure>2 short 02 12,4 POSIX>2 short 01 12,4 SVID>-2 long 0 12,4 %sexecutable>16 long >0 12,4 not stripped.EEThe following is an example of a text file:.EX 00 string ^\01h[0-9][0-9][0-9][0-9][0-9] 7,1 sccsfile.EE.SH Files .PN /usr/lib/file/magic.SH See Alsofile(1)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -