Updated the FSF's address to an even newer one.
[rsync/rsync.git] / sender.c
index 00b60c9..db7974c 100644 (file)
--- a/sender.c
+++ b/sender.c
@@ -1,21 +1,24 @@
 /*
-   Copyright (C) Andrew Tridgell 1996
-   Copyright (C) Paul Mackerras 1996
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ * Routines only used by the sending process.
+ *
+ * Copyright (C) 1996 Andrew Tridgell
+ * Copyright (C) 1996 Paul Mackerras
+ * Copyright (C) 2003, 2004, 2005, 2006 Wayne Davison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
 
 #include "rsync.h"
 
@@ -27,6 +30,7 @@ extern int log_before_transfer;
 extern int log_format_has_i;
 extern int daemon_log_format_has_i;
 extern int csum_length;
+extern int append_mode;
 extern int io_error;
 extern int allowed_lull;
 extern int protocol_version;
@@ -72,6 +76,13 @@ static struct sum_struct *receive_sums(int f)
                        (double)s->count, (long)s->blength, (long)s->remainder);
        }
 
+       if (append_mode) {
+               s->flength = (OFF_T)s->count * s->blength;
+               if (s->remainder)
+                       s->flength -= s->blength - s->remainder;
+               return s;
+       }
+
        if (s->count == 0)
                return(s);
 
@@ -125,11 +136,9 @@ void successful_send(int ndx)
                                    file->dir.root, "/", NULL);
        } else
                offset = 0;
-       f_name_to(file, fname + offset);
-       if (remove_sent_files && do_unlink(fname) == 0 && verbose > 1) {
-               rprintf(FINFO, "sender removed %s\n",
-                       safe_fname(fname + offset));
-       }
+       f_name(file, fname + offset);
+       if (remove_sent_files && do_unlink(fname) == 0 && verbose > 1)
+               rprintf(FINFO, "sender removed %s\n", fname + offset);
 }
 
 static void write_ndx_and_attrs(int f_out, int ndx, int iflags,
@@ -231,6 +240,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
                        /* For inplace: redo phase turns off the backup
                         * flag so that we do a regular inplace send. */
                        make_backups = 0;
+                       append_mode = 0;
                        continue;
                }
 
@@ -247,7 +257,7 @@ void send_files(struct file_list *flist, int f_out, int f_in)
                                fname[offset++] = '/';
                } else
                        offset = 0;
-               fname2 = f_name_to(file, fname + offset);
+               fname2 = f_name(file, fname + offset);
 
                if (verbose > 2)
                        rprintf(FINFO, "send_files(%d, %s)\n", i, fname);
@@ -322,22 +332,20 @@ void send_files(struct file_list *flist, int f_out, int f_in)
 
                if (verbose > 2) {
                        rprintf(FINFO, "send_files mapped %s of size %.0f\n",
-                               safe_fname(fname), (double)st.st_size);
+                               fname, (double)st.st_size);
                }
 
                write_ndx_and_attrs(f_out, i, iflags, fnamecmp_type,
                                    xname, xlen);
                write_sum_head(f_xfer, s);
 
-               if (verbose > 2) {
-                       rprintf(FINFO, "calling match_sums %s\n",
-                               safe_fname(fname));
-               }
+               if (verbose > 2)
+                       rprintf(FINFO, "calling match_sums %s\n", fname);
 
                if (log_before_transfer)
                        log_item(file, &initial_stats, iflags, NULL);
                else if (!am_server && verbose && do_progress)
-                       rprintf(FINFO, "%s\n", safe_fname(fname2));
+                       rprintf(FINFO, "%s\n", fname2);
 
                set_compression(fname);
 
@@ -361,10 +369,8 @@ void send_files(struct file_list *flist, int f_out, int f_in)
 
                free_sums(s);
 
-               if (verbose > 2) {
-                       rprintf(FINFO, "sender finished %s\n",
-                               safe_fname(fname));
-               }
+               if (verbose > 2)
+                       rprintf(FINFO, "sender finished %s\n", fname);
 
                /* Flag that we actually sent this entry. */
                file->flags |= FLAG_SENT;