Re: wwwoffle-mv and alias

amb-Uxr6IM1mbv2TY6FTCsQk+9Bc4/[email protected] (Andrew M. Bishop)
Newsgroups gmane.network.wwwoffle.user
Message-ID <[email protected]>
Rolf Leggewie <[email protected]> writes:

> I want to use wwwoffle's alias function to automatically use mirrors for certain
> sites and merge the files already in the cache for main and mirror site.
> 
> I set up for example 'http://foo/url/ = http://bar/mirror/site1/url/'. This
> appears to be working.  Now I want to move the files from the foo folder to the
> bar folder to merge the data in the cache.  In the wwwoffle directory I issue
> the command 'wwwoffle-mv http/foo/ http://bar/mirror/foo/url/'[1].
> 
> Problem number 1 is that apparently wwwoffle-mv will completely overwrite what's
> already in the bar folder.  The workaround for this bug of course is trivial.
> Number 2 is trickier in that the additional 'mirror/foo/' portion is not picked.
> What can I do?

Try this patch.  It worked for me on a quick test.

-------------------- wwwoffle-tools.c.diff --------------------
--- wwwoffle-tools.c	2004/09/08 18:15:22	1.45
+++ wwwoffle-tools.c	2004/11/07 11:10:46
@@ -565,7 +565,7 @@
       {
        char *url1=FileNameToURL(ent->d_name);
 
-       if(url1)
+       if(url1 && !strncmp(Url1->name,url1,strlen(Url1->name)))
          {
           char *url2;
           URL *Url;
@@ -573,8 +573,8 @@
           int fd2;
 
           Url=SplitURL(url1);
-          url2=(char*)malloc(strlen(Url->pathp)+strlen(Url2->dir)+strlen(Url2->proto)+8);
-          sprintf(url2,"%s://%s%s",Url2->proto,Url2->dir,Url->pathp);
+          url2=(char*)malloc(strlen(Url2->proto)+strlen(Url2->host)+strlen(Url->pathp)+strlen(Url2->pathp)+8);
+          sprintf(url2,"%s://%s%s%s",Url2->proto,Url2->host,Url2->path,Url->pathp+strlen(Url1->path));
           FreeURL(Url);
 
           name1=ent->d_name;
-------------------- wwwoffle-tools.c.diff --------------------


> Footnotes:
> [1] There is a bug in the man page.  The command given is 'wwwoffle-mv
>      http/foo http/bar' where it should be 'wwwoffle-mv http/foo
>      http:/bar/'.

I haven't produced a wwwoffle-mv man page.

Why do you think that the second argument needs to have a ':' in it
and the first one does not?

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             amb-Uxr6IM1mbv2TY6FTCsQk+9Bc4/[email protected]
                                      http://www.gedanken.demon.co.uk/

WWWOFFLE users page:
        http://www.gedanken.demon.co.uk/wwwoffle/version-2.8/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.