Hi,

i patched names.c to be able to use regexp with complete_clientwin.
Works for me, maybe its useful for someone.

Regards,
Johannes
-- 
"The net treats censorship as a malfunction and re-routes around it."
(John Gilmore)
--- names_orig.c        2003-11-24 15:36:48.000000000 +0100
+++ names.c     2003-11-24 15:43:12.000000000 +0100
@@ -12,6 +12,7 @@
 
 #include <string.h>
 #include <limits.h>
+#include <regex.h>
 
 #include "common.h"
 #include "region.h"
@@ -386,32 +387,37 @@
        int lnum=0, l=0;
        int n=0;
        ExtlTab tab=extl_create_table();
-       
+       int error;
+       regex_t regex;
+
        if(nam==NULL)
                nam="";
        
        l=strlen(nam);
+
+       if((error=regcomp(&regex,nam,REG_EXTENDED))) {
+               size_t length; 
+               char *buffer;
+               length = regerror(error, &regex, NULL, 0);
+               buffer = malloc(length);
+               regerror (error, &regex, buffer, length);
+               warn(buffer);
+               free(buffer);
+               regfree(&regex);
+               return tab;
+       }
        
 again:
        
        for(reg=ns->list; reg!=NULL; reg=reg->ni.ns_next){
                name=region_name(reg);
                
-               if(name==NULL)
+               if (regexec(&regex, name, (size_t) 0, NULL, 0)==0)
+                       if(extl_table_seti_s(tab, n+1, name))
+                               n++;
+               else
                        continue;
                
-               if(l!=0){
-                  if(lnum==0 && strncmp(name, nam, l))
-                               continue;
-                  if(lnum==1 && strstr(name, nam)==NULL)
-                               continue;
-               }
-
-               if(typenam!=NULL && !wobj_is_str((WObj*)reg, typenam))
-                       continue;
-                       
-               if(extl_table_seti_s(tab, n+1, name))
-                       n++;
        }
        
        if(n==0 && lnum==0 && l>=1){

Reply via email to