zsh-workers
 help / color / mirror / code / Atom feed
* Glob qualifier close parenthesis tidy up
@ 1998-03-19 14:32 Peter Stephenson
  1998-03-19 17:06 ` PATCH: 3.0.5 " Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 1998-03-19 14:32 UTC (permalink / raw)
  To: Zsh hackers list

This fixes

% print foo(:g/o/a)
fa?o
  ^ 8-bit squiggle

which is actually two bugs: first, the `)' was included; second, the
tokens in the expression weren't removed.

Without my kshglob patch you will have to apply some of this by hand,
which shouldn't be a major cause of woe in this case.

*** Src/glob.c.cpar	Fri Feb  6 11:23:02 1998
--- Src/glob.c	Thu Mar 19 15:21:24 1998
***************
*** 864,869 ****
--- 864,871 ----
      }
      if (*str == ':' && str[-1] == Inpar) {
  	str[-1] = '\0';
+ 	str[strlen(str)-1] = '\0';
+ 	untokenize(str);
  	modify((char **) &getdata(np), &str);
  	return;
      }
***************
*** 896,905 ****
  		break;
  	if (*s == Inpar && (!isset(KSHGLOB) || (s > str && s[-1] == '-'))) {
  	    /* Real qualifiers found. */
  	    if (isset(KSHGLOB))
  		s[-1] = '\0';
  	    *s++ = '\0';
! 	    while (*s != Outpar && !colonmod) {
  		func = (int (*) _((Statptr, long)))0;
  		if (idigit(*s)) {
  		    /* Store numeric argument for qualifier */
--- 898,908 ----
  		break;
  	if (*s == Inpar && (!isset(KSHGLOB) || (s > str && s[-1] == '-'))) {
  	    /* Real qualifiers found. */
+ 	    str[sl-1] = '\0';
  	    if (isset(KSHGLOB))
  		s[-1] = '\0';
  	    *s++ = '\0';
! 	    while (*s && !colonmod) {
  		func = (int (*) _((Statptr, long)))0;
  		if (idigit(*s)) {
  		    /* Store numeric argument for qualifier */
***************
*** 925,930 ****
--- 928,934 ----
  			/* Remaining arguments are history-type     *
  			 * colon substitutions, handled separately. */
  			colonmod = s - 1;
+ 			untokenize(colonmod);
  			break;
  		    case Hat:
  		    case '^':
***************
*** 1086,1092 ****
  				    zerr("unknown user", NULL, 0);
  				    data = 0;
  				}
! 				if ((*tt = sav) != Outpar)
  				    s = tt + 1;
  				else
  				    s = tt;
--- 1090,1096 ----
  				    zerr("unknown user", NULL, 0);
  				    data = 0;
  				}
! 				if ((*tt = sav))
  				    s = tt + 1;
  				else
  				    s = tt;
***************
*** 1119,1125 ****
  				    zerr("unknown group", NULL, 0);
  				    data = 0;
  				}
! 				if ((*tt = sav) != Outpar)
  				    s = tt + 1;
  				else
  				    s = tt;
--- 1123,1129 ----
  				    zerr("unknown group", NULL, 0);
  				    data = 0;
  				}
! 				if ((*tt = sav))
  				    s = tt + 1;
  				else
  				    s = tt;

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


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

* PATCH: 3.0.5 Glob qualifier close parenthesis tidy up
  1998-03-19 14:32 Glob qualifier close parenthesis tidy up Peter Stephenson
@ 1998-03-19 17:06 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 1998-03-19 17:06 UTC (permalink / raw)
  To: Zsh hackers list

On Mar 19,  3:32pm, Peter Stephenson wrote:
} Subject: Glob qualifier close parenthesis tidy up
}
} This fixes
} 
} % print foo(:g/o/a)
} fa?o
}   ^ 8-bit squiggle
} 
} which is actually two bugs: first, the `)' was included; second, the
} tokens in the expression weren't removed.

Here's the patch against the original 3.0.5 (i.e., PWS's kshglob patch
is -not- needed first).

--- glob.c.orig	Wed Nov 19 08:40:29 1997
+++ glob.c	Thu Mar 19 09:03:07 1998
@@ -144,6 +144,8 @@
     }
     if (*str == ':' && str[-1] == Inpar) {
 	str[-1] = '\0';
+	str[strlen(str)-1] = '\0';
+	untokenize(str);
 	modify((char **) &getdata(np), &str);
 	return;
     }
@@ -175,8 +177,9 @@
 		break;
 	if (*s == Inpar) {
 	    /* Real qualifiers found. */
+	    str[sl-1] = '\0';
 	    *s++ = '\0';
-	    while (*s != Outpar && !colonmod) {
+	    while (*s && !colonmod) {
 		func = (int (*) _((Statptr, long)))0;
 		if (idigit(*s)) {
 		    /* Store numeric argument for qualifier */
@@ -202,6 +205,7 @@
 			/* Remaining arguments are history-type     *
 			 * colon substitutions, handled separately. */
 			colonmod = s - 1;
+			untokenize(colonmod);
 			break;
 		    case Hat:
 		    case '^':
@@ -363,7 +367,7 @@
 				    zerr("unknown user", NULL, 0);
 				    data = 0;
 				}
-				if ((*tt = sav) != Outpar)
+				if ((*tt = sav))
 				    s = tt + 1;
 				else
 				    s = tt;
@@ -396,7 +400,7 @@
 				    zerr("unknown group", NULL, 0);
 				    data = 0;
 				}
-				if ((*tt = sav) != Outpar)
+				if ((*tt = sav))
 				    s = tt + 1;
 				else
 				    s = tt;

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1998-03-19 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-03-19 14:32 Glob qualifier close parenthesis tidy up Peter Stephenson
1998-03-19 17:06 ` PATCH: 3.0.5 " Bart Schaefer

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