- Updated the address for the FSF in the opening comment.
[rsync/rsync.git] / options.c
index 7eb419f..5f4c633 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1,7 +1,9 @@
-/*  -*- c-file-style: "linux" -*-
+/*
+ * Command-line (and received via daemon-socket) option parsing.
  *
- * Copyright (C) 1998-2001 by Andrew Tridgell <tridge@samba.org>
- * Copyright (C) 2000, 2001, 2002 by Martin Pool <mbp@samba.org>
+ * Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
+ * Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>
+ * Copyright (C) 2002, 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
@@ -15,7 +17,7 @@
  *
  * 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.
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "rsync.h"
@@ -58,8 +60,6 @@ int cvs_exclude = 0;
 int dry_run = 0;
 int do_xfers = 1;
 int ignore_times = 0;
-int saw_delete_opt = 0;
-int saw_delete_excluded_opt = 0;
 int delete_mode = 0;
 int delete_during = 0;
 int delete_before = 0;
@@ -1178,11 +1178,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                }
                delete_mode = delete_before = 1;
        }
-       saw_delete_opt = delete_mode;
-       saw_delete_excluded_opt = delete_excluded;
-       if (!xfer_dirs) {
-               delete_before = delete_during = delete_after = 0;
-               delete_mode = delete_excluded = 0;
+       if (!xfer_dirs && delete_mode) {
+               snprintf(err_buf, sizeof err_buf,
+                       "--delete does not work without -r or -d.\n");
+               return 0;
        }
 
        if (delete_mode && refused_delete) {