From 04347aa22397a7b41205ba2d883b156616f90dba Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Tue, 9 Sep 2008 21:30:11 +0000 Subject: trying a fix to the texodc+AR9 problem git-svn-id: svn://tug.org/texlive/trunk@10530 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/win32/texdoc.bat | 3 +- Master/bin/win32/tl-w32-texdoc-wrapper.texlua | 106 ++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100755 Master/bin/win32/tl-w32-texdoc-wrapper.texlua (limited to 'Master/bin') diff --git a/Master/bin/win32/texdoc.bat b/Master/bin/win32/texdoc.bat index fe949613d7c..92397f07fa6 100755 --- a/Master/bin/win32/texdoc.bat +++ b/Master/bin/win32/texdoc.bat @@ -2,7 +2,8 @@ rem tl-w32-starter.bat rem universal script starter, batch file part rem this program calls the tl-w32-wrapper.texlua +rem /!\ special texdoc version: calls a modified wrapper /!\ setlocal set ownpath=%~dp0% -texlua "%ownpath%tl-w32-wrapper.texlua" "%~dpn0" %* +texlua "%ownpath%tl-w32-texdoc-wrapper.texlua" "%~dpn0" %* endlocal diff --git a/Master/bin/win32/tl-w32-texdoc-wrapper.texlua b/Master/bin/win32/tl-w32-texdoc-wrapper.texlua new file mode 100755 index 00000000000..2a63d54acbb --- /dev/null +++ b/Master/bin/win32/tl-w32-texdoc-wrapper.texlua @@ -0,0 +1,106 @@ +#! /usr/bin/env texlua +--*-Lua-*- +-- $Id: tl-w32-wrapper.texlua 8125 2008-05-14 06:53:32Z preining $ + +-- Copyright (C) 2007, 2008 Reinhard Kotucha, Norbert Preining. +-- You may freely use, modify and/or distribute this file. + +-- Wrapper for scripts. + +function fixwin(args_unix) + if os.type == 'windows' then + local args_win={} -- new table + args_win[0]=args_unix[1] + for i=1, #args_unix do + args_win[i]='"'..args_unix[i]..'"' + end + return args_win + else + return args_unix + end +end + +if string.find(arg[0], '/') then -- UNIX path + progname = select(1, string.gsub(arg[1], '.*/', '')) +elseif string.find(arg[0], '\\') then -- Windows path + progname = select(1, string.gsub(arg[1], '.*\\', '')) + -- we might have \ and / mixed together ... + progname = select(1, string.gsub(progname, '.*/', '')) +else -- no path + progname = arg[1] +end + +sys=false + +if string.find(progname, '-sys$') then + basename = select(1, string.gsub(progname, '-sys$', '')) + sys=true +else + basename = progname +end + +kpse.set_program_name(progname..".bat", progname) +TEXDIR=kpse.var_value('SELFAUTOPARENT') +BINDIR=kpse.var_value('SELFAUTOLOC') + +perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe' + +os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'.. + TEXDIR..'/tlpkg/installer;'.. + os.getenv('PATH')) + +os.setenv('WGETRC', TEXDIR..'/tlpkg/installer/wgetrc') +os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib') +os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib;'..TEXDIR..'/tlpkg/tlgs/fonts') + +if sys then + os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR')) + os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG')) + os.setenv('TEX_SYS_PROG', 'true') +end + +if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then + command={BINDIR..'/'..basename..'.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then + command={BINDIR..'/'..basename..'-bin.exe'} +elseif lfs.isfile(BINDIR..'/'..basename..'.pl') then + script=BINDIR..'/'..basename..'.pl' + command={perlbin, script} +elseif kpse.find_file(basename..'.pl', 'texmfscripts') then + script=kpse.find_file(basename..'.pl', 'texmfscripts') + command={perlbin, script} +elseif kpse.find_file(basename..'.tlu', 'texmfscripts') then + script=kpse.find_file(basename..'.tlu', 'texmfscripts') + command={'texlua', script} +else + io.stderr:write(basename..'.bat: '..basename.. + ': No appropriate script found.\n') + os.exit(1) +end + +for i=2, #arg do + command[#command+1]=arg[i] +end + +command=fixwin(command) + +--[[ Prepend an additional hyphen to activate this code. +for i=0, #command do + print (command[i]) +end +os.exit(ret) +--]] + +-- finally in this special texdoc version we use os.execute to avoid the +-- weird problem with acroread 8.1 or 9. So we turn our nice list +-- back into a straight string +cmd_line = command[0] +for i = 2, #command do + cmd_line = cmd_line .. " " .. command[i] +end +--[[ debugging: print the command line +print (cmd_line) +-- ]] + +ret=os.execute(cmd_line) +os.exit(ret) -- cgit v1.2.3