Re: ignore symlinks on remote site

"Alexander V. Lukyanov" <[email protected]>
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
On Thu, Oct 21, 2004 at 11:51:26AM +0400, Alexander V. Lukyanov wrote:
> On Tue, Oct 19, 2004 at 03:46:41PM +0200, Gerulf Schnitzler wrote:
> > is there any way to let lftp ignore symlinks?
> > if not, will such a feature be implemented?
>
> It is rather easy to implement. Look at MirrorJob.cc file, modify section
> after `case SYMLINK'.

Here is a patch I made.

--
   Alexander.
diff (text/plain, 1.5 KB)
Index: MirrorJob.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/MirrorJob.cc,v
retrieving revision 1.113
diff -u -p -r1.113 MirrorJob.cc
--- MirrorJob.cc	21 Oct 2004 08:36:52 -0000	1.113
+++ MirrorJob.cc	21 Oct 2004 09:39:25 -0000
@@ -380,6 +380,9 @@ void  MirrorJob::HandleFile(FileInfo *fi
       }
       case(FileInfo::SYMLINK):
       {
+	 if(!(flags&NO_SYMLINKS))
+	    goto skip;
+
 	 if(!target_is_local)
 	 {
 	    // can't create symlink remotely (FIXME?)
@@ -1185,6 +1188,7 @@ CMD(mirror)
       {"dry-run",   optional_argument,0,256+'S'},
       {"delete-first",no_argument,0,256+'e'},
       {"use-pget-n",optional_argument,0,256+'p'},
+      {"no-symlinks",no_argument,0,256+'y'},
       {0}
    };
 
@@ -1334,6 +1338,9 @@ CMD(mirror)
 	 break;
       case(256+'e'):
 	 flags|=MirrorJob::REMOVE_FIRST|MirrorJob::DELETE;
+	 break;
+      case(256+'y'):
+	 flags|=MirrorJob::NO_SYMLINKS;
 	 break;
       case('?'):
 	 eprintf(_("Try `help %s' for more information.\n"),args->a0());
Index: MirrorJob.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/MirrorJob.h,v
retrieving revision 1.39
diff -u -p -r1.39 MirrorJob.h
--- MirrorJob.h	17 Feb 2004 10:45:57 -0000	1.39
+++ MirrorJob.h	21 Oct 2004 09:37:12 -0000
@@ -139,7 +139,8 @@ public:
       ALLOW_CHOWN=1<<9,
       IGNORE_TIME=1<<10,
       REMOVE_FIRST=1<<11,
-      IGNORE_SIZE=1<<12
+      IGNORE_SIZE=1<<12,
+      NO_SYMLINKS=1<<13
    };
 
    void SetFlags(int f,int v)
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.