X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/2dbf36ef550d63550188480bb596c88cbeecf54a..0f78b81511be65d8fe21af1e6ac674f9e80ac29d:/options.c diff --git a/options.c b/options.c index 6509d958..5f4c6338 100644 --- 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 - * Copyright (C) 2000, 2001, 2002 by Martin Pool + * Copyright (C) 1998-2001 Andrew Tridgell + * Copyright (C) 2000, 2001, 2002 Martin Pool + * 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; @@ -437,7 +437,9 @@ static struct poptOption long_options[] = { {"safe-links", 0, POPT_ARG_NONE, &safe_symlinks, 0, 0, 0 }, {"copy-dirlinks", 'k', POPT_ARG_NONE, ©_dirlinks, 0, 0, 0 }, {"keep-dirlinks", 'K', POPT_ARG_NONE, &keep_dirlinks, 0, 0, 0 }, - {"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links, 0, 0, 0 }, + {"hard-links", 'H', POPT_ARG_VAL, &preserve_hard_links, 1, 0, 0 }, + {"no-hard-links", 0, POPT_ARG_VAL, &preserve_hard_links, 0, 0, 0 }, + {"no-H", 0, POPT_ARG_VAL, &preserve_hard_links, 0, 0, 0 }, {"relative", 'R', POPT_ARG_VAL, &relative_paths, 1, 0, 0 }, {"no-relative", 0, POPT_ARG_VAL, &relative_paths, 0, 0, 0 }, {"no-R", 0, POPT_ARG_VAL, &relative_paths, 0, 0, 0 }, @@ -1176,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) {