Tcl Source Code

Artifact [fa6692b429]
Login

Artifact fa6692b4291de880d7a7b88ef2af2a0f256bd936:

Attachment "patch.txt" to ticket [672938ffff] added by davygrvy 2004-01-29 04:28:41.
*** tclWinPipe.c	20 Jan 2004 05:18:22 -0000	1.40
--- tclWinPipe.c	28 Jan 2004 21:06:12 -0000
***************
*** 1581,1590 ****
  	    arg = executable;
  	} else {
  	    arg = argv[i];
  	}
- 
- 	if(Tcl_DStringLength(&ds) > 0) Tcl_DStringAppend(&ds, " ", 1);
- 
  	quote = 0;
  	if (arg[0] == '\0') {
  	    quote = 1;
--- 1581,1588 ----
  	    arg = executable;
  	} else {
  	    arg = argv[i];
+ 	    Tcl_DStringAppend(&ds, " ", 1);
  	}
  	quote = 0;
  	if (arg[0] == '\0') {
  	    quote = 1;
***************
*** 1602,1640 ****
  	if (quote) {
  	    Tcl_DStringAppend(&ds, "\"", 1);
  	}
- 
  	start = arg;	    
  	for (special = arg; ; ) {
! 	    if ((*special == '\\') && 
! 		    (special[1] == '\\' || special[1] == '"')) {
! 		Tcl_DStringAppend(&ds, start, special - start);
! 		start = special;
! 		while (1) {
! 		    special++;
! 		    if (*special == '"') {
! 			/* 
! 			 * N backslashes followed a quote -> insert 
! 			 * N * 2 + 1 backslashes then a quote.
! 			 */
! 
! 			Tcl_DStringAppend(&ds, start, special - start);
! 			break;
! 		    }
! 		    if (*special != '\\') {
! 			break;
! 		    }
! 		}
! 		Tcl_DStringAppend(&ds, start, special - start);
! 		start = special;
! 	    }
! 	    if (*special == '"') {
! 		Tcl_DStringAppend(&ds, start, special - start);
! 		Tcl_DStringAppend(&ds, "\\\"", 2);
! 		start = special + 1;
! 	    }
! 	    if (*special == '{') {
! 		Tcl_DStringAppend(&ds, start, special - start);
! 		Tcl_DStringAppend(&ds, "\\{", 2);
  		start = special + 1;
  	    }
  	    if (*special == '\0') {
--- 1600,1610 ----
  	if (quote) {
  	    Tcl_DStringAppend(&ds, "\"", 1);
  	}
  	start = arg;	    
  	for (special = arg; ; ) {
! 	    if (*special == '"' && quote) {
! 		Tcl_DStringAppend(&ds, start, (int) (special - start));
! 		Tcl_DStringAppend(&ds, "\"\"", 2);
  		start = special + 1;
  	    }
  	    if (*special == '\0') {
***************
*** 1642,1648 ****
  	    }
  	    special++;
  	}
! 	Tcl_DStringAppend(&ds, start, special - start);
  	if (quote) {
  	    Tcl_DStringAppend(&ds, "\"", 1);
  	}
--- 1612,1618 ----
  	    }
  	    special++;
  	}
! 	Tcl_DStringAppend(&ds, start, (int) (special - start));
  	if (quote) {
  	    Tcl_DStringAppend(&ds, "\"", 1);
  	}