[Pkg-mc-commits] r88 - trunk/debian/patches

winnie at alioth.debian.org winnie at alioth.debian.org
Wed Feb 27 15:44:50 UTC 2008


Author: winnie
Date: 2008-02-27 15:44:49 +0000 (Wed, 27 Feb 2008)
New Revision: 88

Modified:
   trunk/debian/patches/61_escaping.patch
Log:
Modified patch for the escaping issues


Modified: trunk/debian/patches/61_escaping.patch
===================================================================
--- trunk/debian/patches/61_escaping.patch	2008-02-27 13:09:12 UTC (rev 87)
+++ trunk/debian/patches/61_escaping.patch	2008-02-27 15:44:49 UTC (rev 88)
@@ -1,25 +1,58 @@
-diff -u -r1.61 complete.c
---- ./src/complete.c	25 Sep 2007 15:33:36 -0000	1.61
-+++ ./src/complete.c	27 Feb 2008 12:01:12 -0000
-@@ -905,12 +905,40 @@
-     }
+Index: util.c
+===================================================================
+RCS file: /cvsroot/mc/mc/src/util.c,v
+retrieving revision 1.141
+diff -u -w -r1.141 util.c
+--- util.c	25 Sep 2007 15:33:37 -0000	1.141
++++ util.c	27 Feb 2008 15:38:13 -0000
+@@ -1525,3 +1525,58 @@
+     return (sep != NULL) ? sep + 1 : result;
  }
  
++/* Unescape paths or other strings for e.g the internal cd  */
 +char *
-+escape_string ( char * in ) {
++unescape_string ( const char * in ) {
 +	char * local = NULL;
 +	int i = 0;
 +	int j = 20;
 +	int k = 0;
 +
 +	local = g_malloc(j);
++	
++	for (i=0;i<=strlen(in);i++) {
++		if (i-k >= j ) {
++			j = j + 20;
++			local = g_realloc(local,j);
++		}
++		if ( (strchr(" \t*|;<>",in[i])) && ( strchr("\\",in[i-1])) ) {
++			k++;
++			local[i-k] = in[i];
++		} else {
++			local[i-k] = in[i];
++		}
++	}
++	local[i-k] = '\0';
++		
++	return local;
++}
 +
++/* To be compatible with the general posix command lines we have to escape *
++ * strings for the command line											   */
++char *
++escape_string ( const char * in ) {
++	char * local = NULL;
++	int i = 0;
++	int j = 20;
++	int k = 0;
++
++	local = g_malloc(j);
++
 +	for (i=0;i<strlen(in);i++) {
 +		if (i+k >= j ) { //If 20 chars is too low for the path
 +			j = j + 20;
 +			local = g_realloc(local,j);
 +		}
-+		if ( (strchr(" \t*|;<>~",in[i])) && (! strchr("\\",in[i-1])) ) {
++		if ( (strchr(" \t*|;<>",in[i])) && (! strchr("\\",in[i-1])) ) {
 +			local[i+k] = 92; // Ascii for "\"
 +			k = k+1;
 +			local[i+k] = in[i];
@@ -28,31 +61,102 @@
 +		}
 +	}
 +	local[i+k] = '\0';
-+	
++
 +	return local;
 +}
-+
- #define DO_INSERTION 1
- #define DO_QUERY     2
- /* Returns 1 if the user would like to see us again */
+Index: util.h
+===================================================================
+RCS file: /cvsroot/mc/mc/src/util.h,v
+retrieving revision 1.78
+diff -u -w -r1.78 util.h
+--- util.h	3 Feb 2006 17:04:17 -0000	1.78
++++ util.h	27 Feb 2008 15:38:13 -0000
+@@ -14,6 +14,8 @@
+ extern const char *cstrcasestr (const char *haystack, const char *needle);
+ extern const char *cstrstr (const char *haystack, const char *needle);
+ 
++char *unescape_string ( const char * in );
++char *escape_string ( const char * in );
+ void str_replace(char *s, char from, char to);
+ int  is_printable (int c);
+ void msglen (const char *text, /*@out@*/ int *lines, /*@out@*/ int *columns);
+Index: file.c
+===================================================================
+RCS file: /cvsroot/mc/mc/src/file.c,v
+retrieving revision 1.151
+diff -u -w -r1.151 file.c
+--- file.c	25 Sep 2007 15:33:36 -0000	1.151
++++ file.c	27 Feb 2008 15:38:14 -0000
+@@ -63,6 +63,7 @@
+ #include "widget.h"
+ #include "wtools.h"
+ #include "background.h"		/* we_are_background */
++#include "util.h"
+ 
+ /* Needed for current_panel, other_panel and WTree */
+ #include "dir.h"
+@@ -456,7 +457,7 @@
+ };
+ 
+ int
+-copy_file_file (FileOpContext *ctx, const char *src_path, const char *dst_path,
++copy_file_file (FileOpContext *ctx, const char *s, const char *d,
+ 		int ask_overwrite, off_t *progress_count,
+ 		double *progress_bytes, int is_toplevel_file)
+ {
+@@ -464,6 +465,8 @@
+     gid_t src_gid = (gid_t) - 1;
+ 
+     char *buf = NULL;
++    const char *dst_path = NULL;
++    const char *dst_path = NULL;
+     int buf_size = BUF_8K;
+     int src_desc, dest_desc = -1;
+     int n_read, n_written;
+@@ -479,7 +482,8 @@
+     /* FIXME: We should not be using global variables! */
+     ctx->do_reget = 0;
+     return_status = FILE_RETRY;
+-
++    dst_path = unescape_string(d);
++    src_path = unescape_string(s);
+     if (file_progress_show_source (ctx, src_path) == FILE_ABORT ||
+ 	file_progress_show_target (ctx, dst_path) == FILE_ABORT)
+ 	return FILE_ABORT;
+Index: complete.c
+===================================================================
+RCS file: /cvsroot/mc/mc/src/complete.c,v
+retrieving revision 1.61
+diff -u -w -r1.61 complete.c
+--- complete.c	25 Sep 2007 15:33:36 -0000	1.61
++++ complete.c	27 Feb 2008 15:38:14 -0000
+@@ -40,6 +40,7 @@
+ #include "wtools.h"
+ #include "complete.h"
+ #include "main.h"
++#include "util.h"
+ #include "key.h"		/* XCTRL and ALT macros */
+ 
+ typedef char *CompletionFunction (char *, int);
+@@ -911,6 +912,7 @@
  static int
  complete_engine (WInput *in, int what_to_do)
  {
-+	char *complete = NULL;
++    char *complete = NULL;
      if (in->completions && in->point != end)
      	free_completions (in);
      if (!in->completions){
-@@ -924,7 +952,8 @@
+@@ -924,7 +926,8 @@
      }
      if (in->completions){
      	if (what_to_do & DO_INSERTION || ((what_to_do & DO_QUERY) && !in->completions[1])) {
 -    	    if (insert_text (in, in->completions [0], strlen (in->completions [0]))){
-+			complete = escape_string(in->completions [0]);
++    	    complete = escape_string(in->completions [0]);
 +    	    if (insert_text (in, complete, strlen (complete))){
      	        if (in->completions [1])
      	    	    beep ();
  		else
-@@ -940,9 +969,11 @@
+@@ -940,9 +943,11 @@
      	    Dlg_head *query_dlg;
      	    WListbox *query_list;
      	    
@@ -65,48 +169,18 @@
      	    start_x = in->widget.x;
      	    start_y = in->widget.y;
      	    if (start_y - 2 >= count) {
-diff -u -r1.34 command.c
---- ./src/command.c	26 Sep 2007 10:22:25 -0000	1.34
-+++ ./src/command.c	27 Feb 2008 12:01:27 -0000
-@@ -45,6 +45,33 @@
- /* This holds the command line */
- WInput *cmdline;
- 
-+/* We'll get escaped strings now.. so we have to unescape them */
-+char *
-+unescape_string ( char * in ) {
-+	char * local = NULL;
-+	int i = 0;
-+	int j = 20;
-+	int k = 0;
-+
-+	local = g_malloc(j);
-+	
-+	for (i=0;i<=strlen(in);i++) {
-+		if (i-k >= j ) {
-+			j = j + 20;
-+			local = g_realloc(local,j);
-+		}
-+		if ( (strchr(" \t*|;<>~",in[i])) && ( strchr("\\",in[i-1])) ) {
-+			k++;
-+			local[i-k] = in[i];
-+		} else {
-+			local[i-k] = in[i];
-+		}
-+	}
-+	local[i-k] = '\0';
-+		
-+	return local;
-+}
-+
- /*
-  * Expand the argument to "cd" and change directory.  First try tilde
-  * expansion, then variable substitution.  If the CDPATH variable is set
-@@ -64,6 +91,7 @@
+Index: command.c
+===================================================================
+RCS file: /cvsroot/mc/mc/src/command.c,v
+retrieving revision 1.34
+diff -u -w -r1.34 command.c
+--- command.c	26 Sep 2007 10:22:25 -0000	1.34
++++ command.c	27 Feb 2008 15:38:15 -0000
+@@ -64,6 +64,7 @@
      const char *t;
  
      /* Tilde expansion */
-+	path = unescape_string(path);
++    path = unescape_string(path);
      path_tilde = tilde_expand (path);
  
      /* Leave space for further expansion */




More information about the Pkg-mc-commits mailing list