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

Re: sh compatibility again :->



} The only way to resolve this would be with yet another option, SH_QUOTES
} or some such.  Worth it?  Dunno.

This is a ridiculously simple patch, so in case anybody wants it ... note
that this makes live the DPUTS(!*str, "Oops ...") error in the walk-off-
end-of-a-string loop for which I sent a patch last week, so you probably
want that earlier patch as well.

The only question about this patch is whether

+    int shq = (endchar == '"' && isset(SHQUOTES));

ought to be

+    int shq = ((endchar == '\0' || endchar == '"') && isset(SHQUOTES));

I actually think perhaps it should.

--- Src/globals.h.0	Sun Aug  4 21:15:43 1996
+++ Src/globals.h	Sun Aug 11 23:20:21 1996
@@ -764,6 +764,7 @@
     {"shinstdin", 		's',  's',  OPT_SPECIAL},
     {"shoptionletters",		0,    0,    OPT_EMULATE|OPT_BOURNE},
     {"shortloops", 		0,    0,    OPT_ALL},
+    {"shquotes", 		0,    0,    OPT_EMULATE|OPT_SH},
     {"shwordsplit", 		'y',  0,    OPT_EMULATE|OPT_BOURNE},
     {"singlecommand",		't',  't',  OPT_SPECIAL},
     {"singlelinezle", 		'M',  0,    OPT_KSH},
--- Src/lex.c.0	Sun Aug  4 23:09:29 1996
+++ Src/lex.c	Sun Aug 11 23:16:28 1996
@@ -1000,10 +1000,11 @@
     int c;
     int math = endchar == ')' || endchar == ']';
     int zlemath = math && cs > ll + addedx - inbufct;
+    int shq = (endchar == '"' && isset(SHQUOTES));
 
     while (((c = hgetc()) != endchar || bct ||
 	    (math && ((pct > 0) || (brct > 0))) ||
-	    intick) && !lexstop) {
+	    (intick && !shq)) && !lexstop) {
       cont:
 	switch (c) {
 	case '\\':
--- Src/zsh.h.0	Sun Aug  4 21:15:44 1996
+++ Src/zsh.h	Sun Aug 11 23:17:10 1996
@@ -1146,6 +1146,7 @@
     SHINSTDIN,
     SHOPTIONLETTERS,
     SHORTLOOPS,
+    SHQUOTES,
     SHWORDSPLIT,
     SINGLECOMMAND,
     SINGLELINEZLE,

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



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