libmagic (arquivo) banco de dados “use” e “clear” digite

1

Atualmente estou escrevendo um analisador para o banco de dados libmagic (usado pelo comando file) e não encontrei nenhuma informação sobre o tipo 'use' e 'clear' (segunda coluna no arquivo magic).
Alguém pode me explicar o que esses tipos devem fazer?

    
por SleepProgger 12.12.2015 / 17:49

1 resposta

1

Esses são recursos novos, documentados em magic(5) :

use
Recursively call the named magic starting from the current offset. If the name of the referenced begins with a ^ then the endianness of the magic is switched; if the magic mentioned leshort for example, it is treated as beshort and vice versa. This is useful to avoid duplicating the rules for different endianness.

clear
This test is always true and clears the match flag for that continuation level. It is intended to be used with the default test.

Por "razoavelmente novo":

2014-11-27 18:40 Christos Zoulas

    * Allow setting more parameters from the command line.
    * Split name/use and indirect magic recursion limits.

2013-04-22 11:20 Christos Zoulas

    * The way "default" was implemented was not very useful
      because the "if something was printed at that level"
      was not easily controlled by the user, and the format
      was bound to a string which is too restrictive. Add
      a "clear" for that level keyword and make "default"
      void. This way one can do:            

            >>13    clear   x
            >>13    lelong  1       foo
            >>13    lelong  2       bar
            >>13    default x
            >>>13   lelong  x       unknown %x 
    
por 12.12.2015 / 21:26