home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
wget153.zip
/
os2
/
wget-1.5.3-mirror.diff
< prev
next >
Wrap
Text File
|
1998-09-22
|
6KB
|
164 lines
diff -u wget-1.5.3/src/http.c wget-1.5.3-new/src/http.c
--- wget-1.5.3/src/http.c Thu Sep 10 19:14:44 1998
+++ wget-1.5.3-new/src/http.c Wed Sep 23 00:55:37 1998
@@ -841,6 +841,10 @@
int count;
int use_ts, got_head = 0; /* time-stamping info */
+ int size_changes; /* 0 - size not changed
+ 1 - size changed
+ 2 - size changed but --time-only */
+ int scratch = 0; /* do not continue, overwrite older local */
char *tms, *suf, *locf, *tmrate;
uerr_t err;
time_t tml = -1, tmr = -1; /* local and remote time-stamps */
@@ -938,7 +942,7 @@
/* Assume no restarting. */
hstat.restval = 0L;
/* Decide whether or not to restart. */
- if (((count > 1 && (*dt & ACCEPTRANGES)) || opt.always_rest)
+ if (((count > 1 && (*dt & ACCEPTRANGES)) || opt.always_rest) && !scratch
&& file_exists_p (u->local))
if (stat (u->local, &st) == 0)
hstat.restval = st.st_size;
@@ -950,6 +954,7 @@
/* Try fetching the document, or at least its head. :-) */
err = gethttp (u, &hstat, dt);
+ scratch=0;
/* Time? */
tms = time_str (NULL);
/* Get the new location (with or without the redirection). */
@@ -1056,12 +1061,40 @@
FREEHSTAT (hstat);
return RETROK;
}
- else if (tml >= tmr)
- logprintf (LOG_VERBOSE, _("\
-The sizes do not match (local %ld), retrieving.\n"), local_size);
- else
- logputs (LOG_VERBOSE,
- _("Remote file is newer, retrieving.\n"));
+ else {
+ /* size changed ? */
+ if (local_size != hstat.contlen) {
+ logprintf (LOG_VERBOSE, _("\
+The sizes do not match (local %ld)"), local_size);
+ /* ignore size changes ? */
+ if (opt.time_only) {
+ logprintf (LOG_VERBOSE, _(", ignored.\n"));
+ size_changes = 2;
+ } else {
+ logprintf (LOG_VERBOSE, _(", retrieving.\n"));
+ size_changes = 1;
+ }
+ } else
+ size_changes = 0;
+ /* remote newer ? */
+ if (tml < tmr) {
+ if (opt.rewrite_older) {
+ logputs (LOG_VERBOSE,
+ _("Remote file is newer, overwriting.\n"));
+ scratch = !scratch;
+ } else
+ /* if we said 'retrieving' - no new messages */
+ if (size_changes != 1)
+ logputs (LOG_VERBOSE,
+ _("Remote file is newer, retrieving.\n"));
+ } else
+ if (size_changes != 1) {
+ /* local newer and no retrieving due to size changes
+ - no retrieve */
+ FREEHSTAT (hstat);
+ return RETROK;
+ }
+ }
}
FREEHSTAT (hstat);
continue;
diff -u wget-1.5.3/src/init.c wget-1.5.3-new/src/init.c
--- wget-1.5.3/src/init.c Fri Sep 11 06:20:23 1998
+++ wget-1.5.3-new/src/init.c Wed Sep 23 00:56:30 1998
@@ -137,12 +137,14 @@
{ "relativeonly", &opt.relative_only, cmd_boolean },
{ "removelisting", &opt.remove_listing, cmd_boolean },
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
+ { "rewriteolder", &opt.rewrite_older, cmd_boolean },
{ "robots", &opt.use_robots, cmd_boolean },
{ "saveheaders", &opt.save_headers, cmd_boolean },
{ "serverresponse", &opt.server_response, cmd_boolean },
{ "simplehostcheck", &opt.simple_check, cmd_boolean },
{ "spanhosts", &opt.spanhost, cmd_boolean },
{ "spider", &opt.spider, cmd_boolean },
+ { "timeonly", &opt.time_only, cmd_boolean },
{ "timeout", &opt.timeout, cmd_time },
{ "timestamping", &opt.timestamping, cmd_boolean },
{ "tries", &opt.ntry, cmd_number_inf },
diff -u wget-1.5.3/src/main.c wget-1.5.3-new/src/main.c
--- wget-1.5.3/src/main.c Fri Sep 11 07:41:53 1998
+++ wget-1.5.3-new/src/main.c Wed Sep 23 00:58:55 1998
@@ -138,6 +138,8 @@
-c, --continue restart getting an existing file.\n\
--dot-style=STYLE set retrieval display style.\n\
-N, --timestamping don\'t retrieve files if older than local.\n\
+ --time-only retrieve only newer files, ignore size.\n\
+ --rewrite-older overwrite local file if remote file newer.\n\
-S, --server-response print server response.\n\
--spider don\'t download anything.\n\
-T, --timeout=SECONDS set the read timeout to SECONDS.\n\
@@ -223,11 +225,13 @@
{ "recursive", no_argument, NULL, 'r' },
{ "relative", no_argument, NULL, 'L' },
{ "retr-symlinks", no_argument, NULL, 9 },
+ { "rewrite-older", no_argument, NULL, 25 },
{ "save-headers", no_argument, NULL, 's' },
{ "server-response", no_argument, NULL, 'S' },
{ "span-hosts", no_argument, NULL, 'H' },
{ "spider", no_argument, NULL, 4 },
{ "timestamping", no_argument, NULL, 'N' },
+ { "time-only", no_argument, NULL, 24 },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
@@ -378,6 +382,12 @@
case 'N':
setval ("timestamping", "on");
break;
+ case 24:
+ setval ("timeonly", "on");
+ break;
+ case 25:
+ setval ("rewriteolder", "on");
+ break;
case 'S':
setval ("serverresponse", "on");
break;
@@ -576,6 +586,13 @@
{
printf (_("\
Can't timestamp and not clobber old files at the same time.\n"));
+ print_usage ();
+ exit (1);
+ }
+ if (!opt.timestamping && (opt.time_only || opt.rewrite_older))
+ {
+ printf (_("\
+Timestamping should be turned on when using --time-only or --rewrite-older.\n"));
print_usage ();
exit (1);
}
diff -u wget-1.5.3/src/options.h wget-1.5.3-new/src/options.h
--- wget-1.5.3/src/options.h Wed Apr 29 03:29:40 1998
+++ wget-1.5.3-new/src/options.h Wed Sep 23 00:59:48 1998
@@ -113,6 +113,10 @@
#endif /* DEBUG */
int timestamping; /* Whether to use time-stamping. */
+ int rewrite_older; /* Overwrite local If remote newer,
+ don't continue */
+ int time_only; /* Retrieve only if remote newer,
+ ignore filesize */
int backups; /* Are backups made? */
char *useragent; /* Naughty User-Agent, which can be