Add -n flag to use the current modtime rather than preserving it.

This commit is contained in:
Jordan K. Hubbard 1996-07-18 00:08:02 +00:00
parent 75d050aeaa
commit 6b5c2db22a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17205
2 changed files with 13 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.\" $Id$
.\" $Id: fetch.1,v 1.2 1996/07/05 01:03:20 jkh Exp $
.Dd July 2, 1996
.Dt FETCH 1
.Os
@ -7,11 +7,11 @@
.Nd retrieve a file by Uniform Resource Locator
.Sh SYNOPSIS
.Nm fetch
.Op Fl MPmpqr
.Op Fl MPmnpqr
.Op Fl o Ar file
.Ar URL
.Nm fetch
.Op Fl MPmpqr
.Op Fl MPmnpqr
.Op Fl o Ar file
.Op Fl c Ar dir
.Fl f Ar file
@ -51,6 +51,8 @@ Mirror mode: Set the modification time of the file so that it is
identical to the modification time of the file at the remote host.
If the file already exists on the local host and is identical (as
gauged by size and modification time), no transfer is done.
.It Fl n
Don't preserve the modtime of the transfered file, use the current time.
.It Fl P
.It Fl p
Use passive mode if you are behind a firewall.

View File

@ -24,7 +24,7 @@
* SUCH DAMAGE.
*/
/* $Id: main.c,v 1.7 1996/07/02 01:49:47 jmz Exp $ */
/* $Id: main.c,v 1.8 1996/07/05 00:06:36 jmz Exp $ */
#include <stdlib.h>
#include <stdio.h>
@ -63,6 +63,7 @@ char *file_to_get = 0;
int http = 0;
int http_port = 80;
int mirror = 0;
int newtime = 0;
int restart = 0;
time_t modtime;
@ -102,7 +103,7 @@ rm ()
if (file != stdout) {
if (!restart && !mirror)
remove (outputfile);
else if (!mirror) {
else if (!mirror && !newtime) {
tv[0].tv_usec = tv[1].tv_usec = 0;
tv[0].tv_sec = time(0);
tv[1].tv_sec = modtime;
@ -120,7 +121,7 @@ main (int argc, char **argv)
progname = s ? s+1 : argv[0];
while ((c = getopt (argc, argv, "D:HINPMV:Lqc:f:h:o:pmr")) != EOF) {
while ((c = getopt (argc, argv, "D:HINPMV:Lqc:f:h:o:pmnr")) != EOF) {
switch (c) {
case 'D': case 'H': case 'I': case 'N': case 'L': case 'V':
break; /* ncftp compatibility */
@ -152,6 +153,10 @@ main (int argc, char **argv)
mirror = 1;
break;
case 'n':
newtime = 1;
break;
case 'r':
restart = 1;
break;