Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)

le(1) OSS Shell and Utilities Reference Manual
NAME
le - Determines le type from le content
SYNOPSIS
le le ...
DESCRIPTION
The le command reads les, performs a series of tests on each one, and attempts to classify them
by type. le then writes the le types to standard output.
The le utility uses the following steps to determine the type of a le:
Uses the stat( ) function to determine if the le operand is a regular le or a special le
such as a directory, a named pipe (FIFO), or a le in the Guardian le system.
Checks regular les to determine if they are HP-generated object les.
Examines the rst 512 bytes of object les other than HP object les to determine the le
type; uses the /etc/magic le to check for magic values.
Invokes a Guardian procedure call for Guardian text les to retrieve the Guardian specic
le attributes, le type, and le code.
If a le appears to be plain text, le examines the rst 512 bytes and tries to determine what kind
of text it is. If the rst 512 bytes only contain ASCII characters, le returns either ASCII text or
English text. If the le contains other characters (that is, European or Asian xtended charac-
ters), le returns data.Ifale does not appear to be plain text, le attempts to distinguish a
binary data le from a text le that contains extended characters.
/etc/magic File
The le command uses the /etc/magic le to identify les that have a magic number (that is, con-
tain a string constant that indicates type).
The following magic values are supported:
Table 31. Supported Magic Values
__________________________________________________________
Byte Offset Value Type Magic Value Printed String
__________________________________________________________
0 short 070707 cpio archive
0 string 070707 ASCII cpio archive
0 string %! PostScript document
0 string <MakerFile FrameMaker document
0 string <MIFFile FrameMaker MIF le
0 string <MML FrameMaker MML le
0 string !<arch> archive
257 string ustar tar archive
40 string SunBin Sun binary
__________________________________________________________
You can add other magic values to the /etc/magic le.
Use on Guardian Objects
Specify Guardian les with the /G pathname convention.
The le command uses the stat( ) function to determine the le type. Guardian processes with sub-
type 30 are identied as character special les. Guardian pathnames consisting of only /G,
volume names, or subvolume names are identied as directory. Guardian nondisk devices and
processes that are not of subtype 30 are identied as block special.
For disk les, the le utility checks the le format and returns its type. The le utility can only
detect object les created by HP compilers and tools. Object les generated by other sources are
3134 Hewlett-Packard Company 527188-004