--- Begin Message ---
On Apr 15, Martin Pool <[EMAIL PROTECTED]> wrote:
>Yes, I'd like that. --soften-links would be nice.
Attached. I hope everything needed to add a new option is there...
--
ciao,
Marco
diff -u rsync-2.5.4.orig/options.c rsync-2.5.4/options.c
--- rsync-2.5.4.orig/options.c Wed Feb 27 23:49:57 2002
+++ rsync-2.5.4/options.c Fri Apr 19 14:49:01 2002
@@ -58,6 +58,7 @@
int do_stats=0;
int do_progress=0;
int keep_partial=0;
+int soften_links=0;
int safe_symlinks=0;
int copy_unsafe_links=0;
int block_size=BLOCK_SIZE;
@@ -190,6 +191,7 @@
rprintf(F," --suffix=SUFFIX override backup suffix\n");
rprintf(F," -u, --update update only (don't overwrite newer
files)\n");
rprintf(F," -l, --links copy symlinks as symlinks\n");
+ rprintf(F," --soften-links soften cross-device hard links\n");
rprintf(F," -L, --copy-links copy the referent of symlinks\n");
rprintf(F," --copy-unsafe-links copy links outside the source tree\n");
rprintf(F," --safe-links ignore links outside the destination
tree\n");
@@ -289,6 +291,7 @@
{"include", 0, POPT_ARG_STRING, 0, OPT_INCLUDE},
{"exclude-from", 0, POPT_ARG_STRING, 0, OPT_EXCLUDE_FROM},
{"include-from", 0, POPT_ARG_STRING, 0, OPT_INCLUDE_FROM},
+ {"soften-links", 0, POPT_ARG_NONE, &soften_links},
{"safe-links", 0, POPT_ARG_NONE, &safe_symlinks},
{"help", 'h', POPT_ARG_NONE, 0, 'h'},
{"backup", 'b', POPT_ARG_NONE, &make_backups},
diff -u rsync-2.5.4.orig/rsync.yo rsync-2.5.4/rsync.yo
--- rsync-2.5.4.orig/rsync.yo Wed Feb 6 22:20:49 2002
+++ rsync-2.5.4/rsync.yo Fri Apr 19 14:53:49 2002
@@ -227,6 +227,7 @@
--suffix=SUFFIX override backup suffix
-u, --update update only (don't overwrite newer files)
-l, --links copy symlinks as symlinks
+ --soften-links soften cross-device hard links
-L, --copy-links copy the referent of symlinks
--copy-unsafe-links copy links outside the source tree
--safe-links ignore links outside the destination tree
@@ -383,6 +384,9 @@
dit(bf(-l, --links)) When symlinks are encountered, recreate the
symlink on the destination.
+
+dit(bf(--soften-links)) This option transforms cross-device hard links
+in symlinks.
dit(bf(-L, --copy-links)) When symlinks are encountered, the file that
they point to is copied, rather than the symlink.
diff -u rsync-2.5.4.orig/syscall.c rsync-2.5.4/syscall.c
--- rsync-2.5.4.orig/syscall.c Mon Feb 18 23:44:23 2002
+++ rsync-2.5.4/syscall.c Fri Apr 19 14:46:38 2002
@@ -29,6 +29,7 @@
extern int dry_run;
extern int read_only;
extern int list_only;
+extern int soften_links;
#define CHECK_RO if (read_only || list_only) {errno = EROFS; return -1;}
@@ -49,9 +50,14 @@
#if HAVE_LINK
int do_link(char *fname1, char *fname2)
{
+ int st;
+
if (dry_run) return 0;
CHECK_RO
- return link(fname1, fname2);
+ st = link(fname1, fname2);
+ if (st != 0 && errno == EXDEV && soften_links)
+ st = symlink(fname1, fname2);
+ return st;
}
#endif
--- End Message ---