  EXTRAOBJS = @OBJLIST@
 Index: src/lib/attr.c
 ===================================================================
---- src/lib/attr.c	(rvision 4529)
+--- src/lib/attr.c	(rvision 4570)
 +++ src/lib/attr.c	(copie de travail)
 @@ -35,8 +35,8 @@
  

Index: patches/testing/breg.c
===================================================================
--- patches/testing/breg.c	(rvision 4529)
+++ patches/testing/breg.c	(copie de travail)
@@ -383,10 +383,11 @@
     * add_prefix   = !^!add_prefix!          5 bytes
     * add_suffix   = !([^/])$!$1add_suffix! 13 bytes
     */
-   int str_size = (strip_prefix?strlen(strip_prefix)+4:0 +
-		   add_prefix?strlen(add_prefix)+5:0     + /* escape + 3*, + \0 */ 
-		   add_suffix?strlen(add_suffix)+14:0     )     * 2  + 3   + 1;
+   int str_size = ((strip_prefix?strlen(strip_prefix)+4:0) +
+		   (add_prefix?strlen(add_prefix)+5    :0) + /* escape + 3*, + \0 */ 
+		   (add_suffix?strlen(add_suffix)+14   :0) )   * 2     + 3   + 1;
 
+   Dmsg1(1, "bregexp_get_build_where_size = %i\n", str_size);
    return str_size;
 }
 
@@ -432,7 +433,7 @@
 
    free_pool_memory(str_tmp);
 
-   return ret;
+   return dest;
 }
 
 
Index: patches/testing/bregtest.c
===================================================================
--- patches/testing/bregtest.c	(rvision 4529)
+++ patches/testing/bregtest.c	(copie de travail)
@@ -62,8 +62,11 @@
 
 int main(int argc, char *const *argv)
 {
-	printf("%s\n", bregexp_build_where("/tmp", NULL, ".old"));
-	exit(0);
+   char tab[500];
+   int len = bregexp_get_build_where_size("/tmp", "/tmp/toto", ".old");
+   
+   printf("%s\n", bregexp_build_where(tab, len, "/tmp", "/tmp/toto!", ".old"));
+   exit(0);
 
 
    regex_t preg;
Index: patches/testing/breg.h
===================================================================
--- patches/testing/breg.h	(rvision 4529)
+++ patches/testing/breg.h	(copie de travail)
@@ -98,8 +98,16 @@
 /* foreach_alist free RUNSCRIPT */
 void free_bregexps(alist *bregexps); /* you have to free alist */
 
-/* get a bregexp string from user arguments */
-char *bregexp_build_where(char *strip_prefix, 
+/* get regexp size */
+int bregexp_get_build_where_size(char *strip_prefix, 
+				 char *add_prefix, 
+				 char *add_suffix);
+
+/* get a bregexp string from user arguments 
+ * you must allocate it with bregexp_get_build_where_size();
+ */
+char *bregexp_build_where(char *dest, int str_size,
+			  char *strip_prefix, 
                           char *add_prefix, 
                           char *add_suffix);
 
Index: src/dird/ua_restore.c
===================================================================
--- src/dird/ua_restore.c	(rvision 4529)
+++ src/dird/ua_restore.c	(copie de travail)
@@ -43,8 +43,8 @@
 
 #include "bacula.h"
 #include "dird.h"
+#include "lib/breg.h"
 
-
 /* Imported functions */
 extern void print_bsr(UAContext *ua, RBSR *bsr);
 
@@ -83,6 +83,9 @@
    JCR *jcr = ua->jcr;
    char *escaped_bsr_name = NULL;
    char *escaped_where_name = NULL;

-               break;
+            case 8: /* rwhere */
             case 9: /* where */
+               /* TODO: this is ugly ... */
+               where_use_regexp = (j == 9)?false:true; /* rwhere or where ? */
+
                if (where) {
                   ua->send_msg(_("Where specified twice.\n"));
