~ubuntu-branches/ubuntu/hoary/cdrtools/hoary

« back to all changes in this revision

Viewing changes to libfile/README

  • Committer: Bazaar Package Importer
  • Author(s): Eduard Bloch
  • Date: 2002-04-09 10:03:06 UTC
  • Revision ID: james.westby@ubuntu.com-20020409100306-t4hagiv7gm0fhggv
Tags: upstream-1.10
ImportĀ upstreamĀ versionĀ 1.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# @(#)README    1.1 98/06/16 joerg
 
2
 
 
3
Find file types by using a modified "magic" file
 
4
 
 
5
Based on file v3.22 by Ian F. Darwin (see libfile/LEGAL.NOTICE and
 
6
libfile/README.dist - File v3.22 can be found at many archive sites)
 
7
 
 
8
For each entry in the magic file, the "message" for the initial offset MUST
 
9
be 4 characters for the CREATOR and 4 characters for the TYPE - white space is
 
10
optional between them. Any other characters on this line are ignored.
 
11
Continuation lines (starting with a '>') are also ignored i.e. only the initial
 
12
offset lines are used.
 
13
 
 
14
e.g magic entry for a GIF file:
 
15
 
 
16
# off   type            test            message
 
17
#
 
18
# GIF image
 
19
0       string          GIF8            8BIM GIFf
 
20
>4      string          7a              \b, version 8%s,
 
21
>4      string          9a              \b, version 8%s,
 
22
>6      leshort         >0              %hd x
 
23
>8      leshort         >0              %hd,
 
24
#>10    byte            &0x80           color mapped,
 
25
#>10    byte&0x07       =0x00           2 colors
 
26
#>10    byte&0x07       =0x01           4 colors
 
27
#>10    byte&0x07       =0x02           8 colors
 
28
#>10    byte&0x07       =0x03           16 colors
 
29
#>10    byte&0x07       =0x04           32 colors
 
30
#>10    byte&0x07       =0x05           64 colors
 
31
#>10    byte&0x07       =0x06           128 colors
 
32
#>10    byte&0x07       =0x07           256 colors
 
33
 
 
34
Just the "8BIM" "GIFf" will be used whatever the type of GIF file it is.
 
35
The continuation lines are used by the "file" command, but ignored by
 
36
mkhybrid. They could be left out completely.
 
37
 
 
38
The complete format of the magic file is given in the magic man page (magic.5).
 
39
 
 
40
See the file "magic" for other examples
 
41
 
 
42
Use with the -magic magic_file option, where magic_file is a file
 
43
described above.
 
44
 
 
45
The magic file can be used with the mapping file (option -map) - the order
 
46
these options appear on the command line is important.  mkhybrid will try to
 
47
detect if the file is one of the Unix/Mac files (e.g. a CAP or Netatalk
 
48
file) first. If that fails, it will then use the magic and/or mapping
 
49
file e.g:
 
50
 
 
51
mkhybrid -o output.raw -map mapping -magic magic src_dir
 
52
 
 
53
The above will check filename extensions first, if that fails to set the
 
54
CREATOR/TYPE, the magic file will be used. To check the magic file
 
55
before the filename extensions, use:
 
56
 
 
57
mkhybrid -o output.raw -magic magic -map mapping src_dir
 
58
 
 
59
 
 
60
Using just a magic file - filename extensions will not be checked e.g:
 
61
 
 
62
mkhybrid -o output.raw -magic magic src_dir
 
63
 
 
64
For the magic method to work, each file must be opened and read twice
 
65
(once to find it's CREATOR/TYPE, and a second time to actually copy the
 
66
file to the CD image). Therefore the -magic option may significantly
 
67
increase processing time.
 
68
 
 
69
If a file's CREATOR/TYPE is not set via the magic and mapping matches,
 
70
then the file is given the default CREATOR/TYPE.