summaryrefslogtreecommitdiff
path: root/indexing/xindex/lualatex/xindex-lapp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'indexing/xindex/lualatex/xindex-lapp.lua')
-rw-r--r--indexing/xindex/lualatex/xindex-lapp.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/indexing/xindex/lualatex/xindex-lapp.lua b/indexing/xindex/lualatex/xindex-lapp.lua
index cb79a0d550..e380413336 100644
--- a/indexing/xindex/lualatex/xindex-lapp.lua
+++ b/indexing/xindex/lualatex/xindex-lapp.lua
@@ -1,7 +1,7 @@
-- lapp.lua
-- Simple command-line parsing using human-readable specification
--
--- $Id: xindex-lapp.lua 9 2021-08-13 19:42:48Z hvoss $
+-- $Id: xindex-lapp.lua 12 2021-08-15 09:28:32Z hvoss $
-----------------------------
--~ -- args.lua
--~ local args = require ('lapp') [[
@@ -78,13 +78,18 @@ local function trim(s)
return ltrim(rtrim(s))
end
-local function open (file,opt)
+--- open a file.
+-- This will quit on error, and keep a list of file objects for later cleanup.
+-- @string file filename
+-- @string[opt] opt same as second parameter of `io.open`
+function open (file,opt)
local val,err = io.open(file,opt)
if not val then
- val,err = io.open(file..".idx",opt)
- if not val then
- error(err,true)
- end
+ file = file..".idx"
+ val,err = io.open(file,opt)
+ if not val then
+ error(err,true)
+ end
end
append(open_files,val)
return val