Re: Bug: Restarting with HUP signal works only once

From: Claude Lecommandeur (claude.lecommandeur@epfl.ch)
Date: Mon Apr 07 2003 - 15:17:57 CEST


Johan Vromans wrote:

>It is possible to restart ctwm 3.6 by sending it a HUP signal.
>However, this seems to work only once. Subsequent HUP signals seem to
>be ignored.
>
>-- Johan
>
>
   You are right, I tried to fix it but couldn't. Signals are always
very tricky.
I join a small patch for people who want to use full regex for window or
class names.

--- ctwm-3.6/list.c 2001-12-11 16:38:52.000000000 +0100
+++ ./list.c 2003-04-07 09:08:42.000000000 +0200
@@ -76,6 +76,11 @@
 #include "screen.h"
 #include "gram.h"
 
+#define USE_GNU_REGEX
+#ifdef USE_GNU_REGEX
+# include <regex.h>
+#endif /* USE_GNU_REGEX */
+
 extern int twmrc_error_prefix();
 
 /***********************************************************************
@@ -306,6 +311,31 @@
     *list = NULL;
 }
 
+#ifdef USE_GNU_REGEX
+
+#define MAXPATLEN 256
+
+int match (pattern, string)
+char *pattern, *string;
+{
+ regex_t preg;
+ int error;
+
+ if ((pattern == NULL) || (string == NULL)) return 0;
+ error = regcomp (&preg, pattern, REG_EXTENDED | REG_NOSUB);
+ if (error != 0) {
+ char buf [256];
+ (void) regerror (error, &preg, buf, sizeof buf);
+ fprintf (stderr, "%s : %s\n", buf, pattern);
+ return 0;
+ }
+ error = regexec (&preg, string, 5, 0, 0);
+ regfree (&preg);
+ if (error == 0) return 1;
+ return 0;
+}
+
+#else
 int regex_match_after_star ();
 
 int is_pattern (p)
@@ -429,3 +459,5 @@
     if ((p == NULL) || (t == NULL)) return (FALSE);
     return ((regex_match (p,t) == TRUE) ? TRUE : FALSE);
 }
+
+#endif

-- 
Claude Lecommandeur           Claude.Lecommandeur@Epfl.Ch
EPFL - SIC                    +41 21 693 22 97
1015 Lausanne (Switzerland)   http://slwww.epfl.ch/SIC/SL/info/Claude.html

This signature intentionally left boring.



This archive was generated by hypermail 2.1.4 : Tue Apr 08 2003 - 06:45:03 CEST