zsh-workers
 help / color / mirror / code / Atom feed
* CSH_JUNKIE_QUOTES fix
@ 1996-12-22 18:21 Zefram
  1996-12-25 16:19 ` Zoltan Hidvegi
  0 siblings, 1 reply; 2+ messages in thread
From: Zefram @ 1996-12-22 18:21 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----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-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-12-26  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-22 18:21 CSH_JUNKIE_QUOTES fix Zefram
1996-12-25 16:19 ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).