xref: /freebsd/contrib/file/magic/Magdir/palm (revision a0b956f5ac5e0941f9e74e24c1c53e05ad061a38)
1
2#------------------------------------------------------------------------------
3# $File: palm,v 1.15 2021/12/16 21:50:06 christos Exp $
4# palm:	 file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks
5#
6# Brian Lalor <blalor@hcirisc.cs.binghamton.edu>
7
8# These are weak, byte 59 is not guaranteed to be 0 and there are
9# 8 character identifiers at byte 60, one I found for appl is BIGb.
10# What are the possibilities and where is this documented?
11
12# The common header format for PalmOS .pdb/.prc files is
13# {
14#         char            name[ 32 ];
15#         Word            attributes;
16#         Word            version;
17#         DWord           creationDate;
18#         DWord           modificationDate;
19#         DWord           lastBackupDate;
20#         DWord           modificationNumber;
21#         DWord           appInfoID;
22#         DWord           sortInfoID;
23#         char            type[4];
24#         char            creator[4];
25#         DWord           uniqueIDSeed;
26#         RecordListType  recordList;
27# };
28#
29# Datestamps are unsigned seconds since the MacOS epoch (Jan 1, 1904),
30# or Unix/POSIX time + 2082844800.
31
320		name		aportisdoc
33# date is supposed to be big-endian seconds since 1 Jan 1904, but many
34# files contain the timestamp in little-endian or a completely
35# nonsensical value...
36#>36		bedate-2082844800	>0	\b, created %s
37# compression: 1=uncomp, 2=orig, 0x4448=HuffDic
38>(78.L)		beshort		=1		\b, uncompressed
39# compressed
40>(78.L)		beshort		>1
41>>(78.L+4)	belong		x		\b, %d bytes uncompressed
42
43# appl
44#60		string		appl		PalmOS application
45#>0		string		>\0		"%s"
46
47# HACK
48#60		string		HACK		HackMaster hack
49#>0		string		>\0		"%s"
50
51# iSiloX e-book
5260		string		SDocSilX	iSiloX E-book
53>0		string		>\0		"%s"
54
55# Mobipocket (www.mobipocket.com), donated by Carl Witty
56# expanded by Ralf Brown
5760		string	 	BOOKMOBI	Mobipocket E-book
58!:mime	application/x-mobipocket-ebook
59# MobiPocket stores a full title, pointed at by the belong at offset
60# 0x54 in its header at (78.L), with length given by the belong at
61# offset 0x58.
62# there's no guarantee that the title string is null-terminated, but
63# we currently can't specify a variable-length string where the length
64# field is not at the start of the string; in practice, the data
65# following the string always seems to start with a zero byte
66>(78.L)		belong		x
67>>&(&0x50.L-4)	string		>\0		"%s"
68>0		use		aportisdoc
69>>(78.L+0x68)	belong		>0		\b, version %d
70>>(78.L+0x1C)	belong		!0		\b, codepage %d
71>>(78.L+0x0C)	beshort	 	>0		\b, encrypted (type %d)
72
73# AportisDoc/PalmDOC
7460		string		TEXtREAd	AportisDoc/PalmDOC E-book
75>0		string		>\0		"%s"
76>0		use		aportisdoc
77
78# Variety of PalmOS document types
79# Michael-John Turner <mj@debian.org>
80# Thanks to Hasan Umit Ezerce <humit@tr-net.net.tr> for his DocType
8160	string			BVokBDIC	BDicty PalmOS document
82>0	string			>\0		"%s"
8360	string			DB99DBOS	DB PalmOS document
84>0	string			>\0		"%s"
8560	string			vIMGView	FireViewer/ImageViewer PalmOS document
86>0	string			>\0		"%s"
8760	string			PmDBPmDB	HanDBase PalmOS document
88>0	string			>\0		"%s"
8960	string			InfoINDB	InfoView PalmOS document
90>0	string			>\0		"%s"
9160	string			ToGoToGo	iSilo PalmOS document
92>0	string			>\0		"%s"
9360	string			JfDbJBas	JFile PalmOS document
94>0	string			>\0		"%s"
9560	string			JfDbJFil	JFile Pro PalmOS document
96>0	string			>\0		"%s"
9760	string			DATALSdb	List PalmOS document
98>0	string			>\0		"%s"
9960	string			Mdb1Mdb1	MobileDB PalmOS document
100>0	string			>\0		"%s"
10160	string			PNRdPPrs	PeanutPress PalmOS document
102>0	string			>\0		"%s"
10360	string			DataPlkr	Plucker PalmOS document
104>0	string			>\0		"%s"
10560	string			DataSprd	QuickSheet PalmOS document
106>0	string			>\0		"%s"
10760	string			SM01SMem	SuperMemo PalmOS document
108>0	string			>\0		"%s"
10960	string			TEXtTlDc	TealDoc PalmOS document
110>0	string			>\0		"%s"
11160	string			InfoTlIf	TealInfo PalmOS document
112>0	string			>\0		"%s"
11360	string			DataTlMl	TealMeal PalmOS document
114>0	string			>\0		"%s"
11560	string			DataTlPt	TealPaint PalmOS document
116>0	string			>\0		"%s"
11760	string			dataTDBP	ThinkDB PalmOS document
118>0	string			>\0		"%s"
11960	string			TdatTide	Tides PalmOS document
120>0	string			>\0		"%s"
12160	string			ToRaTRPW	TomeRaider PalmOS document
122>0	string			>\0		"%s"
123
124# A GutenPalm zTXT etext for use on Palm Pilots (http://gutenpalm.sf.net)
125# For version 1.xx zTXTs, outputs version and numbers of bookmarks and
126#   annotations.
127# For other versions, just outputs version.
128#
12960		string		zTXT		A GutenPalm zTXT e-book
130>0		string		>\0		"%s"
131>(0x4E.L)	byte		0
132>>(0x4E.L+1)	byte		x		(v0.%02d)
133>(0x4E.L)	byte		1
134>>(0x4E.L+1)	byte		x		(v1.%02d)
135>>>(0x4E.L+10)	beshort		>0
136>>>>(0x4E.L+10) beshort		<2		- 1 bookmark
137>>>>(0x4E.L+10) beshort		>1		- %d bookmarks
138>>>(0x4E.L+14)	beshort		>0
139>>>>(0x4E.L+14) beshort		<2		- 1 annotation
140>>>>(0x4E.L+14) beshort		>1		- %d annotations
141>(0x4E.L)	byte		>1		(v%d.
142>>(0x4E.L+1)	byte		x		%02d)
143
144# Palm OS .prc file types
14560		string		libr
146# flags, only bit 0 or bit 6
147# https://en.wikipedia.org/wiki/PRC_%28Palm_OS%29
148# https://web.mit.edu/tytso/www/pilot/prc-format.html
149>0x20		beshort&0xffbe	0
150>>0		string		>\0		Palm OS dynamic library data "%s"
15160		string		ptch		Palm OS operating system patch data
152>0		string		>\0		"%s"
153
154# Mobipocket (www.mobipocket.com), donated by Carl Witty
15560	string			BOOKMOBI	Mobipocket E-book
156>0	string			>\0		"%s"
157