Sync with 4.4lite2

This commit is contained in:
tls 1995-09-08 01:05:59 +00:00
parent df2f99818a
commit 917ef72d79
11 changed files with 85 additions and 50 deletions

View File

@ -1,5 +1,5 @@
# from: @(#)Makefile 8.2 (Berkeley) 4/3/94
# $Id: Makefile,v 1.4 1994/08/29 03:09:05 mycroft Exp $
# @(#)Makefile 8.2 (Berkeley) 4/3/94
# $NetBSD: Makefile,v 1.5 1995/09/08 01:05:59 tls Exp $
PROG= ftp
SRCS= cmds.c cmdtab.c ftp.c main.c ruserpass.c domacro.c

View File

@ -1,3 +1,5 @@
/* $NetBSD: cmds.c,v 1.8 1995/09/08 01:06:05 tls Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)cmds.c 8.5 (Berkeley) 4/6/94";*/
static char *rcsid = "$Id: cmds.c,v 1.7 1994/12/15 08:58:44 jtc Exp $";
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
static char rcsid[] = "$NetBSD: cmds.c,v 1.8 1995/09/08 01:06:05 tls Exp $";
#endif
#endif /* not lint */
/*

View File

@ -1,3 +1,5 @@
/* $NetBSD: cmdtab.c,v 1.6 1995/09/08 01:06:10 tls Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)cmdtab.c 8.3 (Berkeley) 4/2/94";*/
static char *rcsid = "$Id: cmdtab.c,v 1.5 1994/08/29 03:09:08 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
#else
static char rcsid[] = "$NetBSD: cmdtab.c,v 1.6 1995/09/08 01:06:10 tls Exp $";
#endif
#endif /* not lint */
#include <stdio.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: domacro.c,v 1.5 1995/09/08 01:06:14 tls Exp $ */
/*
* Copyright (c) 1985, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)domacro.c 8.3 (Berkeley) 4/2/94";*/
static char *rcsid = "$Id: domacro.c,v 1.4 1994/08/29 03:09:09 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)domacro.c 8.3 (Berkeley) 4/2/94";
#else
static char rcsid[] = "$NetBSD: domacro.c,v 1.5 1995/09/08 01:06:14 tls Exp $";
#endif
#endif /* not lint */
#include <ctype.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: extern.h,v 1.4 1995/09/08 01:06:19 tls Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
* All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)extern.h 8.2 (Berkeley) 4/3/94
* $Id: extern.h,v 1.3 1994/08/29 03:09:10 mycroft Exp $
* @(#)extern.h 8.3 (Berkeley) 10/9/94
*/
struct timeval;

View File

@ -1,3 +1,5 @@
.\" $NetBSD: ftp.1,v 1.11 1995/09/08 01:06:24 tls Exp $
.\"
.\" Copyright (c) 1985, 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)ftp.1 8.2 (Berkeley) 12/30/93
.\" $Id: ftp.1,v 1.10 1995/01/13 00:09:41 jtc Exp $
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
.\"
.Dd December 30, 1993
.Dd October 9, 1994
.Dt FTP 1
.Os BSD 4.2
.Sh NAME
@ -42,7 +43,12 @@
file transfer program
.Sh SYNOPSIS
.Nm ftp
.Op Fl dgintv
.Op Fl t
.Op Fl v
.Op Fl d
.Op Fl i
.Op Fl n
.Op Fl g
.Op Ar host
.Sh DESCRIPTION
.Nm Ftp
@ -55,15 +61,16 @@ remote network site.
Options may be specified at the command line, or to the
command interpreter.
.Bl -tag -width flag
.It Fl d
Enables debugging.
.It Fl g
Disables file name globbing.
.It Fl i
Turns off interactive prompting during
multiple file transfers.
.It Fl t
Enables packet tracing.
.It Fl v
Verbose option forces
.Nm ftp
to show all responses from the remote server, as well
as report on data transfer statistics.
.It Fl n
Restrains
.Nm ftp
from attempting \*(Lqauto-login\*(Rq upon initial connection.
If auto-login is enabled,
.Nm ftp
@ -76,13 +83,13 @@ If no entry exists,
will prompt for the remote machine login name (default is the user
identity on the local machine), and, if necessary, prompt for a password
and an account with which to login.
.It Fl t
Enables packet tracing.
.It Fl v
Verbose option forces
.Nm ftp
to show all responses from the remote server, as well
as report on data transfer statistics.
.It Fl i
Turns off interactive prompting during
multiple file transfers.
.It Fl d
Enables debugging.
.It Fl g
Disables file name globbing.
.El
.Pp
The client host with which

View File

@ -1,3 +1,5 @@
/* $NetBSD: ftp.c,v 1.12 1995/09/08 01:06:28 tls Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -32,8 +34,11 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)ftp.c 8.4 (Berkeley) 4/6/94";*/
static char *rcsid = "$Id: ftp.c,v 1.11 1995/05/21 16:49:33 mycroft Exp $";
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
static char rcsid[] = "$NetBSD: ftp.c,v 1.12 1995/09/08 01:06:28 tls Exp $";
#endif
#endif /* not lint */
#include <sys/param.h>
@ -101,6 +106,8 @@ hookup(host, port)
return ((char *) 0);
}
hisctladdr.sin_family = hp->h_addrtype;
memmove((caddr_t)&hisctladdr.sin_addr,
hp->h_addr_list[0], hp->h_length);
memcpy(&hisctladdr.sin_addr, hp->h_addr, hp->h_length);
(void) strncpy(hostnamebuf, hp->h_name, sizeof(hostnamebuf));
}
@ -645,10 +652,10 @@ sendrequest(cmd, local, remote, printnames)
}
break;
}
(void) gettimeofday(&stop, (struct timezone *)0);
if (closefunc != NULL)
(*closefunc)(fin);
(void) fclose(dout);
(void) gettimeofday(&stop, (struct timezone *)0);
(void) getreply(0);
(void) signal(SIGINT, oldintr);
if (oldintp)
@ -657,7 +664,6 @@ sendrequest(cmd, local, remote, printnames)
ptransfer("sent", bytes, &start, &stop);
return;
abort:
(void) gettimeofday(&stop, (struct timezone *)0);
(void) signal(SIGINT, oldintr);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
@ -675,6 +681,7 @@ abort:
code = -1;
if (closefunc != NULL && fin != NULL)
(*closefunc)(fin);
(void) gettimeofday(&stop, (struct timezone *)0);
if (bytes > 0)
ptransfer("sent", bytes, &start, &stop);
}
@ -954,8 +961,8 @@ break2:
(void) signal(SIGINT, oldintr);
if (oldintp)
(void) signal(SIGPIPE, oldintp);
(void) gettimeofday(&stop, (struct timezone *)0);
(void) fclose(din);
(void) gettimeofday(&stop, (struct timezone *)0);
(void) getreply(0);
if (bytes > 0 && is_retr)
ptransfer("received", bytes, &start, &stop);
@ -964,7 +971,6 @@ abort:
/* abort using RFC959 recommended IP,SYNC sequence */
(void) gettimeofday(&stop, (struct timezone *)0);
if (oldintp)
(void) signal(SIGPIPE, oldintr);
(void) signal(SIGINT, SIG_IGN);
@ -984,6 +990,7 @@ abort:
(*closefunc)(fout);
if (din)
(void) fclose(din);
(void) gettimeofday(&stop, (struct timezone *)0);
if (bytes > 0)
ptransfer("received", bytes, &start, &stop);
(void) signal(SIGINT, oldintr);
@ -1018,10 +1025,10 @@ initconn()
/*
* What we've got at this point is a string of comma
* separated one-byte unsigned integer values, separated
* by commas. The first four are the an IP address. The
* fifth is the MSB of the port number, the sixth is the
* LSB. From that we'll prepare a sockaddr_in.
* separated one-byte unsigned integer values.
* The first four are the an IP address. The fifth is
* the MSB of the port number, the sixth is the LSB.
* From that we'll prepare a sockaddr_in.
*/
if (sscanf(pasv,"%d,%d,%d,%d,%d,%d",
@ -1155,7 +1162,7 @@ ptransfer(direction, bytes, t0, t1)
long bs;
if (verbose) {
timersub(t1, t0, &td);
timersub(&td, t1, t0);
s = td.tv_sec + (td.tv_usec / 1000000.);
#define nz(x) ((x) == 0 ? 1 : (x))
bs = bytes / nz(s);

View File

@ -1,3 +1,5 @@
/* $NetBSD: ftp_var.h,v 1.6 1995/09/08 01:06:32 tls Exp $ */
/*
* Copyright (c) 1985, 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)ftp_var.h 8.3 (Berkeley) 4/2/94
* $Id: ftp_var.h,v 1.5 1994/08/29 03:09:17 mycroft Exp $
* @(#)ftp_var.h 8.4 (Berkeley) 10/9/94
*/
/*

View File

@ -38,8 +38,11 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)main.c 8.4 (Berkeley) 4/3/94";*/
static char *rcsid = "$Id: main.c,v 1.7 1994/12/24 16:42:19 cgd Exp $";
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.8 1995/09/08 01:06:36 tls Exp $";
#endif
#endif /* not lint */
/*
@ -58,7 +61,6 @@ static char *rcsid = "$Id: main.c,v 1.7 1994/12/24 16:42:19 cgd Exp $";
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ftp_var.h"
@ -79,7 +81,7 @@ main(argc, argv)
interactive = 1;
autologin = 1;
while ((ch = getopt(argc, argv, "dgintv")) != -1) {
while ((ch = getopt(argc, argv, "dgintv")) != EOF) {
switch (ch) {
case 'd':
options |= SO_DEBUG;

View File

@ -1,3 +1,5 @@
/* $NetBSD: pathnames.h,v 1.5 1995/09/08 01:06:40 tls Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)pathnames.h 8.1 (Berkeley) 6/6/93
* $Id: pathnames.h,v 1.4 1994/08/29 03:09:19 mycroft Exp $
* @(#)pathnames.h 8.1 (Berkeley) 6/6/93
*/
#include <paths.h>

View File

@ -1,3 +1,5 @@
/* $NetBSD: ruserpass.c,v 1.6 1995/09/08 01:06:43 tls Exp $ */
/*
* Copyright (c) 1985, 1993, 1994
* The Regents of the University of California. All rights reserved.
@ -32,8 +34,7 @@
*/
#ifndef lint
/*static char sccsid[] = "from: @(#)ruserpass.c 8.3 (Berkeley) 4/2/94";*/
static char *rcsid = "$Id: ruserpass.c,v 1.5 1994/09/17 00:51:10 mycroft Exp $";
static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
#endif /* not lint */
#include <sys/types.h>
@ -145,7 +146,7 @@ next:
}
break;
case PASSWD:
if ((*aname == 0 || strcmp(*aname, "anonymous")) &&
if ((*aname == NULL || strcmp(*aname, "anonymous")) &&
fstat(fileno(cfile), &stb) >= 0 &&
(stb.st_mode & 077) != 0) {
warnx("Error: .netrc file is readable by others.");