summaryrefslogtreecommitdiff
path: root/Master/bin/win32/fmtutil-sys.texlua
blob: f075b43e60770da8fac8fd530da34505719bd150 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/xusr/bin/env texlua
--*-Lua-*-
-- $Id: fmtutil-sys.texlua 6607 2008-02-11 15:37:39Z siepo $

-- Copyright (C) 2008 Reinhard Kotucha, Norbert Preining
-- You may freely use, modify and/or distribute this file.

-- Wrapper for Perl scripts.


if string.find(arg[0], "/") then -- UNIX path
   filename=select(1, string.gsub(arg[0], ".*/", ""))
elseif string.find(arg[0], "\\") then -- Windows path
   filename=select(1, string.gsub(arg[0], ".*\\", ""))
else -- no path
   filename=arg[0]
end

basename=select(1, string.gsub(filename, "\.texlua$", ""))

-- basename="fmtutil-sys"

kpse.set_program_name(filename)

if string.find(basename, "-sys$") then
   basename=select(1, string.gsub(basename, "-sys$", ""))
   os.setenv("TEXMFVAR", kpse.var_value("TEXMFSYSVAR"))
   os.setenv("TEXMFCONFIG", kpse.var_value("TEXMFSYSCONFIG"))
end

command = { "fmtutil.exe" }

for i=1, #arg do
    command[#command+1]=arg[i]
end

ret=os.spawn(command)
os.exit(ret)