Skip to content
Tcl Source Code Artifact [5b721c8233]
Login

Artifact [5b721c8233]

Artifact 5b721c823307ea3a6c541e6c366151f09ce88d6c:

Attachment "patch.txt" to ticket [528669ffff] added by davygrvy on 2002-03-12 04:12:54.
Index: tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.23
diff -c -r1.23 tclWinPipe.c
*** tclWinPipe.c	25 Jan 2002 21:36:10 -0000	1.23
--- tclWinPipe.c	11 Mar 2002 21:01:27 -0000
***************
*** 1552,1561 ****
  	if (arg[0] == '\0') {
  	    quote = 1;
  	} else {
! 	    for (start = arg; *start != '\0'; start++) {
! 		if (isspace(*start)) { /* INTL: ISO space. */
! 		    quote = 1;
! 		    break;
  		}
  	    }
  	}
--- 1552,1566 ----
  	if (arg[0] == '\0') {
  	    quote = 1;
  	} else {
! 	    // quote the whole arg for a starting quote.
! 	    if (*arg == '"') {
! 		quote = 1;
! 	    } else {
! 		for (start = arg; *start != '\0'; start++) {
! 		    if (isspace(*start)) {
! 			quote = 1;
! 			break;
! 		    }
  		}
  	    }
  	}
***************
*** 1565,1595 ****
  
  	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 == '\0') {
--- 1570,1578 ----
  
  	start = arg;	    
  	for (special = arg; ; ) {
! 	    if (*special == '"' && quote) {
  		Tcl_DStringAppend(&ds, start, special - start);
! 		Tcl_DStringAppend(&ds, "\"\"", 2);
  		start = special + 1;
  	    }
  	    if (*special == '\0') {