*** 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);
  	}
