From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <6223deca086f7deac23b9f3a53cc0d34@plan9.bell-labs.com> To: 9fans@9fans.net Date: Sun, 6 Jul 2008 19:45:28 -0400 From: geoff@plan9.bell-labs.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] a question of file and the history of magic Topicbox-Message-UUID: dcf2fe8c-ead3-11e9-9d60-3106f5b1d025 As far as I know, all (l)unix dd commands from at least sixth edition unix forward accept the options if=, bs= and count=, so portability across (l)unix systems shouldn't be a problem. Not all (l)unix dd commands have some of the newer options, such as iseek= and oseek=, but the ones I have seen all take the same syntax. An assumption behind the system v magic file is that almost all file does is match byte strings or integers, usually at the start of the file being examined (though that wasn't really true even on unix). The plan 9 file command also uses more complex algorithms; it's not all simple table-driven matching. It understands unicode and utf. It may look at histograms of byte or word distributions. It may look for programming language keywords. It understands a.out and elf headers. It can recognise a tar header and distinguish posix from non-posix headers. It can recognise html, rfc-822 mail messages, unix-style mailboxes, images, compressed files and encrypted ones, and more. A quick look suggests that under 15% of the lines in file.c are devoted to table definitions.