From 1f08245076f245547b00b1a6cc2dff0198c1dfab Mon Sep 17 00:00:00 2001 From: David Holman Date: Sat, 9 Jan 2010 18:57:18 -0800 Subject: [PATCH] --no-match-server-timestamps --- src/ChangeLog | 5 +++++ src/ftp.c | 3 ++- src/http.c | 3 ++- src/init.c | 3 +++ src/main.c | 1 + src/options.h | 3 +++ 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9480dc19..9ae5092d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-01-09 David Holman + + * init.c, main.c, http.c, ftp.c: Added support for + --no-match-server-timestamps. + 2009-12-03 Peter Rosin * snprintf.c (dopr): Output %p as unsigned. diff --git a/src/ftp.c b/src/ftp.c index 881c99be..73cade42 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1849,7 +1849,8 @@ Already have correct symlink %s -> %s\n\n"), original. :( */ if (actual_target != NULL) { - if (!(f->type == FT_SYMLINK && !opt.retr_symlinks) + if (opt.matchservertimestamps + && !(f->type == FT_SYMLINK && !opt.retr_symlinks) && f->tstamp != -1 && dlthis && file_exists_p (con->target)) diff --git a/src/http.c b/src/http.c index c7de37d8..5fdff618 100644 --- a/src/http.c +++ b/src/http.c @@ -2909,7 +2909,8 @@ Remote file exists.\n\n")); } /* send_head_first */ } /* !got_head */ - if ((tmr != (time_t) (-1)) + if (opt.matchservertimestamps + && (tmr != (time_t) (-1)) && ((hstat.len == hstat.contlen) || ((hstat.res == 0) && (hstat.contlen == -1)))) { diff --git a/src/init.c b/src/init.c index 49c6ea3d..c04414a3 100644 --- a/src/init.c +++ b/src/init.c @@ -197,6 +197,7 @@ static const struct { { "localencoding", &opt.locale, cmd_string }, { "logfile", &opt.lfilename, cmd_file }, { "login", &opt.ftp_user, cmd_string },/* deprecated*/ + { "matchservertimestamps", &opt.matchservertimestamps, cmd_boolean }, { "maxredirect", &opt.max_redirect, cmd_number }, { "mirror", NULL, cmd_spec_mirror }, { "netrc", &opt.netrc, cmd_boolean }, @@ -353,6 +354,8 @@ defaults (void) #endif opt.locale = NULL; opt.encoding_remote = NULL; + + opt.matchservertimestamps = true; } /* Return the user's home directory (strdup-ed), or NULL if none is diff --git a/src/main.c b/src/main.c index fda7d0f3..a76eef03 100644 --- a/src/main.c +++ b/src/main.c @@ -218,6 +218,7 @@ static struct cmdline_option option_data[] = { "limit-rate", 0, OPT_VALUE, "limitrate", -1 }, { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 }, { "local-encoding", 0, OPT_VALUE, "localencoding", -1 }, + { "match-server-timestamps", 0, OPT_BOOLEAN, "matchservertimestamps", -1 }, { "max-redirect", 0, OPT_VALUE, "maxredirect", -1 }, { "mirror", 'm', OPT_BOOLEAN, "mirror", -1 }, { "no", 'n', OPT__NO, NULL, required_argument }, diff --git a/src/options.h b/src/options.h index a8958637..5488e268 100644 --- a/src/options.h +++ b/src/options.h @@ -246,6 +246,9 @@ struct options int ftp_stmlf; /* Force Stream_LF format for binary FTP. */ #endif /* def __VMS */ + bool matchservertimestamps; /* Update downloaded files' timestamps to + match those on server? */ + }; extern struct options opt; -- 2.39.2