* use RCSID() && COPYRIGHT() macros
* cleanup for WARNS=1 (including some ugly '(void)&var' bits wrapped in #ifdef __GNUC__ to shut up gcc warnings WRT setjmp/longjmp) * use strtol() instead of atoi(), and more extensively check result of conversion * use u_int16_t instead of short or int for TCP port addresses
This commit is contained in:
parent
8b7ade1ab8
commit
b9d5554d5d
@ -1,9 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.11 1997/03/24 21:59:36 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.12 1997/07/20 09:45:35 lukem Exp $
|
||||
# from: @(#)Makefile 8.2 (Berkeley) 4/3/94
|
||||
|
||||
PROG= ftp
|
||||
SRCS= cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c ruserpass.c \
|
||||
util.c
|
||||
WARNS= 1
|
||||
|
||||
LDADD+= -ledit -ltermcap
|
||||
DPADD+= ${LIBEDIT} ${LIBTERMCAP}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cmds.c,v 1.24 1997/05/17 19:44:36 pk Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.25 1997/07/20 09:45:38 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: cmds.c,v 1.24 1997/05/17 19:44:36 pk Exp $";
|
||||
__RCSID("$NetBSD: cmds.c,v 1.25 1997/07/20 09:45:38 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -874,8 +875,6 @@ setdebug(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int val;
|
||||
|
||||
if (argc > 2) {
|
||||
printf("usage: %s [ on | off | debuglevel ]\n", argv[0]);
|
||||
code = -1;
|
||||
@ -886,13 +885,16 @@ setdebug(argc, argv)
|
||||
else if (strcasecmp(argv[1], "off") == 0)
|
||||
debug = 0;
|
||||
else {
|
||||
val = atoi(argv[1]);
|
||||
if (val < 0) {
|
||||
char *ep;
|
||||
long val;
|
||||
|
||||
val = strtol(argv[1], &ep, 10);
|
||||
if (val < 0 || val > INT_MAX || *ep != '\0') {
|
||||
printf("%s: bad debugging value.\n", argv[1]);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
debug = val;
|
||||
debug = (int)val;
|
||||
}
|
||||
} else
|
||||
debug = !debug;
|
||||
@ -1093,7 +1095,7 @@ mls(argc, argv)
|
||||
{
|
||||
sig_t oldintr;
|
||||
int ointer, i;
|
||||
const char *cmd;
|
||||
int dolist;
|
||||
char mode[1], *dest;
|
||||
|
||||
if (argc < 2 && !another(&argc, &argv, "remote-files"))
|
||||
@ -1112,14 +1114,14 @@ usage:
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
cmd = strcmp(argv[0], "mls") == 0 ? "NLST" : "LIST";
|
||||
dolist = strcmp(argv[0], "mls");
|
||||
mname = argv[0];
|
||||
mflag = 1;
|
||||
oldintr = signal(SIGINT, mabort);
|
||||
(void)setjmp(jabort);
|
||||
for (i = 1; mflag && i < argc-1; ++i) {
|
||||
*mode = (i == 1) ? 'w' : 'a';
|
||||
recvrequest(cmd, dest, argv[i], mode, 0);
|
||||
recvrequest(dolist ? "LIST" : "NLST", dest, argv[i], mode, 0);
|
||||
if (!mflag && fromatty) {
|
||||
ointer = interactive;
|
||||
interactive = 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cmdtab.c,v 1.15 1997/04/05 03:27:33 lukem Exp $ */
|
||||
/* $NetBSD: cmdtab.c,v 1.16 1997/07/20 09:45:41 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: cmdtab.c,v 1.15 1997/04/05 03:27:33 lukem Exp $";
|
||||
__RCSID("$NetBSD: cmdtab.c,v 1.16 1997/07/20 09:45:41 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: complete.c,v 1.8 1997/05/24 16:34:30 lukem Exp $ */
|
||||
/* $NetBSD: complete.c,v 1.9 1997/07/20 09:45:43 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -37,8 +37,10 @@
|
||||
*/
|
||||
|
||||
#ifndef SMALL
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: complete.c,v 1.8 1997/05/24 16:34:30 lukem Exp $";
|
||||
__RCSID("$NetBSD: complete.c,v 1.9 1997/07/20 09:45:43 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -54,6 +56,12 @@ static char rcsid[] = "$NetBSD: complete.c,v 1.8 1997/05/24 16:34:30 lukem Exp $
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
static int comparstr __P((const void *, const void *));
|
||||
static unsigned char complete_ambiguous __P((char *, int, StringList *));
|
||||
static unsigned char complete_command __P((char *, int));
|
||||
static unsigned char complete_local __P((char *, int));
|
||||
static unsigned char complete_remote __P((char *, int));
|
||||
|
||||
static int
|
||||
comparstr(a, b)
|
||||
const void *a, *b;
|
||||
@ -362,4 +370,5 @@ complete(el, ch)
|
||||
|
||||
return (CC_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !SMALL */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: domacro.c,v 1.9 1997/03/13 06:23:14 lukem Exp $ */
|
||||
/* $NetBSD: domacro.c,v 1.10 1997/07/20 09:45:45 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)domacro.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: domacro.c,v 1.9 1997/03/13 06:23:14 lukem Exp $";
|
||||
__RCSID("$NetBSD: domacro.c,v 1.10 1997/07/20 09:45:45 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.15 1997/04/14 09:09:17 lukem Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.16 1997/07/20 09:45:48 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
@ -41,7 +41,6 @@ void abort_remote __P((FILE *));
|
||||
void abortpt __P((int));
|
||||
void abortrecv __P((int));
|
||||
void abortsend __P((int));
|
||||
void aborthttp __P((int));
|
||||
void account __P((int, char **));
|
||||
void alarmtimer __P((int));
|
||||
int another __P((int *, char ***, const char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fetch.c,v 1.11 1997/06/29 06:34:50 lukem Exp $ */
|
||||
/* $NetBSD: fetch.c,v 1.12 1997/07/20 09:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -36,8 +36,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: fetch.c,v 1.11 1997/06/29 06:34:50 lukem Exp $";
|
||||
__RCSID("$NetBSD: fetch.c,v 1.12 1997/07/20 09:45:50 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -65,6 +66,10 @@ static char rcsid[] = "$NetBSD: fetch.c,v 1.11 1997/06/29 06:34:50 lukem Exp $";
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
static int url_get __P((const char *, const char *));
|
||||
void aborthttp __P((int));
|
||||
|
||||
|
||||
#define FTP_URL "ftp://" /* ftp URL prefix */
|
||||
#define HTTP_URL "http://" /* http URL prefix */
|
||||
#define FTP_PROXY "ftp_proxy" /* env var with ftp proxy location */
|
||||
@ -80,23 +85,31 @@ jmp_buf httpabort;
|
||||
* Modifies the string argument given.
|
||||
* Returns -1 on failure, 0 on success
|
||||
*/
|
||||
int
|
||||
static int
|
||||
url_get(origline, proxyenv)
|
||||
const char *origline;
|
||||
const char *proxyenv;
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
int i, out, port, s, isftpurl;
|
||||
int i, out, isftpurl;
|
||||
u_int16_t port;
|
||||
volatile int s;
|
||||
size_t buflen, len;
|
||||
char c, *cp, *cp2, *savefile, *portnum, *path, buf[4096];
|
||||
char c, *cp, *ep, *portnum, *path, buf[4096];
|
||||
const char *savefile;
|
||||
char *line, *proxy, *host;
|
||||
sig_t oldintr;
|
||||
volatile sig_t oldintr;
|
||||
off_t hashbytes;
|
||||
|
||||
s = -1;
|
||||
proxy = NULL;
|
||||
isftpurl = 0;
|
||||
|
||||
#ifdef __GNUC__ /* XXX: to shut up gcc warnings */
|
||||
(void)&savefile;
|
||||
(void)&proxy;
|
||||
#endif
|
||||
|
||||
line = strdup(origline);
|
||||
if (line == NULL)
|
||||
errx(1, "Can't allocate memory to parse URL");
|
||||
@ -190,12 +203,15 @@ url_get(origline, proxyenv)
|
||||
}
|
||||
|
||||
if (! EMPTYSTRING(portnum)) {
|
||||
port = atoi(portnum);
|
||||
if (port < 1 || (port & 0xffff) != port) {
|
||||
char *ep;
|
||||
long nport;
|
||||
|
||||
nport = strtol(portnum, &ep, 10);
|
||||
if (nport < 1 || nport > 0xffff || *ep != '\0') {
|
||||
warnx("Invalid port: %s", portnum);
|
||||
goto cleanup_url_get;
|
||||
}
|
||||
port = htons(port);
|
||||
port = htons(nport);
|
||||
} else
|
||||
port = httpport;
|
||||
sin.sin_port = port;
|
||||
@ -274,13 +290,13 @@ url_get(origline, proxyenv)
|
||||
if (*cp == '\0')
|
||||
goto improper;
|
||||
cp += sizeof(CONTENTLEN) - 1;
|
||||
cp2 = strchr(cp, '\n');
|
||||
if (cp2 == NULL)
|
||||
ep = strchr(cp, '\n');
|
||||
if (ep == NULL)
|
||||
goto improper;
|
||||
else
|
||||
*cp2 = '\0';
|
||||
filesize = atoi(cp);
|
||||
if (filesize < 1)
|
||||
*ep = '\0';
|
||||
filesize = strtol(cp, &ep, 10);
|
||||
if (filesize < 1 || *ep != '\0')
|
||||
goto improper;
|
||||
|
||||
/* Open the output file. */
|
||||
@ -400,7 +416,8 @@ auto_fetch(argc, argv)
|
||||
char *cp, *line, *host, *dir, *file, *portnum;
|
||||
char *user, *pass;
|
||||
char *ftpproxy, *httpproxy;
|
||||
int rval, xargc, argpos;
|
||||
int rval, xargc;
|
||||
volatile int argpos;
|
||||
int dirhasglob, filehasglob;
|
||||
char rempath[MAXPATHLEN];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ftp.c,v 1.25 1997/04/14 09:09:22 lukem Exp $ */
|
||||
/* $NetBSD: ftp.c,v 1.26 1997/07/20 09:45:53 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: ftp.c,v 1.25 1997/04/14 09:09:22 lukem Exp $";
|
||||
__RCSID("$NetBSD: ftp.c,v 1.26 1997/07/20 09:45:53 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -86,7 +87,7 @@ hookup(host, port)
|
||||
const char *host;
|
||||
int port;
|
||||
{
|
||||
struct hostent *hp = 0;
|
||||
struct hostent *hp = NULL;
|
||||
int s, len, tos;
|
||||
static char hostnamebuf[MAXHOSTNAMELEN];
|
||||
|
||||
@ -411,15 +412,26 @@ sendrequest(cmd, local, remote, printnames)
|
||||
{
|
||||
struct stat st;
|
||||
int c, d;
|
||||
FILE *fin, *dout = 0;
|
||||
FILE *fin, *dout;
|
||||
int (*closefunc) __P((FILE *));
|
||||
sig_t oldinti, oldintr, oldintp;
|
||||
off_t hashbytes;
|
||||
volatile off_t hashbytes;
|
||||
char *lmode, buf[BUFSIZ], *bufp;
|
||||
int oprogress;
|
||||
|
||||
#ifdef __GNUC__ /* XXX: to shut up gcc warnings */
|
||||
(void)&fin;
|
||||
(void)&dout;
|
||||
(void)&closefunc;
|
||||
(void)&oldinti;
|
||||
(void)&oldintr;
|
||||
(void)&oldintp;
|
||||
(void)&lmode;
|
||||
#endif
|
||||
|
||||
hashbytes = mark;
|
||||
direction = "sent";
|
||||
dout = NULL;
|
||||
bytes = 0;
|
||||
filesize = -1;
|
||||
oprogress = progress;
|
||||
@ -699,22 +711,37 @@ recvrequest(cmd, local, remote, lmode, printnames)
|
||||
const char *cmd, *local, *remote, *lmode;
|
||||
int printnames;
|
||||
{
|
||||
FILE *fout, *din = 0;
|
||||
FILE *fout, *din;
|
||||
int (*closefunc) __P((FILE *));
|
||||
sig_t oldinti, oldintr, oldintp;
|
||||
int c, d, is_retr, tcrflag, bare_lfs = 0;
|
||||
int c, d;
|
||||
volatile int is_retr, tcrflag, bare_lfs;
|
||||
static int bufsize;
|
||||
static char *buf;
|
||||
off_t hashbytes;
|
||||
volatile off_t hashbytes;
|
||||
struct stat st;
|
||||
time_t mtime;
|
||||
struct timeval tval[2];
|
||||
int oprogress;
|
||||
int opreserve;
|
||||
|
||||
#ifdef __GNUC__ /* XXX: to shut up gcc warnings */
|
||||
(void)&local;
|
||||
(void)&fout;
|
||||
(void)&din;
|
||||
(void)&closefunc;
|
||||
(void)&oldinti;
|
||||
(void)&oldintr;
|
||||
(void)&oldintp;
|
||||
#endif
|
||||
|
||||
fout = NULL;
|
||||
din = NULL;
|
||||
oldinti = NULL;
|
||||
hashbytes = mark;
|
||||
direction = "received";
|
||||
bytes = 0;
|
||||
bare_lfs = 0;
|
||||
filesize = -1;
|
||||
oprogress = progress;
|
||||
opreserve = preserve;
|
||||
@ -1341,10 +1368,18 @@ proxtrans(cmd, local, remote)
|
||||
const char *cmd, *local, *remote;
|
||||
{
|
||||
sig_t oldintr;
|
||||
int secndflag = 0, prox_type, nfnd;
|
||||
int prox_type, nfnd;
|
||||
volatile int secndflag;
|
||||
char *cmd2;
|
||||
struct fd_set mask;
|
||||
|
||||
#ifdef __GNUC__ /* XXX: to shut up gcc warnings */
|
||||
(void)&oldintr;
|
||||
(void)&cmd2;
|
||||
#endif
|
||||
|
||||
oldintr = NULL;
|
||||
secndflag = 0;
|
||||
if (strcmp(cmd, "RETR"))
|
||||
cmd2 = "RETR";
|
||||
else
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ftp_var.h,v 1.16 1997/04/14 09:09:23 lukem Exp $ */
|
||||
/* $NetBSD: ftp_var.h,v 1.17 1997/07/20 09:45:55 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -124,8 +124,8 @@ char *direction; /* direction transfer is occurring */
|
||||
char *hostname; /* name of host connected to */
|
||||
int unix_server; /* server is unix, can use binary for ascii */
|
||||
int unix_proxy; /* proxy is unix, can use binary for ascii */
|
||||
int ftpport; /* port number to use for ftp connections */
|
||||
int httpport; /* port number to use for http connections */
|
||||
u_int16_t ftpport; /* port number to use for ftp connections */
|
||||
u_int16_t httpport; /* port number to use for http connections */
|
||||
|
||||
jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.22 1997/06/10 07:04:43 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.23 1997/07/20 09:45:58 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -33,17 +33,17 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.22 1997/06/10 07:04:43 lukem Exp $";
|
||||
__RCSID("$NetBSD: main.c,v 1.23 1997/07/20 09:45:58 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -63,13 +63,16 @@ static char rcsid[] = "$NetBSD: main.c,v 1.22 1997/06/10 07:04:43 lukem Exp $";
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
int main __P((int, char **));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
struct servent *sp;
|
||||
int ch, top, port, rval;
|
||||
int ch, top, rval;
|
||||
long port;
|
||||
struct passwd *pw = NULL;
|
||||
char *cp, homedir[MAXPATHLEN];
|
||||
int dumbterm;
|
||||
@ -154,8 +157,8 @@ main(argc, argv)
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
port = atoi(optarg);
|
||||
if (port <= 0)
|
||||
port = strtol(optarg, &cp, 10);
|
||||
if (port < 1 || port > 0xffff || *cp != '\0')
|
||||
warnx("bad port number: %s (ignored)", optarg);
|
||||
else
|
||||
ftpport = htons(port);
|
||||
@ -201,6 +204,11 @@ main(argc, argv)
|
||||
setttywidth(0);
|
||||
(void)signal(SIGWINCH, setttywidth);
|
||||
|
||||
#ifdef __GNUC__ /* XXX: to shut up gcc warnings */
|
||||
(void)&argc;
|
||||
(void)&argv;
|
||||
#endif
|
||||
|
||||
if (argc > 0) {
|
||||
if (strchr(argv[0], ':') != NULL) {
|
||||
anonftp = 1; /* Handle "automatic" transfers. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ruserpass.c,v 1.13 1997/04/01 14:20:34 mrg Exp $ */
|
||||
/* $NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993, 1994
|
||||
@ -33,11 +33,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
|
||||
#else
|
||||
static char rcsid[] = "$NetBSD: ruserpass.c,v 1.13 1997/04/01 14:20:34 mrg Exp $";
|
||||
__RCSID("$NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: util.c,v 1.9 1997/06/10 22:00:01 lukem Exp $ */
|
||||
/* $NetBSD: util.c,v 1.10 1997/07/20 09:46:03 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
@ -33,8 +33,9 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$NetBSD: util.c,v 1.9 1997/06/10 22:00:01 lukem Exp $";
|
||||
__RCSID("$NetBSD: util.c,v 1.10 1997/07/20 09:46:03 lukem Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -48,8 +49,10 @@ static char rcsid[] = "$NetBSD: util.c,v 1.9 1997/06/10 22:00:01 lukem Exp $";
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <glob.h>
|
||||
#include <limits.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@ -67,7 +70,7 @@ setpeer(argc, argv)
|
||||
char *argv[];
|
||||
{
|
||||
char *host;
|
||||
short port;
|
||||
u_int16_t port;
|
||||
|
||||
if (connected) {
|
||||
printf("Already connected to %s, use close first.\n",
|
||||
@ -84,14 +87,17 @@ setpeer(argc, argv)
|
||||
}
|
||||
port = ftpport;
|
||||
if (argc > 2) {
|
||||
port = atoi(argv[2]);
|
||||
if (port <= 0) {
|
||||
char *ep;
|
||||
long nport;
|
||||
|
||||
nport = strtol(argv[2], &ep, 10);
|
||||
if (nport < 1 || nport > 0xffff || *ep != '\0') {
|
||||
printf("%s: bad port number '%s'.\n", argv[1], argv[2]);
|
||||
printf("usage: %s host-name [port]\n", argv[0]);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
port = htons(port);
|
||||
port = htons(nport);
|
||||
}
|
||||
host = hookup(argv[1], port);
|
||||
if (host) {
|
||||
@ -494,8 +500,11 @@ remotemodtime(file, noisy)
|
||||
return (rtime);
|
||||
}
|
||||
|
||||
void updateprogressmeter __P((int));
|
||||
|
||||
void
|
||||
updateprogressmeter()
|
||||
updateprogressmeter(dummy)
|
||||
int dummy;
|
||||
{
|
||||
static pid_t pgrp = -1;
|
||||
int ctty_pgrp;
|
||||
|
Loading…
Reference in New Issue
Block a user