Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / file / Magdir / macintosh
1
2 #------------------------------------------------------------------------------
3 # macintosh description
4 #
5 # BinHex is the Macintosh ASCII-encoded file format (see also "apple")
6 # Daniel Quinlan, quinlan@yggdrasil.com
7 11      string  must\ be\ converted\ with\ BinHex       BinHex binary text
8 >41     string  x                                       \b, version %.3s
9
10 # Stuffit archives are the de facto standard of compression for Macintosh
11 # files obtained from most archives. (franklsm@tuns.ca)
12 0       string          SIT!                    StuffIt Archive (data)
13 >2      string          x                       : %s
14 0       string          SITD                    StuffIt Deluxe (data)
15 >2      string          x                       : %s
16 0       string          Seg                     StuffIt Deluxe Segment (data)
17 >2      string          x                       : %s
18
19 # Newer StuffIt archives (grant@netbsd.org)
20 0       string          StuffIt                 StuffIt Archive
21 >162    string          >0                      : %s
22
23 # Macintosh Applications and Installation binaries (franklsm@tuns.ca)
24 0       string          APPL                    Macintosh Application (data)
25 >2      string          x                       \b: %s
26
27 # Macintosh System files (franklsm@tuns.ca)
28 0       string          zsys                    Macintosh System File (data)
29 0       string          FNDR                    Macintosh Finder (data)
30 0       string          libr                    Macintosh Library (data)
31 >2      string          x                       : %s
32 0       string          shlb                    Macintosh Shared Library (data)
33 >2      string          x                       : %s
34 0       string          cdev                    Macintosh Control Panel (data)
35 >2      string          x                       : %s
36 0       string          INIT                    Macintosh Extension (data)
37 >2      string          x                       : %s
38 0       string          FFIL                    Macintosh Truetype Font (data)
39 >2      string          x                       : %s
40 0       string          LWFN                    Macintosh Postscript Font (data)
41 >2      string          x                       : %s
42
43 # Additional Macintosh Files (franklsm@tuns.ca)
44 0       string          PACT                    Macintosh Compact Pro Archive (data)
45 >2      string          x                       : %s
46 0       string          ttro                    Macintosh TeachText File (data)
47 >2      string          x                       : %s
48 0       string          TEXT                    Macintosh TeachText File (data)
49 >2      string          x                       : %s
50 0       string          PDF                     Macintosh PDF File (data)
51 >2      string          x                       : %s
52
53 # MacBinary format (Eric Fischer, enf@pobox.com)
54 #
55 # Unfortunately MacBinary doesn't really have a magic number prior
56 # to the MacBinary III format.  The checksum is really the way to
57 # do it, but the magic file format isn't up to the challenge.
58 #
59 # 0     byte            0
60 # 1     byte                            # filename length
61 # 2     string                          # filename
62 # 65    string                          # file type
63 # 69    string                          # file creator
64 # 73    byte                            # Finder flags
65 # 74    byte            0
66 # 75    beshort                         # vertical posn in window
67 # 77    beshort                         # horiz posn in window
68 # 79    beshort                         # window or folder ID
69 # 81    byte                            # protected?
70 # 82    byte            0
71 # 83    belong                          # length of data segment
72 # 87    belong                          # length of resource segment
73 # 91    belong                          # file creation date
74 # 95    belong                          # file modification date
75 # 99    beshort                         # length of comment after resource
76 # 101   byte                            # new Finder flags
77 # 102   string          mBIN            # (only in MacBinary III)
78 # 106   byte                            # char. code of file name
79 # 107   byte                            # still more Finder flags
80 # 116   belong                          # total file length
81 # 120   beshort                         # length of add'l header
82 # 122   byte            129             # for MacBinary II
83 # 122   byte            130             # for MacBinary III
84 # 123   byte            129             # minimum version that can read fmt
85 # 124   beshort                         # checksum
86 #
87 # This attempts to use the version numbers as a magic number, requiring
88 # that the first one be 0x80, 0x81, 0x82, or 0x83, and that the second
89 # be 0x81.  This works for the files I have, but maybe not for everyone's.
90
91 122     beshort&0xFCFF  0x8081          Macintosh MacBinary data
92
93 # MacBinary I doesn't have the version number field at all, but MacBinary II
94 # has been in use since 1987 so I hope there aren't many really old files
95 # floating around that this will miss.  The original spec calls for using
96 # the nulls in 0, 74, and 82 as the magic number.
97 #
98 # Another possibility, that would also work for MacBinary I, is to use
99 # the assumption that 65-72 will all be ASCII (0x20-0x7F), that 73 will
100 # have bits 1 (changed), 2 (busy), 3 (bozo), and 6 (invisible) unset,
101 # and that 74 will be 0.  So something like
102
103 # 71    belong&0x80804EFF 0x00000000    Macintosh MacBinary data
104
105 # >73   byte&0x01       0x01            \b, inited
106 # >73   byte&0x02       0x02            \b, changed
107 # >73   byte&0x04       0x04            \b, busy
108 # >73   byte&0x08       0x08            \b, bozo
109 # >73   byte&0x10       0x10            \b, system
110 # >73   byte&0x10       0x20            \b, bundle
111 # >73   byte&0x10       0x40            \b, invisible
112 # >73   byte&0x10       0x80            \b, locked
113
114 >65     string          x               \b, type "%4.4s"
115
116 >65     string          8BIM            (PhotoShop)
117 >65     string          ALB3            (PageMaker 3)
118 >65     string          ALB4            (PageMaker 4)
119 >65     string          ALT3            (PageMaker 3)
120 >65     string          APPL            (application)
121 >65     string          AWWP            (AppleWorks word processor)
122 >65     string          CIRC            (simulated circuit)
123 >65     string          DRWG            (MacDraw)
124 >65     string          EPSF            (Encapsulated PostScript)
125 >65     string          FFIL            (font suitcase)
126 >65     string          FKEY            (function key)
127 >65     string          FNDR            (Macintosh Finder)
128 >65     string          GIFf            (GIF image)
129 >65     string          Gzip            (GNU gzip)
130 >65     string          INIT            (system extension)
131 >65     string          LIB\            (library)
132 >65     string          LWFN            (PostScript font)
133 >65     string          MSBC            (Microsoft BASIC)
134 >65     string          PACT            (Compact Pro archive)
135 >65     string          PDF\            (Portable Document Format)
136 >65     string          PICT            (picture)
137 >65     string          PNTG            (MacPaint picture)
138 >65     string          PREF            (preferences)
139 >65     string          PROJ            (Think C project)
140 >65     string          QPRJ            (Think Pascal project)
141 >65     string          SCFL            (Defender scores)
142 >65     string          SCRN            (startup screen)
143 >65     string          SITD            (StuffIt Deluxe)
144 >65     string          SPn3            (SuperPaint)
145 >65     string          STAK            (HyperCard stack)
146 >65     string          Seg\            (StuffIt segment)
147 >65     string          TARF            (Unix tar archive)
148 >65     string          TEXT            (ASCII)
149 >65     string          TIFF            (TIFF image)
150 >65     string          TOVF            (Eudora table of contents)
151 >65     string          WDBN            (Microsoft Word word processor)
152 >65     string          WORD            (MacWrite word processor)
153 >65     string          XLS\            (Microsoft Excel)
154 >65     string          ZIVM            (compress (.Z))
155 >65     string          ZSYS            (Pre-System 7 system file)
156 >65     string          acf3            (Aldus FreeHand)
157 >65     string          cdev            (control panel)
158 >65     string          dfil            (Desk Acessory suitcase)
159 >65     string          libr            (library)
160 >65     string          nX^d            (WriteNow word processor)
161 >65     string          nX^w            (WriteNow dictionary)
162 >65     string          rsrc            (resource)
163 >65     string          scbk            (Scrapbook)
164 >65     string          shlb            (shared library)
165 >65     string          ttro            (SimpleText read-only)
166 >65     string          zsys            (system file)
167
168 >69     string          x               \b, creator "%4.4s"
169
170 # Somewhere, Apple has a repository of registered Creator IDs.  These are
171 # just the ones that I happened to have files from and was able to identify.
172
173 >69     string          8BIM            (Adobe Photoshop)
174 >69     string          ALD3            (PageMaker 3)
175 >69     string          ALD4            (PageMaker 4)
176 >69     string          ALFA            (Alpha editor)
177 >69     string          APLS            (Apple Scanner)
178 >69     string          APSC            (Apple Scanner)
179 >69     string          BRKL            (Brickles)
180 >69     string          BTFT            (BitFont)
181 >69     string          CCL2            (Common Lisp 2)
182 >69     string          CCL\            (Common Lisp)
183 >69     string          CDmo            (The Talking Moose)
184 >69     string          CPCT            (Compact Pro)
185 >69     string          CSOm            (Eudora)
186 >69     string          DMOV            (Font/DA Mover)
187 >69     string          DSIM            (DigSim)
188 >69     string          EDIT            (Macintosh Edit)
189 >69     string          ERIK            (Macintosh Finder)
190 >69     string          EXTR            (self-extracting archive)
191 >69     string          Gzip            (GNU gzip)
192 >69     string          KAHL            (Think C)
193 >69     string          LWFU            (LaserWriter Utility)
194 >69     string          LZIV            (compress)
195 >69     string          MACA            (MacWrite)
196 >69     string          MACS            (Macintosh operating system)
197 >69     string          MAcK            (MacKnowledge terminal emulator)
198 >69     string          MLND            (Defender)
199 >69     string          MPNT            (MacPaint)
200 >69     string          MSBB            (Microsoft BASIC (binary))
201 >69     string          MSWD            (Microsoft Word)
202 >69     string          NCSA            (NCSA Telnet)
203 >69     string          PJMM            (Think Pascal)
204 >69     string          PSAL            (Hunt the Wumpus)
205 >69     string          PSI2            (Apple File Exchange)
206 >69     string          R*ch            (BBEdit)
207 >69     string          RMKR            (Resource Maker)
208 >69     string          RSED            (Resource Editor)
209 >69     string          Rich            (BBEdit)
210 >69     string          SIT!            (StuffIt)
211 >69     string          SPNT            (SuperPaint)
212 >69     string          Unix            (NeXT Mac filesystem)
213 >69     string          VIM!            (Vim editor)
214 >69     string          WILD            (HyperCard)
215 >69     string          XCEL            (Microsoft Excel)
216 >69     string          aCa2            (Fontographer)
217 >69     string          aca3            (Aldus FreeHand)
218 >69     string          dosa            (Macintosh MS-DOS file system)
219 >69     string          movr            (Font/DA Mover)
220 >69     string          nX^n            (WriteNow)
221 >69     string          pdos            (Apple ProDOS file system)
222 >69     string          scbk            (Scrapbook)
223 >69     string          ttxt            (SimpleText)
224 >69     string          ufox            (Foreign File Access)
225
226 # Just in case...
227
228 102     string          mBIN            MacBinary III data with surprising version number
229
230 # sas magic from Bruce Foster (bef@nwu.edu)
231 #
232 #0      string          SAS             SAS
233 #>8     string          x               %s
234 0       string          SAS             SAS
235 >24     string          DATA            data file
236 >24     string          CATALOG         catalog
237 >24     string          INDEX           data file index
238 >24     string          VIEW            data view
239 # spss magic for SPSS system and portable files, 
240 #        from Bruce Foster (bef@nwu.edu).
241
242 0       long            0xc1e2c3c9      SPSS Portable File
243 >40     string          x               %s
244
245 0       string          $FL2            SPSS System File
246 >24     string          x               %s
247
248 # Macintosh filesystem data
249 # From "Tom N Harris" <telliamed@mac.com>
250 # The MacOS epoch begins on 1 Jan 1904 instead of 1 Jan 1970, so these
251 # entries depend on the data arithmetic added after v.35
252 # There's also some Pascal strings in here, ditto...
253
254 # The boot block signature, according to IM:Files, is 
255 # "for HFS volumes, this field always contains the value 0x4C4B."
256 # But if this is true for MFS or HFS+ volumes, I don't know.
257 # Alternatively, the boot block is supposed to be zeroed if it's
258 # unused, so a simply >0 should suffice.
259
260 0x400   beshort                 0xD2D7          Macintosh MFS data
261 >0      beshort                 0x4C4B          (bootable)
262 >0x40a  beshort                 &0x8000         (locked)
263 >0x402  beldate-0x7C25B080      x               created: %s,
264 >0x406  beldate-0x7C25B080      >0              last backup: %s,
265 >0x414  belong                  x               block size: %d,
266 >0x412  beshort                 x               number of blocks: %d,
267 >0x424  pstring                 x               volume name: %s
268
269 0x400   beshort                 0x4244          Macintosh HFS data
270 >0      beshort                 0x4C4B          (bootable)
271 >0x40a  beshort                 &0x8000         (locked)
272 >0x40a  beshort                 ^0x0100         (mounted)
273 >0x40a  beshort                 &0x0800         (unclean)
274 >0x402  beldate-0x7C25B080      x               created: %s,
275 >0x406  beldate-0x7C25B080      x               last modified: %s,
276 >0x440  beldate-0x7C25B080      >0              last backup: %s,
277 >0x414  belong                  x               block size: %d,
278 >0x412  beshort                 x               number of blocks: %d,
279 >0x424  pstring                 x               volume name: %s
280 #>0x480 beshort                 =0x482B         Embedded HFS+ Volume:
281 #>>((0x482*(0x414))+(0x41c*512))        x       \b
282 # Well, this is (theoretically) how we could do this. But it occurs to
283 # me that we likely don't read in a large enough chunk. I don't have any
284 # HFS+ volumes to see what a typical offset would be.
285
286 0x400   beshort                 0x482B          Macintosh HFS Extended
287 >&2     beshort                 x               version %d data
288 >0      beshort                 0x4C4B          (bootable)
289 >&4     belong                  ^0x00000100     (mounted)
290 >&4     belong                  &0x00000800     (unclean)
291 >&4     belong                  &0x00008000     (locked)
292 >&8     string                  x               last mounted by: '%.4s',
293 # really, that should be treated as a belong and we print a string
294 # based on the value. TN1150 only mentions '8.10' for "MacOS 8.1"
295 >&16    beldate-0x7C25B080      x               created: %s,
296 >&20    beldate-0x7C25B080      x               last modified: %s,
297 >&24    beldate-0x7C25B080      >0              last backup: %s,
298 >&28    beldate-0x7C25B080      >0              last checked: %s,
299 >&40    belong                  x               block size: %d,
300 >&44    belong                  x               number of blocks: %d,
301 >&48    belong                  x               free blocks: %d
302
303 # I don't think this is really necessary since it doesn't do much and 
304 # anything with a valid driver descriptor will also have a valid
305 # partition map
306 #0              beshort         0x4552          Apple Device Driver data
307 #>&24           beshort         =1              \b, MacOS
308
309 # Is that the partition type a cstring or a pstring? Well, IM says "strings 
310 # shorter than 32 bytes must be terminated with NULL" so I'll treat it as a 
311 # cstring. Of course, partitions can contain more than four entries, but 
312 # what're you gonna do?
313 0x200           beshort         0x504D          Apple Partition data
314 >&2             beshort         x               block size: %d
315 >&48            string          x               first type: %s,
316 >&12            belong          x               number of blocks: %d,
317 >(&0x2.S)       beshort         0x504D          
318 >>&48           string          x               second type: %s
319 >>&12           belong          x               number of blocks: %d,
320 >>(&0x2.S)      beshort         0x504D          
321 >>>&48          string          x               third type: %s
322 >>>&12          belong          x               number of blocks: %d,
323 >>>(&0x2.S)     beshort         0x504D          
324 >>>>&48         string          x               fourth type: %s
325 >>>>&12         belong          x               number of blocks: %d,
326 # AFAIK, only the signature is different
327 0x200           beshort         0x5453          Apple Old Partition data
328 >&2             beshort         x               block size: %d
329 >&48            string          x               first type: %s,
330 >&12            belong          x               number of blocks: %d,
331 >(&0x2.S)       beshort         0x504D          
332 >>&48           string          x               second type: %s
333 >>&12           belong          x               number of blocks: %d,
334 >>(&0x2.S)      beshort         0x504D          
335 >>>&48          string          x               third type: %s
336 >>>&12          belong          x               number of blocks: %d,
337 >>>(&0x2.S)     beshort         0x504D          
338 >>>>&48         string          x               fourth type: %s
339 >>>>&12         belong          x               number of blocks: %d,