updated for version 7.0-111
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim
index 1e119a4..933d83d 100644
--- a/runtime/autoload/gzip.vim
+++ b/runtime/autoload/gzip.vim
@@ -1,6 +1,6 @@
" Vim autoload file for editing compressed files.
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2006 Jul 19
+" Last Change: 2006 Oct 03
" These functions are used by the gzip plugin.
@@ -68,9 +68,9 @@
let tmp = tempname()
let tmpe = tmp . "." . expand("<afile>:e")
" write the just read lines to a temp file "'[,']w tmp.gz"
- execute "silent '[,']w " . tmpe
+ execute "silent '[,']w " . escape(tmpe, ' ')
" uncompress the temp file: call system("gzip -dn tmp.gz")
- call system(a:cmd . " " . tmpe)
+ call system(a:cmd . " " . s:escape(tmpe))
if !filereadable(tmp)
" uncompress didn't work! Keep the compressed file then.
echoerr "Error: Could not read uncompressed file"
@@ -127,9 +127,9 @@
let nmt = s:tempname(nm)
if rename(nm, nmt) == 0
if exists("b:gzip_comp_arg")
- call system(a:cmd . " " . b:gzip_comp_arg . " '" . nmt . "'")
+ call system(a:cmd . " " . b:gzip_comp_arg . " " . s:escape(nmt))
else
- call system(a:cmd . " '" . nmt . "'")
+ call system(a:cmd . " " . s:escape(nmt))
endif
call rename(nmt . "." . expand("<afile>:e"), nm)
endif
@@ -154,10 +154,10 @@
if rename(nm, nmte) == 0
if &patchmode != "" && getfsize(nm . &patchmode) == -1
" Create patchmode file by creating the decompressed file new
- call system(a:cmd . " -c " . nmte . " > " . nmt)
+ call system(a:cmd . " -c " . s:escape(nmte) . " > " . s:escape(nmt))
call rename(nmte, nm . &patchmode)
else
- call system(a:cmd . " " . nmte)
+ call system(a:cmd . " " . s:escape(nmte))
endif
call rename(nmt, nm)
endif
@@ -175,4 +175,12 @@
return fnamemodify(a:name, ":p:h") . "/X~=@l9q5"
endfun
+fun s:escape(name)
+ " shellescape() was added by patch 7.0.111
+ if v:version > 700 || (v:version == 700 && has('patch111'))
+ return shellescape(a:name)
+ endif
+ return "'" . a:name . "'"
+endfun
+
" vim: set sw=2 :
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 939e784..caafd75 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0. Last change: 2006 May 06
+*eval.txt* For Vim version 7.0. Last change: 2006 Sep 22
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1709,6 +1709,8 @@
settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window
{winnr} in tab page {tabnr} to {val}
setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val}
+shellescape( {string}) String escape {string} for use as shell
+ command argument
simplify( {filename}) String simplify filename as much as possible
sort( {list} [, {func}]) List sort {list}, using {func} to compare
soundfold( {word}) String sound-fold {word}
@@ -4434,6 +4436,21 @@
:call setwinvar(1, "&list", 0)
:call setwinvar(2, "myvar", "foobar")
+shellescape({string}) *shellescape()*
+ Escape {string} for use as shell command argument.
+ On MS-Windows and MS-DOS, when 'shellslash' is not set, it
+ will enclose {string} double quotes and double all double
+ quotes within {string}.
+ For other systems, it will enclose {string} in single quotes
+ and replace all "'" with "'\''".
+ Example: >
+ :echo shellescape('c:\program files\vim')
+< results in:
+ "c:\program files\vim" ~
+ Example usage: >
+ :call system("chmod +x -- " . shellescape(expand("%")))
+
+
simplify({filename}) *simplify()*
Simplify the file name as much as possible without changing
the meaning. Shortcuts (on MS-Windows) or symbolic links (on