Date: Sat, 2 Jan 1999 21:38:48 -0600 From: Dan Nelson <dnelson@emsphone.com> To: raymond@one.com.au Cc: freebsd-questions@FreeBSD.ORG Subject: Re: File magic numbers - cont Message-ID: <19990102213848.A47134@dan.emsphone.com> In-Reply-To: <199901021259.WAA10155@gw.one.com.au>; from "raymond@one.com.au" on Sat Jan 2 22:59:38 GMT 1999 References: <199901021259.WAA10155@gw.one.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jan 02), raymond@one.com.au said: > I had had a look at man magic and /usr/share/misc/magic - but what I'm > doing doesn't seem to fit (at least to my limited understanding). I am > creating a file type "MUMPS Database". There is an entry > # plus5: file(1) magic for Plus Five's UNIX MUMPS > which doesn't describe what I'm doing. > > Basically... does someone arbitrate src/cmd/file/magdir/* or do I > just plug in some random numbers? It's all random, basically. This isn't MacOS, where each file has a type assigned to it. People have historically just used whatever they want. If you are creating a completely new datafile (something that can't be thought of as an extension to another filetype), try and make the first four bytes a "magic number" that's unique to that file, and try and put useful information at constant offsets from the start of the file. See the entries for PNG or GIF for good examples. If you are creating a magic entry for a preexisting type, determine what magic byte sequence (if any) can uniquely identify that type and create an entry for it in /usr/src/usr.bin/file/Magdir. Make your magic file as complete as possible; detect as much as you can. See the entry for the Berkeley DB or gzip files for excellent examples. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990102213848.A47134>