[File] [PATCH] of Magdir/frame for FrameMaker MIF

Jörg Jenderek joerg.jen.der.ek at gmx.net
Sat Nov 23 22:20:49 UTC 2019


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

some days ago i had to handle some ImageMagick bitmaps which have
sometimes filename extension mif. When searching on my systems for
non ImageMagick bitmaps with same file name extension i found a few
FrameMaker MIF documents. When running file command version
5.37 on such samples and similar test examples i get an unexpected
output like:

bookTOC.framemif:  FrameMaker MIF (ASCII) file (3.0)
example2.mif:      FrameMaker MIF (ASCII) file
example4.mif:      FrameMaker MIF (ASCII) file
fm-a5mif.mif:      FrameMaker MIF (ASCII) file (4.0)
SomeChartPack.mif: FrameMaker MIF (ASCII) file

Furthermore with -i option only out dated application/x-mif is shown
and with --extension only ??? is displayed.

Some information about Maker Interchange Format (MIF) can be found
on file formats archive team web site. So i add this URL by comment
line like:
 # URL: fileformats.archiveteam.org/wiki/Maker_Interchange_Format
On that site a link to ADOBE FRAMEMAKER MIF REFERENCE is listed. So
i add this as reference by comment line like:
 # Reference: help.adobe.com/en_US/framemaker/mifreference/mifref.pdf

The identification happens by line
 0	string		\<MIFFile	FrameMaker MIF (ASCII) file
Afterward show instead mime type application/x-mif the IANA
registered type by line:
 !:mime	application/vnd.mif
Most FrameMaker Interchange Format documents have file name
extension mif, but i also found an example with name
bookTOC.framemif. So file name extension is displayed by line
 !:ext	mif/framemif

According to reference afterwards the version number of the MIF
language is stored as string after first keyword, terminated by a
greater sign.
In current frame file it is looking for known version, and then
show this version inside parenthesis by lines like:
 >9	string		4.0		 (4.0)
 >9	string		3.0		 (3.0)
 >9	string		2.0		 (2.0)
 >9	string		1.0		 (1.x)
I do not understand why this way is choosen and why version string
is not directly shown. Furthermore by current method for MIF documents
like SomeChartPack.mif which are newer than version 4 no version
information is shown.
Unfortunatly the reference does not mention how the version string
looks like. According to current magic it probably looks like x.y,
but in reference examples the 4 digit year string 2015 is used.
Newest Frammaker version is 2019. So maybe there this years
appears. So show first 3 character of version string. If it is not
followed by greater sign print next character of version string by
lines:
 >9	string		x		(%.3s
 >12	ubyte		=0x3e		\b)
 >12	ubyte		!0x3e		\b%c)
According to reference after MIFFile statement comes a comment
starting with number sign #. This comment shows the name and
version number of the program that generated the file. So show this
information by lines:
 >13	search/3	#
 >>&0	string		x		"%s"

After applying the above mentioned modifications by patch
file-5.37-frame-mif.diff then i get a more describing output like:

bookTOC.framemif:  FrameMaker MIF (ASCII) file (3.00)
	" Generated by FrameMaker 3.0.1"
example2.mif:      FrameMaker MIF (ASCII) file (8.00)
example4.mif:      FrameMaker MIF (ASCII) file (2015)
	" The only required statement"
fm-a5mif.mif:      FrameMaker MIF (ASCII) file (4.00)
	" Generated by FrameMaker 4.02P2b"
SomeChartPack.mif: FrameMaker MIF (ASCII) file (2015)
	" Generated by SomeChartPack 1.4;
	identifies this# as a MIF file."
test-2.0.mif:      FrameMaker MIF (ASCII) file (2.0)
	" this is only a test"

I hope my diff file can be applied in a future version of
file utility.

The wrong mime error and incomplete version information seems to
appear also for other FrameMaker files. Maybe i will do this in a
future session.

With best wishes
Jörg Jenderek
- --
Jörg Jenderek



-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXdmwuAAKCRCv8rHJQhrU
1szLAJ0aXjPapgNrKBoajRcCq/fGz7vxjwCg20IdxaGiPoN8CgLh08N1R1HaKug=
=LZy0
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.37/magic/Magdir/frame.old	2019-02-22 12:06:34 +0000
+++ file-5.37/magic/Magdir/frame	2019-11-23 20:48:48 +0000
@@ -20,8 +20,20 @@
 >14	byte		x		  %c)
+# URL:		http://fileformats.archiveteam.org/wiki/Maker_Interchange_Format
+# Reference:	https://help.adobe.com/en_US/framemaker/mifreference/mifref.pdf
+# Update:	Joerg Jenderek 2019 Nov
 0	string		\<MIFFile	FrameMaker MIF (ASCII) file
-!:mime	application/x-mif
->9	string		4.0		 (4.0)
->9	string		3.0		 (3.0)
->9	string		2.0		 (2.0)
->9	string		1.0		 (1.x)
+# https://www.iana.org/assignments/media-types/application/vnd.mif
+!:mime	application/vnd.mif
+# mif most but also find bookTOC.framemif
+!:ext	mif/framemif
+# followed by space~20h
+#>8	ubyte		0x20		\b, space before version
+# 3 characters of version number of the MIF language like 1.0, 2.0 ... 2015 ...
+>9	string		x		(%.3s
+# if not greater sign then display 4th character of version
+>12	ubyte		=0x3e		\b)
+>12	ubyte		!0x3e		\b%c)
+# comment starting with # shows the name+version number of generating program
+>13	search/3	#
+>>&0	string		x		"%s"
 0	search/1	\<MakerDictionary	FrameMaker Dictionary text
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.37-frame-mif.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20191123/19f0fb6d/attachment.obj>


More information about the File mailing list