diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-10-03 12:44:42 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-10-03 12:44:42 +0000 |
commit | 60a495f02e7dec1db1776d8344cdd4da6a52a41f (patch) | |
tree | 11780489e9a53453161dd96e55dc36ed1db2614a /runtime/autoload/gzip.vim | |
parent | 89f3727bd9d8097336f763d9cdbe8d6055cab7c1 (diff) | |
download | vim-git-60a495f02e7dec1db1776d8344cdd4da6a52a41f.tar.gz |
updated for version 7.0-111v7.0.111
Diffstat (limited to 'runtime/autoload/gzip.vim')
-rw-r--r-- | runtime/autoload/gzip.vim | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index 1e119a455..933d83d09 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 @@ fun gzip#read(cmd) 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 @@ fun gzip#write(cmd) 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 @@ fun gzip#appre(cmd) 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 @@ fun s:tempname(name) 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 : |