1
diff -u -w -r1.141 util.c
2
--- ./src/util.c 25 Sep 2007 15:33:37 -0000 1.141
3
+++ ./src/util.c 27 Feb 2008 15:38:13 -0000
5
return (sep != NULL) ? sep + 1 : result;
8
+/* Unescape paths or other strings for e.g the internal cd */
10
+unescape_string ( const char * in ) {
11
+ char * local = NULL;
16
+ local = g_malloc(j);
18
+ for (i=0;i<=strlen(in);i++) {
21
+ local = g_realloc(local,j);
23
+ if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && ( strchr("\\",in[i-1])) ) {
35
+/* To be compatible with the general posix command lines we have to escape *
36
+ * strings for the command line */
38
+escape_string ( const char * in ) {
39
+ char * local = NULL;
44
+ local = g_malloc(j);
46
+ for (i=0;i<strlen(in);i++) {
47
+ if (i+k+1 >= j ) { //If 20 chars is too low for the path
49
+ local = g_realloc(local,j);
51
+ if ( (strchr(" \t*|;<>~#()?[]{}&",in[i])) && (! strchr("\\",in[i-1])) ) {
52
+ local[i+k] = 92; // Ascii for "\"
63
diff -u -w -r1.78 util.h
64
--- ./src/util.h 3 Feb 2006 17:04:17 -0000 1.78
65
+++ ./src/util.h 27 Feb 2008 15:38:13 -0000
67
extern const char *cstrcasestr (const char *haystack, const char *needle);
68
extern const char *cstrstr (const char *haystack, const char *needle);
70
+char *unescape_string ( const char * in );
71
+char *escape_string ( const char * in );
72
void str_replace(char *s, char from, char to);
73
int is_printable (int c);
74
void msglen (const char *text, /*@out@*/ int *lines, /*@out@*/ int *columns);
75
diff -u -w -r1.61 complete.c
76
--- ./src/complete.c 25 Sep 2007 15:33:36 -0000 1.61
77
+++ ./src/complete.c 27 Feb 2008 15:38:14 -0000
83
#include "key.h" /* XCTRL and ALT macros */
85
typedef char *CompletionFunction (char *, int);
88
complete_engine (WInput *in, int what_to_do)
90
+ char *complete = NULL;
91
if (in->completions && in->point != end)
92
free_completions (in);
93
if (!in->completions){
97
if (what_to_do & DO_INSERTION || ((what_to_do & DO_QUERY) && !in->completions[1])) {
98
- if (insert_text (in, in->completions [0], strlen (in->completions [0]))){
99
+ complete = escape_string(in->completions [0]);
100
+ if (insert_text (in, complete, strlen (complete))){
101
if (in->completions [1])
106
WListbox *query_list;
108
- for (p=in->completions + 1; *p; count++, p++)
109
+ for (p=in->completions + 1; *p; count++, p++) {
110
+ *p = escape_string(*p);
111
if ((i = strlen (*p)) > maxlen)
114
start_x = in->widget.x;
115
start_y = in->widget.y;
116
if (start_y - 2 >= count) {
117
diff -u -w -r1.34 command.c
118
--- ./src/command.c 26 Sep 2007 10:22:25 -0000 1.34
119
+++ ./src/command.c 27 Feb 2008 15:38:15 -0000
123
/* Tilde expansion */
124
+ path = unescape_string(path);
125
path_tilde = tilde_expand (path);
127
/* Leave space for further expansion */
128
diff -u -w -r1.151 file.c
129
--- ./src/file.c 25 Sep 2007 15:33:36 -0000 1.151
130
+++ ./src/file.c 5 Mar 2008 09:15:47 -0000
134
#include "background.h" /* we_are_background */
137
/* Needed for current_panel, other_panel and WTree */
144
+ if (!appending && ctx->preserve) {
145
while (mc_chmod (dst_path, (src_mode & ctx->umask_kill))) {
146
temp_status = file_error (
147
_(" Cannot chmod target file \"%s\" \n %s "), dst_path);
148
@@ -1872,6 +1890,8 @@
152
+ source_with_path = unescape_string(source_with_path);
153
+ dest = unescape_string(dest);
157
@@ -1963,6 +1983,9 @@
159
char *temp2 = concat_dir_and_file (dest, temp);
161
+ source_with_path = unescape_string(source_with_path);
162
+ temp2 = unescape_string(temp2);