Subject: some fixes

From: Matthias Clasen <[email-masked]>
Date: Tue, 2 Feb 1999 11:52:16 +0100

Since nobody has reacted to the problems with Move and GetArgument
which I reported some days ago, I looked myself and found that
there was an implicit assumption that the InteractiveMove function
would only be called from KeyPress or ButtonPress events. A one-line
fix is appended. The problem with GetArgument is a bit more complicated
to resolve and I ended up with an extra parameter to PeekArgument.
To avoid any possible problems I renamed it to DoPeekToken and wrote
a wrapper under the original name. This, too, is appended below.

I guess you may not want to apply these fixes while struggling to
put out 2.2. I'll be happy to push them on my stack of pending patches.

Matthias

--- fvwm/move.c.orig	Tue Feb  2 11:45:27 1999
+++ fvwm/move.c	Tue Feb  2 11:46:21 1999
@@ -788,7 +788,7 @@
       XFlush(dpy);
     }
 
-  if (eventp->type != KeyPress)
+  if (eventp->type == ButtonPress)
     {
       DragX = eventp->xbutton.x_root;
       DragY = eventp->xbutton.y_root;

--- libs/ModParse.c.orig	Tue Feb  2 11:46:38 1999
+++ libs/ModParse.c	Tue Feb  2 11:52:09 1999
@@ -24,8 +24,7 @@
 **         to MAX_TOKEN_LENGTH in size.
 */
 
-
-char *PeekArgument(const char *pstr)
+char *DoPeekArgument(const char *pstr, char **pret)
 {
   char *tok=NULL;
   const char *p;
@@ -53,13 +52,18 @@
         if ((IsQuote(*p) && bc == *p) || IsBlockEnd(*p,bc))
         {
           be = *p;
+          p++;
           break;
         }
       }
       else /* normal token */
       {
-        if (isspace(*p) || *p == ',')
+        if (isspace(*p)) {
+          break;
+        } else if (*p == ',') {
+          p++;
           break;
+        }
       }
 
       if (*p == '\\' && *(p+1)) /* if \, copy next char verbatim */
@@ -84,9 +88,16 @@
     }
   }
 
+  if (pret) *pret = p;
+
   return tok;
 }
 
+char *PeekArgument(const char *pstr)
+{
+  DoPeekArgument(pstr, NULL);
+}
+
 /*
 ** GetArgument: destructively rips next token from string, returning it
 **           (you should free returned string later)
@@ -95,12 +106,10 @@
 {
   char *tok ;
 
-  if (!pstr || !*pstr || !(tok=PeekArgument(*pstr)))
+  if (!pstr || !*pstr || !(tok=DoPeekArgument(*pstr, pstr)))
     return NULL;			/* *pstr=NULL; ???? */
 
   /* skip tok and following whitespace/separators in pstr & DON'T realloc */
-  EatWS(*pstr);
-  *pstr += strlen(tok);			/* != actual size (quote-collapsing) */
   EatWS(*pstr);
 
   if (!**pstr) 

-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: [email-masked]
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg
--
Visit the official FVWM web page at <URL:http://fvwm.math.uh.edu/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].