* hash & progress are mutually exclusive. [noted by mrg@netbsd.org]

* in autofetch mode, don't attempt to 'cd /' on first xfer (only on
  subsequent xfers), as some ftp daemons don't permit that.
  [noted by dbj@netbsd.org].
  XXX: code could be smarter (but a lot more complicated to boot); this
  works for now.
This commit is contained in:
lukem 1998-10-08 14:45:26 +00:00
parent b9fd5a00c7
commit da0a823fb0
3 changed files with 40 additions and 25 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.43 1998/09/01 14:25:52 lukem Exp $ */
/* $NetBSD: cmds.c,v 1.44 1998/10/08 14:45:26 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
__RCSID("$NetBSD: cmds.c,v 1.43 1998/09/01 14:25:52 lukem Exp $");
__RCSID("$NetBSD: cmds.c,v 1.44 1998/10/08 14:45:26 lukem Exp $");
#endif
#endif /* not lint */
@ -843,6 +843,8 @@ sethash(argc, argv)
if (hash)
fprintf(ttyout, " (%d bytes/hash mark)", mark);
fputs(".\n", ttyout);
if (hash)
progress = 0;
code = hash;
}
@ -883,6 +885,8 @@ setprogress(argc, argv)
{
code = togglevar(argc, argv, &progress, "Progress bar");
if (progress)
hash = 0;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.35 1998/09/01 04:42:49 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.36 1998/10/08 14:45:26 lukem Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.35 1998/09/01 04:42:49 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.36 1998/10/08 14:45:26 lukem Exp $");
#endif /* not lint */
/*
@ -833,6 +833,16 @@ auto_fetch(argc, argv, outfile)
host ? host : "", ntohs(port), path ? path : "",
dir ? dir : "", file ? file : "");
dirhasglob = filehasglob = 0;
if (doglob) {
if (! EMPTYSTRING(dir) &&
strpbrk(dir, "*?[]{}") != NULL)
dirhasglob = 1;
if (! EMPTYSTRING(file) &&
strpbrk(file, "*?[]{}") != NULL)
filehasglob = 1;
}
/*
* Set up the connection if we don't have one.
*/
@ -867,27 +877,19 @@ auto_fetch(argc, argv, outfile)
break;
}
/* Always use binary transfers. */
/* Always use binary transfers. */
setbinary(0, NULL);
}
/* cd back to `/' */
xargv[0] = "cd";
xargv[1] = "/";
xargv[2] = NULL;
cd(2, xargv);
if (! dirchange) {
rval = argpos + 1;
break;
}
dirhasglob = filehasglob = 0;
if (doglob) {
if (! EMPTYSTRING(dir) &&
strpbrk(dir, "*?[]{}") != NULL)
dirhasglob = 1;
if (! EMPTYSTRING(file) &&
strpbrk(file, "*?[]{}") != NULL)
filehasglob = 1;
} else {
/* connection exists, cd back to `/' */
xargv[0] = "cd";
xargv[1] = "/";
xargv[2] = NULL;
dirchange = 0;
cd(2, xargv);
if (! dirchange) {
rval = argpos + 1;
break;
}
}
/* Change directories, if necessary. */
@ -895,6 +897,7 @@ auto_fetch(argc, argv, outfile)
xargv[0] = "cd";
xargv[1] = dir;
xargv[2] = NULL;
dirchange = 0;
cd(2, xargv);
if (! dirchange) {
rval = argpos + 1;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ftp.1,v 1.29 1998/08/08 02:58:48 lukem Exp $
.\" $NetBSD: ftp.1,v 1.30 1998/10/08 14:45:26 lukem Exp $
.\"
.\" Copyright (c) 1985, 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -430,6 +430,10 @@ The size of a data block defaults to 1024 bytes.
This can be changed by specifying
.Ar size
in bytes.
Enabling
.Ic hash
disables
.Ic progress .
.It Ic help Op Ar command
Print an informative message about the meaning of
.Ar command .
@ -741,6 +745,10 @@ or a command that starts with
Refer to
.Sx FILE NAMING CONVENTIONS
for more information.
Enabling
.Ic progress
disables
.Ic hash .
.It Ic prompt
Toggle interactive prompting.
Interactive prompting