blob: 32bfb5736cc1bc0463ac27879cb6c939f6aaf2f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/lua
magic = require("magic")
m = magic.open()
assert(m:load())
print(m:errno())
-- test magic.descriptor() from stdin
if arg[1] == "--stdin" then
-- stdin = 0
m:setflags(magic.MIME_ENCODING)
print(m:descriptor(0))
os.exit(0)
else
os.execute("lua test.lua --stdin < Makefile")
end
print(m:file("Makefile"))
m:setflags(magic.MIME_TYPE)
print(m:error())
print(m:file("Makefile"))
|