diff options
Diffstat (limited to 'Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu')
-rwxr-xr-x | Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu b/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu index c3d8b12a5e5..68090e4eb3c 100755 --- a/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu +++ b/Master/texmf/scripts/tlgs/gswin32/ps2pdf.tlu @@ -22,24 +22,12 @@ function fixwin (args_unix) end function filename (file) - local filename - if string.find(file, '/') then -- UNIX path - filename=select(1, string.gsub(file, '.*/', '')) - elseif string.find(file, '\\') then -- Windows path - filename=select(1, string.gsub(file, '.*\\', '')) - else -- no path - filename=file - end - return(filename) + return string.match(file, '.*[/\\](.*)$') end function basename (file) - local basename - local fname - fname=filename (file) - basename=select(1, string.gsub(fname, '\.%a+$', '')) - return(basename) -end + return string.match(filename(file), '(.*)[\.].*') +end if os.type == 'windows' then gs='gswin32c' @@ -52,20 +40,20 @@ files={} options={} PDF_level='1.4' -if string.find(basename(arg[0]), '12') then +if string.find(filename(arg[0]), 'ps2pdf12') then PDF_level='1.2' -elseif string.find(basename(arg[0]), '13') then +elseif string.find(filename(arg[0]), 'ps2pdf13') then PDF_level='1.3' -elseif string.find(basename(arg[0]), '14') then +elseif string.find(filename(arg[0]), 'ps2pdf14') then PDF_level='1.4' end options[#options+1]='-dCompatibilityLevel='..PDF_level for i=1, #arg do - if string.find(arg[i], '^-$') then + if arg[i] == '-' then files[#files+1]=arg[i] - elseif string.find(arg[i], '^-') then + elseif string.find(arg[i], '^%-') then options[#options+1]=arg[i] else files[#files+1]=arg[i] @@ -78,9 +66,9 @@ if #files < 1 or #files > 2 then end if #files == 1 then - if string.find(files[1], '^-$') then + if files[1] == '-' then outfile='-' - elseif string.find(filename(files[1]), '\.e*ps$') then + elseif string.find(filename(files[1]), '\.[eE]?[pP][sS]$') then outfile=basename(files[1])..'.pdf' else outfile=filename(files[1])..'.pdf' |