Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

CSH_JUNKIE_QUOTES fix



-----BEGIN PGP SIGNED MESSAGE-----

This patch fixes CSH_JUNKIE_QUOTES, to properly emulate csh behaviour.
I think it now handles all cases as csh does.

 -zefram

      Index: Doc/zsh.texi
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Doc/zsh.texi,v
      retrieving revision 1.4
      diff -c -r1.4 zsh.texi
      *** Doc/zsh.texi	1996/12/22 09:11:29	1.4
      --- Doc/zsh.texi	1996/12/22 10:13:36
      ***************
      *** 4739,4744 ****
      --- 4739,4747 ----
        @code{csh}.
        These require that embedded newlines be preceded by a backslash;
        unescaped newlines will cause an error message.
      + In double-quoted strings, it is made impossible to quote `@code{$}',
      + `@code{`}' or `@code{"}' (and `@code{\}' itself no longer needs escaping).
      + Command substitutions are only expanded once, and cannot be nested.
        
        @item CSH_NULL_GLOB
        @cindex csh, null globbing style
      Index: Doc/zshoptions.man
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Doc/zshoptions.man,v
      retrieving revision 1.21
      diff -c -r1.21 zshoptions.man
      *** Doc/zshoptions.man	1996/12/22 09:11:32	1.21
      --- Doc/zshoptions.man	1996/12/22 10:13:38
      ***************
      *** 198,205 ****
        .BR csh .
        These require that embedded newlines be preceded by a backslash;
        unescaped newlines will cause an error message.
      ! .' Once the shell gets fixed, uncomment the following line:
      ! .' In double-quoted strings, it is made impossible to escape `$', ``' or `"'.
        .TP
        \fBCSH_NULL_GLOB\fP
        If a pattern for filename generation has no matches,
      --- 198,206 ----
        .BR csh .
        These require that embedded newlines be preceded by a backslash;
        unescaped newlines will cause an error message.
      ! In double-quoted strings, it is made impossible to escape `$', ``' or `"'
      ! (and `\e' itself no longer needs escaping).
      ! Command substitutions are only expanded once, and cannot be nested.
        .TP
        \fBCSH_NULL_GLOB\fP
        If a pattern for filename generation has no matches,
      Index: Src/lex.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/lex.c,v
      retrieving revision 1.19
      diff -c -r1.19 lex.c
      *** Src/lex.c	1996/12/22 04:50:31	1.19
      --- Src/lex.c	1996/12/22 10:02:16
      ***************
      *** 947,956 ****
        		if (c == '\\') {
        		    c = hgetc();
        		    if (c != '\n') {
      ! 			add(c == '`' || c == '\\' || c == '$' ? Bnull : '\\');
        			add(c);
      ! 		    }
      ! 		    else if (!sub && isset(CSHJUNKIEQUOTES))
        			add(c);
        		} else {
        		    if (!sub && isset(CSHJUNKIEQUOTES) && c == '\n') {
      --- 947,956 ----
        		if (c == '\\') {
        		    c = hgetc();
        		    if (c != '\n') {
      ! 			add((sub || unset(CSHJUNKIEQUOTES)) &&
      ! 			    (c == '`' || c == '\\' || c == '$') ? Bnull : '\\');
        			add(c);
      ! 		    } else if (!sub && isset(CSHJUNKIEQUOTES))
        			add(c);
        		} else {
        		    if (!sub && isset(CSHJUNKIEQUOTES) && c == '\n') {
      ***************
      *** 1012,1028 ****
        	switch (c) {
        	case '\\':
        	    c = hgetc();
      ! 	    if (c != '\n') {
      ! 		if (c == '$' || c == '\\' || (c == '}' && !intick && bct) ||
      ! 		    c == endchar || c == '`')
      ! 		    add(Bnull);
      ! 		else {
      ! 		    /* lexstop is implicitely handled here */
      ! 		    add('\\');
      ! 		    goto cont;
      ! 		}
      ! 	    } else if (sub || unset(CSHJUNKIEQUOTES) || endchar != '"')
        		continue;
        	    break;
        	case '\n':
        	    err = !sub && isset(CSHJUNKIEQUOTES) && endchar == '"';
      --- 1012,1035 ----
        	switch (c) {
        	case '\\':
        	    c = hgetc();
      ! 	    if(!sub && isset(CSHJUNKIEQUOTES) && endchar == '"') {
      ! 		if(c == '\n')
      ! 		    break;
      ! 		add('\\');
      ! 		if(c == endchar)
      ! 		    goto breakloop;
      ! 		goto cont;
      ! 	    }
      ! 	    if(c == '\n')
        		continue;
      + 	    if(c == '$' || c == '\\' || c == '`' || c == endchar ||
      + 		/*{*/ (c == '}' && !intick && bct))
      + 		add(Bnull);
      + 	    else {
      + 		/* lexstop is implicitly handled here */
      + 		add('\\');
      + 		goto cont;
      + 	    }
        	    break;
        	case '\n':
        	    err = !sub && isset(CSHJUNKIEQUOTES) && endchar == '"';
      ***************
      *** 1129,1134 ****
      --- 1136,1142 ----
        	    break;
        	add(c);
            }
      +     breakloop:
            if (intick == 2)
        	ALLOWHIST
            if (intick)

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMr0KfHD/+HJTpU/hAQFT0QP9Fex4P8+opze6wLTw0C9DCqqxBlBRcXRI
PFmnyay1VPGfwujicUV5oIYClNMKtTKi4aCfqjSiNNBz5heBvYJpN1OPpkPG/Xsd
n9d4AxEFqq80uPYNrUls/MH2F1JZ3qtAwyAeDkeBYKdVIPl3Orw0HAc7Vnx6ikq8
82RP7a2BqHI=
=C49V
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author