我目前正在为lib魔术数据库编写一个解析器(由file命令使用),并且我没有找到任何关于“use”和“Clear”类型的信息(魔术文件中的第二列)。
有人能向我解释一下这类人应该做什么吗?
发布于 2015-12-12 20:26:21
这些都是相当新的特性,记录在magic(5)中:
use从当前偏移量开始递归地调用命名魔术。如果引用的名称以^开头,则切换魔术的endianness;例如,如果提到leshort,则将其视为beshort,反之亦然。这对于避免重复针对不同环境的规则是有用的。clear此测试始终为真,并清除该延续级别的匹配标志。它用于默认测试。
以“相当新”的方式:
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 https://unix.stackexchange.com/questions/248960
复制相似问题