libmagic(ファイル)データベースの「使用」および「消去」タイプ

libmagic(ファイル)データベースの「使用」および「消去」タイプ

私は現在libmagicデータベース(fileコマンドで使用されています)のパーサーを作成していますが、タイプ「use」と「clear」(マジックファイルの2番目の列)に関する情報が見つかりませんでした。
このタイプが何をすべきかを説明できる人はいますか?

ベストアンサー1

これはかなり新機能であり、次の文書で説明されています。magic(5):

use
現在のオフセットから始まり、指定されたマジックを再帰的に呼び出します。参照された名前が次に終わる場合 ^その後、魔法が言及されると、魔法のバイト順序が切り替わる。leshortたとえば、次のように見なされます。 beshort その逆。これは、他のバイト順序に対するルールの繰り返しを防ぐのに役立ちます。

clear
このテストは常に true で、対応する連続レベルの一致フラグをクリアします。基本テストで使用するように設計されています。

「非常に新しい」標準:

2014-11-27 18:40 クリストス・ジュラス

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

2013-04-22 11:20 クリストス・ジュラス

    * 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 

おすすめ記事