Made --list-only output missing args as a "*missing" line.
[rsync/rsync.git] / generator.c
index cd67f0f..6dc4e7f 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;
@@ -1030,7 +1031,11 @@ static void list_file_entry(struct file_struct *f)
                        F_SYMLINK(f));
        } else
 #endif
-       {
+       if (delete_missing_args && !f->mode) {
+               rprintf(FINFO, "%-*s %s\n",
+                       colwidth + 31, "*missing",
+                       f_name(f, NULL));
+       } else {
                rprintf(FINFO, "%s %*s %s %s\n",
                        permbuf, colwidth, comma_num(len),
                        timestring(f->modtime), f_name(f, NULL));
@@ -1172,6 +1177,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)