summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-05 16:44:08 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-07-05 16:44:08 +0000
commit92472e72ff8124839fdc85a59190ad0bc3285b4a (patch)
treeba69d19b34f3fa49720614f9e60abfedbb34727f /Master/texmf
parent13838bec1998ac8522db5c29884d91d369617c27 (diff)
preparation code for multiple defaut viewer values
git-svn-id: svn://tug.org/texlive/trunk@9273 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/texdoc.tlu25
1 files changed, 25 insertions, 0 deletions
diff --git a/Master/texmf/scripts/texlive/texdoc.tlu b/Master/texmf/scripts/texlive/texdoc.tlu
index 715f0614dc3..90cf4a2c86e 100755
--- a/Master/texmf/scripts/texlive/texdoc.tlu
+++ b/Master/texmf/scripts/texlive/texdoc.tlu
@@ -376,4 +376,29 @@ end -- for docname in arg
-- cleanup_tmpdir();
+-- [[ to be used latter (mpg) ]]
+-- check if "name" is the name of a file in the path
+function is_in_path(name)
+ local var_sep, sep
+ if (os.type == "unix") then
+ var_sep, sep = ":", "/"
+ else
+ var_sep, sep = ";", "\\"
+ end
+ local path_list = string.explode(os.getenv("PATH"), var_sep)
+ for i, path in ipairs(path_list) do
+ if lfs.isfile(path..sep..name) then return true end
+ end
+ return false
+end
+
+-- return the first element of "list" found in the path, nil otherwise
+function first_in_path(list)
+ for i, name in ipairs(list) do
+ if is_in_path(name) then return name end
+ end
+ return nil
+end
+
+
-- vim: sw=4 ts=8 expandtab: