Made --list-only output missing args as a "*missing" line.
[rsync/rsync.git] / generator.c
index fb832af..ec33d5a 100644 (file)
@@ -50,6 +50,7 @@ extern int delete_mode;
 extern int delete_before;
 extern int delete_during;
 extern int delete_after;
+extern int delete_missing_args;
 extern int msgdone_cnt;
 extern int ignore_errors;
 extern int remove_source_files;
@@ -1222,7 +1223,11 @@ static void list_file_entry(struct file_struct *f)
                        f_name(f, NULL), F_SYMLINK(f));
        } else
 #endif
-       {
+       if (delete_missing_args && !f->mode) {
+               rprintf(FINFO, "%-*s %s\n",
+                       /*colwidth*/11 + 31, "*missing",
+                       f_name(f, NULL));
+       } else {
                rprintf(FINFO, "%s %11.0f %s %s\n",
                        permbuf, len, timestring(f->modtime),
                        f_name(f, NULL));
@@ -1369,6 +1374,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
                stat_errno = errno;
        }
 
+       if (delete_missing_args && file->mode == 0) {
+               if (statret == 0)
+                       delete_item(fname, sx.st.st_mode, del_opts);
+               return;
+       }
+
        if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) {
                if (is_dir) {
                        if (is_dir < 0)