1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
To: vim-dev@vim.org
Subject: Patch 6.0.113
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 6.0.113
Problem: ":edit ~/fname" doesn't work if $HOME includes a space. Also,
expanding wildcards with the shell may fail. (John Daniel)
Solution: Escape spaces with a backslash when needed.
Files: src/ex_docmd.c, src/misc1.c, src/proto/misc1.pro, src/os_unix.c
*** ../vim60.112/src/ex_docmd.c Sat Dec 15 21:56:10 2001
--- src/ex_docmd.c Mon Dec 31 17:28:09 2001
***************
*** 3297,3303 ****
if (vim_strchr(eap->arg, '$') != NULL
|| vim_strchr(eap->arg, '~') != NULL)
{
! expand_env(eap->arg, NameBuff, MAXPATHL);
has_wildcards = mch_has_wildcard(NameBuff);
p = NameBuff;
}
--- 3297,3303 ----
if (vim_strchr(eap->arg, '$') != NULL
|| vim_strchr(eap->arg, '~') != NULL)
{
! expand_env_esc(eap->arg, NameBuff, MAXPATHL, TRUE);
has_wildcards = mch_has_wildcard(NameBuff);
p = NameBuff;
}
*** ../vim60.112/src/misc1.c Tue Nov 6 19:43:29 2001
--- src/misc1.c Mon Dec 31 17:46:07 2001
***************
*** 2834,2839 ****
--- 2834,2849 ----
char_u *dst; /* where to put the result */
int dstlen; /* maximum length of the result */
{
+ expand_env_esc(src, dst, dstlen, FALSE);
+ }
+
+ void
+ expand_env_esc(src, dst, dstlen, esc)
+ char_u *src; /* input string e.g. "$HOME/vim.hlp" */
+ char_u *dst; /* where to put the result */
+ int dstlen; /* maximum length of the result */
+ int esc; /* escape spaces in expanded variables */
+ {
char_u *tail;
int c;
char_u *var;
***************
*** 2999,3004 ****
--- 3009,3029 ----
var = NULL;
tail = (char_u *)""; /* for gcc */
#endif /* UNIX || VMS */
+ }
+
+ /* If "var" contains white space, escape it with a backslash.
+ * Required for ":e ~/tt" $HOME includes a space. */
+ if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL)
+ {
+ char_u *p = vim_strsave_escaped(var, (char_u *)" \t");
+
+ if (p != NULL)
+ {
+ if (mustfree)
+ vim_free(var);
+ var = p;
+ mustfree = TRUE;
+ }
}
if (var != NULL && *var != NUL
*** ../vim60.112/src/proto/misc1.pro Tue Sep 25 21:49:20 2001
--- src/proto/misc1.pro Mon Dec 31 17:26:25 2001
***************
*** 46,51 ****
--- 46,52 ----
void vim_beep __ARGS((void));
void init_homedir __ARGS((void));
void expand_env __ARGS((char_u *src, char_u *dst, int dstlen));
+ void expand_env_esc __ARGS((char_u *src, char_u *dst, int dstlen, int esc));
char_u *vim_getenv __ARGS((char_u *name, int *mustfree));
char_u *expand_env_save __ARGS((char_u *src));
void vim_setenv __ARGS((char_u *name, char_u *val));
*** ../vim60.112/src/os_unix.c Wed Oct 31 14:21:02 2001
--- src/os_unix.c Mon Dec 31 17:41:29 2001
***************
*** 4277,4289 ****
if (shell_style != STYLE_BT)
for (i = 0; i < num_pat; ++i)
{
! #ifdef USE_SYSTEM
! STRCAT(command, " \""); /* need extra quotes because we */
! STRCAT(command, pat[i]); /* start the shell twice */
! STRCAT(command, "\"");
! #else
! STRCAT(command, " ");
! STRCAT(command, pat[i]);
#endif
}
if (flags & EW_SILENT)
--- 4277,4299 ----
if (shell_style != STYLE_BT)
for (i = 0; i < num_pat; ++i)
{
! /* When using system() always add extra quotes, because the shell
! * is started twice. Otherwise it's only needed when the pattern
! * includes spaces or single quotes. */
! #ifndef USE_SYSTEM
! if (vim_strpbrk(pat[i], " '") != NULL)
! #endif
! {
! STRCAT(command, " \"");
! STRCAT(command, pat[i]);
! STRCAT(command, "\"");
! }
! #ifndef USE_SYSTEM
! else
! {
! STRCAT(command, " ");
! STRCAT(command, pat[i]);
! }
#endif
}
if (flags & EW_SILENT)
*** ../vim60.112/src/version.c Mon Dec 31 16:49:06 2001
--- src/version.c Mon Dec 31 17:43:12 2001
***************
*** 608,609 ****
--- 608,611 ----
{ /* Add new patch number below this line */
+ /**/
+ 113,
/**/
--
Microsoft: "Windows NT 4.0 now has the same user-interface as Windows 95"
Windows 95: "Press CTRL-ALT-DEL to reboot"
Windows NT 4.0: "Press CTRL-ALT-DEL to login"
/// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
\\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
|