[Linux-aus] enum in /etc/magic

Chris Martin chris at martin.cc
Mon Jun 16 23:33:49 EST 2014


Russell

There is no way to shorten the test that I am aware of.
The ">" indicates the level of the test,  so I ma thinking that you should
be use an extra ">" when you get to the 3rd test

ie:

0       beshort                 0xfe01          MySQL table definition file
>2      byte                    x               Version %d,
>>3      byte                    9               Type MYISAM
>>3      byte                    12              Type INNODB

The first test identifies it as a SQL table file
The second test displays the version
The 3rd test displays the Type

You will need one line for each type





Cheers

----------------------------------------------------------
Chris Martin
m: +61 419 812 371
e: chris at martin.cc
----------------------------------------------------------



On 15 June 2014 21:20, Russell Coker <russell at coker.com.au> wrote:

> I've got an enum in a data structure that I'd like to display in the
> output of
> file(1).
>
> 0       beshort                 0xfe01          MySQL table definition file
> >2      byte                    x               Version %d,
> >3      byte                    9               Type MYISAM
> >3      byte                    12              Type INNODB
>
> The above is a sample of what I'm doing, values 9 and 12 in byte 3
> correspond
> to MYISAM and INNODB entries for the MySQL FRM file.
>
> https://github.com/twitter/mysql/blob/master/sql/handler.h
>
> The above URL has what seems to be a complete list, so I could write 31
> lines
> in /etc/magic for this, but that's ugly.  Is there a way I can specify a
> list
> of values to match followed by a list of strings to display and not have 31
> lines?
>
> I'd like to develop a patch that can be accepted into the Debian package
> and
> hopefully upstream so it has to be the least ugly way of doing it.
>
> --
> My Main Blog         http://etbe.coker.com.au/
> My Documents Blog    http://doc.coker.com.au/
>
>
> _______________________________________________
> linux-aus mailing list
> linux-aus at lists.linux.org.au
> http://lists.linux.org.au/listinfo/linux-aus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linux-aus/attachments/20140616/208691ed/attachment-0001.htm 


More information about the linux-aus mailing list