diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-07-06 12:48:42 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-07-06 12:48:42 +0000 |
commit | c4f55d18e1867246a14633667cc4279d3e2ef1ca (patch) | |
tree | 8ccd65a522c76bab7f86bfcb04d590e4a5b78815 /Master/texmf | |
parent | 1d728a6aade7e5f11d008b4c6f5297adf57d473a (diff) |
source cleanup 2: rm useless ';' at end of statements
git-svn-id: svn://tug.org/texlive/trunk@9288 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-x | Master/texmf/scripts/texlive/texdoc.tlu | 115 |
1 files changed, 56 insertions, 59 deletions
diff --git a/Master/texmf/scripts/texlive/texdoc.tlu b/Master/texmf/scripts/texlive/texdoc.tlu index 3339fdc871f..7d50c59170f 100755 --- a/Master/texmf/scripts/texlive/texdoc.tlu +++ b/Master/texmf/scripts/texlive/texdoc.tlu @@ -18,8 +18,8 @@ Public domain.]] - initial public release ]] -progname = 'texdoc'; -version = '0.31'; +progname = 'texdoc' +version = '0.31' usage_msg = [[ Usage: texdoc -h, --help | -v, --version | [option] name -h|--help Show this help. @@ -31,33 +31,34 @@ notfound_msg = [[ Sorry, I'm not smart enough to find documentation for PKGNAME. Please see http://tug.org/pkginfo/PKGNAME for information about the package.]] - +-- must have at least one arg if not arg[1] then - print (usage_msg); + print (usage_msg) return end -mode = 'view'; -verbose = false; +opt_debug = false +mode = 'view' +verbose = false while table.maxn(arg) > 0 and string.match(arg[1],'^%-') do curr_arg = table.remove(arg,1) if string.match (curr_arg,'-h') or string.match (curr_arg,'--help') then - print (usage_msg); - os.exit(0); + print (usage_msg) + os.exit(0) elseif string.match (curr_arg,'-V') or string.match (curr_arg,'--version') then - print (progname .. ' version: ' .. version ); - os.exit(0); + print (progname .. ' version: ' .. version ) + os.exit(0) elseif string.match (curr_arg,'-v') or string.match (curr_arg,'--verbose') then - verbose = true; + verbose = true elseif string.match (curr_arg,'-l') or string.match (curr_arg,'--list') then - mode = 'list'; + mode = 'list' elseif string.match (curr_arg,'-s') or string.match (curr_arg,'--search') then - mode = 'search'; + mode = 'search' end end @@ -85,10 +86,10 @@ end -- [[ functions for the search option ]] -no_lsr_doctrees = {}; +no_lsr_doctrees = {} function get_lsr_files () - local lsr_files = {}; - local pathlist = kpse.expand_braces('$TEXDOCS'); + local lsr_files = {} + local pathlist = kpse.expand_braces('$TEXDOCS') for path in string.gmatch(pathlist, "[^:;]+") do path = string.gsub(path,'//$','') local tree_root @@ -241,7 +242,7 @@ if (os.type == "windows") then texdoc_unzip = { gz = "gzip -d -c ", bz2 = "bzip2 -d -c " - }; + } texdoc_viewer = { dvi = '(start /wait %s ) &', html = '(start /wait %s) &', @@ -249,15 +250,15 @@ if (os.type == "windows") then ps = '(start /wait %s) &', txt = '(start /wait %s) &', tex = '(start /wait %s) &' - }; - rmfile_command = 'del /F '; - rmdir_command = 'rmdir '; + } + rmfile_command = 'del /F ' + rmdir_command = 'rmdir ' else -- since we don't support msdos, if os.type is not windows, it's unix texdoc_unzip = { gz = "gzip -d -c ", bz2 = "bzip2 -d -c " - }; + } if (os.name == 'macosx') then texdoc_viewer = { dvi = '(open %s)', @@ -266,7 +267,7 @@ else ps = '(open %s)', txt = '(less %s )', tex = '(less %s )' - }; + } else texdoc_viewer = { dvi = '(xdvi %s ) &', @@ -275,16 +276,16 @@ else ps = '(gv %s) &', txt = '(less %s )', tex = '(less %s )' - }; + } end - rmfile_command = 'rm -f '; - rmdir_command = 'rmdir '; + rmfile_command = 'rm -f ' + rmdir_command = 'rmdir ' end -texdoc_zipformats = {'','gz','bz2'}; -texdoc_formats = {'','dvi','html','pdf','ps','txt','tex'}; +texdoc_zipformats = {'','gz','bz2'} +texdoc_formats = {'','dvi','html','pdf','ps','txt','tex'} extlist = {'','.dvi', '.dvi.gz', '.dvi.bz2', '.pdf', '.pdf.gz', '.pdf.bz2', -'.ps', '.ps.gz', '.ps.bz2', '.txt', '.txt.gz', '.txt.bz2', '.html'}; +'.ps', '.ps.gz', '.ps.bz2', '.txt', '.txt.gz', '.txt.bz2', '.html'} -- [[ override hardcoded variables with values from texmf.cnf ]] rmfile_command = set_var_from_texmf(rmfile_command,'TEXDOC_RMFILE') @@ -299,7 +300,7 @@ for zipext in list_iter(texdoc_zipformats) do viewer_var = 'TEXDOC_UNZIP_' .. string.upper(zipext) texdoc_unzip[zipext] = set_var_from_texmf(texdoc_unzip[zipext],viewer_var) end -extlist = set_listvar_from_expand_braces(extlist,'$TEXDOCEXT'); +extlist = set_listvar_from_expand_braces(extlist,'$TEXDOCEXT') -- we want an empty string for ext at the beginning, so that it works -- to specify the complete filename. Doesn't matter when there's one -- more empty string, but we can easily avoid two in a row @@ -310,36 +311,36 @@ end -- [[ uncompress if needed ]] function unzip_if_needed (ext) - zipext = string.match(ext,'%..*%.(.*)'); + zipext = string.match(ext,'%..*%.(.*)') if zipext then - unzip_command = texdoc_unzip[zipext]; - viewext = string.match(ext,'%.(.*)%..*$'); - basebame_pattern = '.*/(.*%.' .. viewext .. ')'; - basename = string.match(filename,basebame_pattern); + unzip_command = texdoc_unzip[zipext] + viewext = string.match(ext,'%.(.*)%..*$') + basebame_pattern = '.*/(.*%.' .. viewext .. ')' + basename = string.match(filename,basebame_pattern) -- uncompress only once per file, in case it is given -- more than once (dvi besides ps or so) -- TODO: to be done - tmpdir = os.tmpdir("/tmp/texdoc.XXXXXX"); + tmpdir = os.tmpdir("/tmp/texdoc.XXXXXX") unzip_commandline = unzip_command .. filename .. " > " - .. tmpdir .. "/" .. basename; + .. tmpdir .. "/" .. basename if os.execute(unzip_commandline) then - filename = tmpdir .. "/" .. basename; + filename = tmpdir .. "/" .. basename else - print("Error executing \n" .. unzip_commandline); + print("Error executing \n" .. unzip_commandline) end viewer_replacement = filename .. ';' .. rmfile_command - .. filename .. ';' .. rmdir_command .. tmpdir; + .. filename .. ';' .. rmdir_command .. tmpdir else if ext == '' then -- fallback if complete filename has been specified ext = string.match(filename,'.*(%..*)$') if not ext then -- still no extension for filenames like README - ext = 'txt'; + ext = 'txt' end end - viewer_replacement = filename; - viewext = string.match(ext,'%.(.*)$'); + viewer_replacement = filename + viewext = string.match(ext,'%.(.*)$') if not viewext or not texdoc_viewer[viewext] then -- complete filename specified, unknown extension, use "txt" viewext = 'txt' @@ -351,7 +352,7 @@ for docname in list_iter (arg) do local docfound = false if string.match(mode,'search') then docfound = true - pattern_search(docname); + pattern_search(docname) elseif string.match(mode,'view') or string.match(mode,'list') then for ext in list_iter(extlist) do filename = kpse.find_file(docname .. ext, @@ -359,20 +360,20 @@ for docname in list_iter (arg) do if filename then docfound = true if string.match (mode, 'list') then - print(filename); + print(filename) else -- mode is view, is unzipping needed? unzip_if_needed(ext) view_command = string.gsub( texdoc_viewer[viewext], '%%s',viewer_replacement) if verbose then - print(view_command); + print(view_command) end - view_result = os.execute(view_command); + view_result = os.execute(view_command) if view_result then - do break end; + do break end else - print("Error executing \n" .. view_command); + print("Error executing \n" .. view_command) end end -- list or view end -- found a filename with that extension or not? @@ -384,20 +385,16 @@ for docname in list_iter (arg) do end end -- for docname in arg --- cleanup_tmpdir(); +-- cleanup_tmpdir() -- [[ to be used latter (mpg) ]] + -- check if "name" is the name of a file in the path +-- Warning: to be used only on Unix (hard-coded separators and useless on win) 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) + local path_list = string.explode(os.getenv("PATH"), ':') for i, path in ipairs(path_list) do - if lfs.isfile(path..sep..name) then return true end + if lfs.isfile(path..'/'..name) then return true end end return false end @@ -412,7 +409,7 @@ end -- Local Variables: -- lua-indent-level: 4 --- tab-width: 8 +-- tab-width: 4 -- indent-tabs-mode: nil -- End: --- vim: sw=4 ts=8 expandtab: +-- vim: sw=4 ts=4 expandtab: |