From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28145 invoked from network); 22 Dec 1996 18:28:35 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 22 Dec 1996 18:28:35 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id NAA16957; Sun, 22 Dec 1996 13:20:25 -0500 (EST) Resent-Date: Sun, 22 Dec 1996 13:20:25 -0500 (EST) From: Zefram Message-Id: <807.199612221821@stone.dcs.warwick.ac.uk> Subject: CSH_JUNKIE_QUOTES fix To: zsh-workers@math.gatech.edu (Z Shell workers mailing list) Date: Sun, 22 Dec 1996 18:21:27 +0000 (GMT) X-Patch: 146 X-Loop: zefram@dcs.warwick.ac.uk X-Stardate: [-31]8613.82 X-US-Congress: Moronic fuckers Content-Type: text Resent-Message-ID: <"JO7sI1.0.u84.elNlo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2613 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu -----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-----