Now compiles on alpha
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@386 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,8 +1,13 @@
|
|||||||
# @(#)Makefile 8.2 (Berkeley) 4/3/94
|
CC=cc -std1
|
||||||
# $NetBSD: Makefile,v 1.6 1995/11/22 21:52:48 cgd Exp $
|
#CC=gcc
|
||||||
|
CFLAGS=-g -DHAVE_CONFIG_H -I.. -I../libmissing -I$(ATHENA)/include -I.
|
||||||
|
|
||||||
PROG= ftp
|
ATHENA = /usr/athena
|
||||||
SRCS= cmds.c cmdtab.c ftp.c main.c ruserpass.c domacro.c
|
|
||||||
CFLAGS+= -Dunix
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
ftp_OBJS = cmds.o cmdtab.o ftp.o main.o ruserpass.o domacro.o globals.o
|
||||||
|
|
||||||
|
ftp: $(ftp_OBJS)
|
||||||
|
$(CC) -o ftp $(ftp_OBJS) ../libmissing/libmissing.a -L$(ATHENA)/lib -lkrb -ldes
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *~ *.o core ftpd ftpcmd.c \#*
|
||||||
|
@@ -33,37 +33,13 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#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 */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FTP User Program -- Command Routines.
|
* FTP User Program -- Command Routines.
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/ftp.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
#include "ftp_locl.h"
|
||||||
#include <err.h>
|
|
||||||
#include <glob.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
typedef void (*sighand)(int);
|
||||||
#include "pathnames.h"
|
|
||||||
|
|
||||||
jmp_buf jabort;
|
jmp_buf jabort;
|
||||||
char *mname;
|
char *mname;
|
||||||
@@ -76,21 +52,18 @@ char *home = "/";
|
|||||||
* Returns false if no new arguments have been added.
|
* Returns false if no new arguments have been added.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
another(pargc, pargv, prompt)
|
another(int *pargc, char ***pargv, char *prompt)
|
||||||
int *pargc;
|
|
||||||
char ***pargv;
|
|
||||||
char *prompt;
|
|
||||||
{
|
{
|
||||||
int len = strlen(line), ret;
|
int len = strlen(line), ret;
|
||||||
|
|
||||||
if (len >= sizeof(line) - 3) {
|
if (len >= sizeof(line) - 3) {
|
||||||
printf("sorry, arguments too long\n");
|
printf("sorry, arguments too long\n");
|
||||||
intr();
|
intr(0);
|
||||||
}
|
}
|
||||||
printf("(%s) ", prompt);
|
printf("(%s) ", prompt);
|
||||||
line[len++] = ' ';
|
line[len++] = ' ';
|
||||||
if (fgets(&line[len], sizeof(line) - len, stdin) == NULL)
|
if (fgets(&line[len], sizeof(line) - len, stdin) == NULL)
|
||||||
intr();
|
intr(0);
|
||||||
len += strlen(&line[len]);
|
len += strlen(&line[len]);
|
||||||
if (len > 0 && line[len - 1] == '\n')
|
if (len > 0 && line[len - 1] == '\n')
|
||||||
line[len - 1] = '\0';
|
line[len - 1] = '\0';
|
||||||
@@ -106,9 +79,7 @@ another(pargc, pargv, prompt)
|
|||||||
* auto-login, if possible.
|
* auto-login, if possible.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
setpeer(argc, argv)
|
setpeer(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *host;
|
char *host;
|
||||||
short port;
|
short port;
|
||||||
@@ -228,9 +199,7 @@ struct types {
|
|||||||
* Set transfer type.
|
* Set transfer type.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
settype(argc, argv)
|
settype(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct types *p;
|
struct types *p;
|
||||||
int comret;
|
int comret;
|
||||||
@@ -277,8 +246,7 @@ settype(argc, argv)
|
|||||||
* Used to change to and from ascii for listings.
|
* Used to change to and from ascii for listings.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
changetype(newtype, show)
|
changetype(int newtype, int show)
|
||||||
int newtype, show;
|
|
||||||
{
|
{
|
||||||
struct types *p;
|
struct types *p;
|
||||||
int comret, oldverbose = verbose;
|
int comret, oldverbose = verbose;
|
||||||
@@ -316,9 +284,7 @@ char *stype[] = {
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setbinary(argc, argv)
|
setbinary(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
stype[1] = "binary";
|
stype[1] = "binary";
|
||||||
@@ -330,9 +296,7 @@ setbinary(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setascii(argc, argv)
|
setascii(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
stype[1] = "ascii";
|
stype[1] = "ascii";
|
||||||
@@ -344,9 +308,7 @@ setascii(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
settenex(argc, argv)
|
settenex(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
stype[1] = "tenex";
|
stype[1] = "tenex";
|
||||||
@@ -358,9 +320,7 @@ settenex(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
setftmode(argc, argv)
|
setftmode(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("We only support %s mode, sorry.\n", modename);
|
printf("We only support %s mode, sorry.\n", modename);
|
||||||
@@ -372,9 +332,7 @@ setftmode(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
setform(argc, argv)
|
setform(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("We only support %s format, sorry.\n", formname);
|
printf("We only support %s format, sorry.\n", formname);
|
||||||
@@ -386,9 +344,7 @@ setform(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
setstruct(argc, argv)
|
setstruct(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("We only support %s structure, sorry.\n", structname);
|
printf("We only support %s structure, sorry.\n", structname);
|
||||||
@@ -399,9 +355,7 @@ setstruct(argc, argv)
|
|||||||
* Send a single file.
|
* Send a single file.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
put(argc, argv)
|
put(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int loc = 0;
|
int loc = 0;
|
||||||
@@ -448,12 +402,10 @@ usage:
|
|||||||
* Send multiple files.
|
* Send multiple files.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mput(argc, argv)
|
mput(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int ointer;
|
int ointer;
|
||||||
char *tp;
|
char *tp;
|
||||||
|
|
||||||
@@ -568,18 +520,14 @@ mput(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
reget(argc, argv)
|
reget(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) getit(argc, argv, 1, "r+w");
|
(void) getit(argc, argv, 1, "r+w");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
get(argc, argv)
|
get(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) getit(argc, argv, 0, restart_point ? "r+w" : "w" );
|
(void) getit(argc, argv, 0, restart_point ? "r+w" : "w" );
|
||||||
@@ -589,11 +537,7 @@ get(argc, argv)
|
|||||||
* Receive one file.
|
* Receive one file.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
getit(argc, argv, restartit, mode)
|
getit(int argc, char **argv, int restartit, char *mode)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
char *mode;
|
|
||||||
int restartit;
|
|
||||||
{
|
{
|
||||||
int loc = 0;
|
int loc = 0;
|
||||||
char *oldargv1, *oldargv2;
|
char *oldargv1, *oldargv2;
|
||||||
@@ -697,8 +641,7 @@ usage:
|
|||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
void
|
||||||
mabort(signo)
|
mabort(int signo)
|
||||||
int signo;
|
|
||||||
{
|
{
|
||||||
int ointer;
|
int ointer;
|
||||||
|
|
||||||
@@ -721,11 +664,9 @@ mabort(signo)
|
|||||||
* Get multiple files.
|
* Get multiple files.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mget(argc, argv)
|
mget(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int ch, ointer;
|
int ch, ointer;
|
||||||
char *cp, *tp, *tp2, tmpbuf[MAXPATHLEN];
|
char *cp, *tp, *tp2, tmpbuf[MAXPATHLEN];
|
||||||
|
|
||||||
@@ -774,9 +715,7 @@ mget(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
remglob(argv,doswitch)
|
remglob(char **argv, int doswitch)
|
||||||
char *argv[];
|
|
||||||
int doswitch;
|
|
||||||
{
|
{
|
||||||
char temp[16];
|
char temp[16];
|
||||||
static char buf[MAXPATHLEN];
|
static char buf[MAXPATHLEN];
|
||||||
@@ -835,8 +774,7 @@ remglob(argv,doswitch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
onoff(bool)
|
onoff(int bool)
|
||||||
int bool;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return (bool ? "on" : "off");
|
return (bool ? "on" : "off");
|
||||||
@@ -847,9 +785,7 @@ onoff(bool)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
status(argc, argv)
|
status(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -903,9 +839,7 @@ status(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setbell(argc, argv)
|
setbell(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
bell = !bell;
|
bell = !bell;
|
||||||
@@ -918,9 +852,7 @@ setbell(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
settrace(argc, argv)
|
settrace(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
trace = !trace;
|
trace = !trace;
|
||||||
@@ -933,9 +865,7 @@ settrace(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
sethash(argc, argv)
|
sethash(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
hash = !hash;
|
hash = !hash;
|
||||||
@@ -951,9 +881,7 @@ sethash(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setverbose(argc, argv)
|
setverbose(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
verbose = !verbose;
|
verbose = !verbose;
|
||||||
@@ -966,9 +894,7 @@ setverbose(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setport(argc, argv)
|
setport(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
sendport = !sendport;
|
sendport = !sendport;
|
||||||
@@ -982,9 +908,7 @@ setport(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setprompt(argc, argv)
|
setprompt(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
interactive = !interactive;
|
interactive = !interactive;
|
||||||
@@ -998,9 +922,7 @@ setprompt(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setglob(argc, argv)
|
setglob(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
doglob = !doglob;
|
doglob = !doglob;
|
||||||
@@ -1014,9 +936,7 @@ setglob(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
setdebug(argc, argv)
|
setdebug(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -1043,9 +963,7 @@ setdebug(argc, argv)
|
|||||||
* on remote machine.
|
* on remote machine.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cd(argc, argv)
|
cd(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "remote-directory")) {
|
if (argc < 2 && !another(&argc, &argv, "remote-directory")) {
|
||||||
@@ -1065,9 +983,7 @@ cd(argc, argv)
|
|||||||
* on local machine.
|
* on local machine.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
lcd(argc, argv)
|
lcd(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
|
||||||
@@ -1098,9 +1014,7 @@ lcd(argc, argv)
|
|||||||
* Delete a single file.
|
* Delete a single file.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
delete(argc, argv)
|
delete(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "remote-file")) {
|
if (argc < 2 && !another(&argc, &argv, "remote-file")) {
|
||||||
@@ -1115,11 +1029,9 @@ delete(argc, argv)
|
|||||||
* Delete multiple files.
|
* Delete multiple files.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mdelete(argc, argv)
|
mdelete(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int ointer;
|
int ointer;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@@ -1157,9 +1069,7 @@ mdelete(argc, argv)
|
|||||||
* Rename a remote file.
|
* Rename a remote file.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
renamefile(argc, argv)
|
renamefile(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "from-name"))
|
if (argc < 2 && !another(&argc, &argv, "from-name"))
|
||||||
@@ -1179,9 +1089,7 @@ usage:
|
|||||||
* of remote files.
|
* of remote files.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ls(argc, argv)
|
ls(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
|
|
||||||
@@ -1212,11 +1120,9 @@ ls(argc, argv)
|
|||||||
* of multiple remote files.
|
* of multiple remote files.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
mls(argc, argv)
|
mls(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int ointer, i;
|
int ointer, i;
|
||||||
char *cmd, mode[1], *dest;
|
char *cmd, mode[1], *dest;
|
||||||
|
|
||||||
@@ -1262,14 +1168,12 @@ usage:
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
shell(argc, argv)
|
shell(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
sig_t old1, old2;
|
sighand old1, old2;
|
||||||
char shellnam[40], *shell, *namep;
|
char shellnam[40], *shell, *namep;
|
||||||
union wait status;
|
int status;
|
||||||
|
|
||||||
old1 = signal (SIGINT, SIG_IGN);
|
old1 = signal (SIGINT, SIG_IGN);
|
||||||
old2 = signal (SIGQUIT, SIG_IGN);
|
old2 = signal (SIGQUIT, SIG_IGN);
|
||||||
@@ -1303,7 +1207,7 @@ shell(argc, argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (pid > 0)
|
if (pid > 0)
|
||||||
while (wait((int *)&status) != pid)
|
while (wait(&status) != pid)
|
||||||
;
|
;
|
||||||
(void) signal(SIGINT, old1);
|
(void) signal(SIGINT, old1);
|
||||||
(void) signal(SIGQUIT, old2);
|
(void) signal(SIGQUIT, old2);
|
||||||
@@ -1320,9 +1224,7 @@ shell(argc, argv)
|
|||||||
* Send new user information (re-login)
|
* Send new user information (re-login)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
user(argc, argv)
|
user(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char acct[80];
|
char acct[80];
|
||||||
int n, aflag = 0;
|
int n, aflag = 0;
|
||||||
@@ -1364,9 +1266,7 @@ user(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
pwd(argc, argv)
|
pwd(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
@@ -1385,9 +1285,7 @@ pwd(argc, argv)
|
|||||||
* Make a directory.
|
* Make a directory.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
makedir(argc, argv)
|
makedir(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "directory-name")) {
|
if (argc < 2 && !another(&argc, &argv, "directory-name")) {
|
||||||
@@ -1406,9 +1304,7 @@ makedir(argc, argv)
|
|||||||
* Remove a directory.
|
* Remove a directory.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
removedir(argc, argv)
|
removedir(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "directory-name")) {
|
if (argc < 2 && !another(&argc, &argv, "directory-name")) {
|
||||||
@@ -1427,9 +1323,7 @@ removedir(argc, argv)
|
|||||||
* Send a line, verbatim, to the remote machine.
|
* Send a line, verbatim, to the remote machine.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
quote(argc, argv)
|
quote(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "command line to send")) {
|
if (argc < 2 && !another(&argc, &argv, "command line to send")) {
|
||||||
@@ -1446,9 +1340,7 @@ quote(argc, argv)
|
|||||||
* word "SITE" is added at the front.
|
* word "SITE" is added at the front.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
site(argc, argv)
|
site(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "arguments to SITE command")) {
|
if (argc < 2 && !another(&argc, &argv, "arguments to SITE command")) {
|
||||||
@@ -1464,10 +1356,7 @@ site(argc, argv)
|
|||||||
* Send the result as a one-line command and get response.
|
* Send the result as a one-line command and get response.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
quote1(initial, argc, argv)
|
quote1(char *initial, int argc, char **argv)
|
||||||
char *initial;
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
char buf[BUFSIZ]; /* must be >= sizeof(line) */
|
||||||
@@ -1488,9 +1377,7 @@ quote1(initial, argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
do_chmod(argc, argv)
|
do_chmod(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "mode"))
|
if (argc < 2 && !another(&argc, &argv, "mode"))
|
||||||
@@ -1505,9 +1392,7 @@ usage:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
do_umask(argc, argv)
|
do_umask(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
@@ -1517,9 +1402,7 @@ do_umask(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
idle(argc, argv)
|
idle(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
@@ -1532,9 +1415,7 @@ idle(argc, argv)
|
|||||||
* Ask the other side for help.
|
* Ask the other side for help.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rmthelp(argc, argv)
|
rmthelp(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int oldverbose = verbose;
|
int oldverbose = verbose;
|
||||||
|
|
||||||
@@ -1548,9 +1429,7 @@ rmthelp(argc, argv)
|
|||||||
*/
|
*/
|
||||||
/*VARARGS*/
|
/*VARARGS*/
|
||||||
void
|
void
|
||||||
quit(argc, argv)
|
quit(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (connected)
|
if (connected)
|
||||||
@@ -1566,9 +1445,7 @@ quit(argc, argv)
|
|||||||
* Terminate session, but don't exit.
|
* Terminate session, but don't exit.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
disconnect(argc, argv)
|
disconnect(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!connected)
|
if (!connected)
|
||||||
@@ -1586,8 +1463,7 @@ disconnect(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
confirm(cmd, file)
|
confirm(char *cmd, char *file)
|
||||||
char *cmd, *file;
|
|
||||||
{
|
{
|
||||||
char line[BUFSIZ];
|
char line[BUFSIZ];
|
||||||
|
|
||||||
@@ -1601,8 +1477,7 @@ confirm(cmd, file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal(msg)
|
fatal(char *msg)
|
||||||
char *msg;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
errx(1, "%s", msg);
|
errx(1, "%s", msg);
|
||||||
@@ -1615,8 +1490,7 @@ fatal(msg)
|
|||||||
* from the expression, we return only the first.
|
* from the expression, we return only the first.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
globulize(cpp)
|
globulize(char **cpp)
|
||||||
char **cpp;
|
|
||||||
{
|
{
|
||||||
glob_t gl;
|
glob_t gl;
|
||||||
int flags;
|
int flags;
|
||||||
@@ -1638,9 +1512,7 @@ globulize(cpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
account(argc,argv)
|
account(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char acct[50], *ap;
|
char acct[50], *ap;
|
||||||
|
|
||||||
@@ -1665,7 +1537,7 @@ account(argc,argv)
|
|||||||
jmp_buf abortprox;
|
jmp_buf abortprox;
|
||||||
|
|
||||||
void
|
void
|
||||||
proxabort()
|
proxabort(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
@@ -1682,12 +1554,10 @@ proxabort()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
doproxy(argc, argv)
|
doproxy(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct cmd *c;
|
struct cmd *c;
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "command")) {
|
if (argc < 2 && !another(&argc, &argv, "command")) {
|
||||||
printf("usage: %s command\n", argv[0]);
|
printf("usage: %s command\n", argv[0]);
|
||||||
@@ -1739,9 +1609,7 @@ doproxy(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setcase(argc, argv)
|
setcase(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
mcase = !mcase;
|
mcase = !mcase;
|
||||||
@@ -1750,9 +1618,7 @@ setcase(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setcr(argc, argv)
|
setcr(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
crflag = !crflag;
|
crflag = !crflag;
|
||||||
@@ -1761,9 +1627,7 @@ setcr(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setntrans(argc,argv)
|
setntrans(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
ntflag = 0;
|
ntflag = 0;
|
||||||
@@ -1784,8 +1648,7 @@ setntrans(argc,argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
dotrans(name)
|
dotrans(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
static char new[MAXPATHLEN];
|
static char new[MAXPATHLEN];
|
||||||
char *cp1, *cp2 = new;
|
char *cp1, *cp2 = new;
|
||||||
@@ -1813,9 +1676,7 @@ dotrans(name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setnmap(argc, argv)
|
setnmap(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
@@ -1847,8 +1708,7 @@ setnmap(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
domap(name)
|
domap(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
static char new[MAXPATHLEN];
|
static char new[MAXPATHLEN];
|
||||||
char *cp1 = name, *cp2 = mapin;
|
char *cp1 = name, *cp2 = mapin;
|
||||||
@@ -2017,9 +1877,7 @@ LOOP:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setpassive(argc, argv)
|
setpassive(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
passivemode = !passivemode;
|
passivemode = !passivemode;
|
||||||
@@ -2028,9 +1886,7 @@ setpassive(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setsunique(argc, argv)
|
setsunique(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
sunique = !sunique;
|
sunique = !sunique;
|
||||||
@@ -2039,9 +1895,7 @@ setsunique(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setrunique(argc, argv)
|
setrunique(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
runique = !runique;
|
runique = !runique;
|
||||||
@@ -2051,9 +1905,7 @@ setrunique(argc, argv)
|
|||||||
|
|
||||||
/* change directory to perent directory */
|
/* change directory to perent directory */
|
||||||
void
|
void
|
||||||
cdup(argc, argv)
|
cdup(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (command("CDUP") == ERROR && code == 500) {
|
if (command("CDUP") == ERROR && code == 500) {
|
||||||
@@ -2065,9 +1917,7 @@ cdup(argc, argv)
|
|||||||
|
|
||||||
/* restart transfer at specific point */
|
/* restart transfer at specific point */
|
||||||
void
|
void
|
||||||
restart(argc, argv)
|
restart(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
@@ -2081,18 +1931,14 @@ restart(argc, argv)
|
|||||||
|
|
||||||
/* show remote system type */
|
/* show remote system type */
|
||||||
void
|
void
|
||||||
syst(argc, argv)
|
syst(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) command("SYST");
|
(void) command("SYST");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
macdef(argc, argv)
|
macdef(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int c;
|
int c;
|
||||||
@@ -2154,9 +2000,7 @@ macdef(argc, argv)
|
|||||||
* get size of file on remote machine
|
* get size of file on remote machine
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
sizecmd(argc, argv)
|
sizecmd(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (argc < 2 && !another(&argc, &argv, "filename")) {
|
if (argc < 2 && !another(&argc, &argv, "filename")) {
|
||||||
@@ -2171,9 +2015,7 @@ sizecmd(argc, argv)
|
|||||||
* get last modification time of file on remote machine
|
* get last modification time of file on remote machine
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
modtime(argc, argv)
|
modtime(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int overbose;
|
int overbose;
|
||||||
|
|
||||||
@@ -2201,9 +2043,7 @@ modtime(argc, argv)
|
|||||||
* show status on reomte machine
|
* show status on reomte machine
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
rmtstatus(argc, argv)
|
rmtstatus(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
(void) command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
|
(void) command(argc > 1 ? "STAT %s" : "STAT" , argv[1]);
|
||||||
@@ -2213,9 +2053,7 @@ rmtstatus(argc, argv)
|
|||||||
* get file if modtime is more recent than current file
|
* get file if modtime is more recent than current file
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
newer(argc, argv)
|
newer(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (getit(argc, argv, -1, "w"))
|
if (getit(argc, argv, -1, "w"))
|
||||||
|
@@ -33,16 +33,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#include "ftp_locl.h"
|
||||||
#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>
|
|
||||||
#include "ftp_var.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* User FTP -- Command Tables.
|
* User FTP -- Command Tables.
|
||||||
|
@@ -33,25 +33,10 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#include "ftp_locl.h"
|
||||||
#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>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <strings.h>
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
domacro(argc, argv)
|
domacro(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int i, j, count = 2, loopflg = 0;
|
int i, j, count = 2, loopflg = 0;
|
||||||
char *cp1, *cp2, line2[200];
|
char *cp1, *cp2, line2[200];
|
||||||
|
@@ -35,22 +35,32 @@
|
|||||||
* @(#)extern.h 8.3 (Berkeley) 10/9/94
|
* @(#)extern.h 8.3 (Berkeley) 10/9/94
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct timeval;
|
#include <setjmp.h>
|
||||||
struct fd_set;
|
#include <stdlib.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
|
#ifndef __P
|
||||||
|
#ifdef __STDC__
|
||||||
|
#define __P(X) X
|
||||||
|
#else
|
||||||
|
#define __P(X)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void abort_remote __P((FILE *));
|
void abort_remote __P((FILE *));
|
||||||
void abortpt __P(());
|
void abortpt __P((int));
|
||||||
void abortrecv __P(());
|
void abortrecv __P((int));
|
||||||
void abortsend __P(());
|
void abortsend __P((int));
|
||||||
void account __P((int, char **));
|
void account __P((int, char **));
|
||||||
int another __P((int *, char ***, char *));
|
int another __P((int *, char ***, char *));
|
||||||
void blkfree __P((char **));
|
void blkfree __P((char **));
|
||||||
void cd __P((int, char **));
|
void cd __P((int, char **));
|
||||||
void cdup __P((int, char **));
|
void cdup __P((int, char **));
|
||||||
void changetype __P((int, int));
|
void changetype __P((int, int));
|
||||||
void cmdabort __P(());
|
void cmdabort __P((int));
|
||||||
void cmdscanner __P((int));
|
void cmdscanner __P((int));
|
||||||
int command __P(());
|
int command __((char *fmt, ...));
|
||||||
int confirm __P((char *, char *));
|
int confirm __P((char *, char *));
|
||||||
FILE *dataconn __P((char *));
|
FILE *dataconn __P((char *));
|
||||||
void delete __P((int, char **));
|
void delete __P((int, char **));
|
||||||
@@ -73,10 +83,10 @@ void help __P((int, char **));
|
|||||||
char *hookup __P((char *, int));
|
char *hookup __P((char *, int));
|
||||||
void idle __P((int, char **));
|
void idle __P((int, char **));
|
||||||
int initconn __P((void));
|
int initconn __P((void));
|
||||||
void intr __P(());
|
void intr __P((int));
|
||||||
void lcd __P((int, char **));
|
void lcd __P((int, char **));
|
||||||
int login __P((char *));
|
int login __P((char *));
|
||||||
void lostpeer __P(());
|
void lostpeer __P((int));
|
||||||
void ls __P((int, char **));
|
void ls __P((int, char **));
|
||||||
void mabort __P((int));
|
void mabort __P((int));
|
||||||
void macdef __P((int, char **));
|
void macdef __P((int, char **));
|
||||||
@@ -89,9 +99,9 @@ void modtime __P((int, char **));
|
|||||||
void mput __P((int, char **));
|
void mput __P((int, char **));
|
||||||
char *onoff __P((int));
|
char *onoff __P((int));
|
||||||
void newer __P((int, char **));
|
void newer __P((int, char **));
|
||||||
void proxabort __P(());
|
void proxabort __P((int));
|
||||||
void proxtrans __P((char *, char *, char *));
|
void proxtrans __P((char *, char *, char *));
|
||||||
void psabort __P(());
|
void psabort __P((int));
|
||||||
void pswitch __P((int));
|
void pswitch __P((int));
|
||||||
void ptransfer __P((char *, long, struct timeval *, struct timeval *));
|
void ptransfer __P((char *, long, struct timeval *, struct timeval *));
|
||||||
void put __P((int, char **));
|
void put __P((int, char **));
|
||||||
|
@@ -33,44 +33,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#include "ftp_locl.h"
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
|
|
||||||
#else
|
|
||||||
static char rcsid[] = "$NetBSD: ftp.c,v 1.13 1995/09/16 22:32:59 pk Exp $";
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/file.h>
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netinet/in_systm.h>
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <arpa/ftp.h>
|
|
||||||
#include <arpa/telnet.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#include <pwd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <varargs.h>
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
|
||||||
|
|
||||||
extern int h_errno;
|
|
||||||
|
|
||||||
struct sockaddr_in hisctladdr;
|
struct sockaddr_in hisctladdr;
|
||||||
struct sockaddr_in data_addr;
|
struct sockaddr_in data_addr;
|
||||||
@@ -85,10 +48,10 @@ off_t restart_point = 0;
|
|||||||
|
|
||||||
FILE *cin, *cout;
|
FILE *cin, *cout;
|
||||||
|
|
||||||
|
typedef void (*sighand)(int);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
hookup(host, port)
|
hookup(char *host, int port)
|
||||||
char *host;
|
|
||||||
int port;
|
|
||||||
{
|
{
|
||||||
struct hostent *hp = 0;
|
struct hostent *hp = 0;
|
||||||
int s, len, tos;
|
int s, len, tos;
|
||||||
@@ -195,8 +158,7 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
login(host)
|
login(char *host)
|
||||||
char *host;
|
|
||||||
{
|
{
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
char *user, *pass, *acct;
|
char *user, *pass, *acct;
|
||||||
@@ -258,7 +220,7 @@ login(host)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmdabort()
|
cmdabort(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -268,39 +230,34 @@ cmdabort()
|
|||||||
longjmp(ptabort,1);
|
longjmp(ptabort,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*VARARGS*/
|
|
||||||
int
|
int
|
||||||
command(va_alist)
|
command(char *fmt, ...)
|
||||||
va_dcl
|
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char *fmt;
|
|
||||||
int r;
|
int r;
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
|
|
||||||
abrtflag = 0;
|
abrtflag = 0;
|
||||||
if (debug) {
|
if (debug)
|
||||||
printf("---> ");
|
printf("---> ");
|
||||||
va_start(ap);
|
|
||||||
fmt = va_arg(ap, char *);
|
|
||||||
if (strncmp("PASS ", fmt, 5) == 0)
|
|
||||||
printf("PASS XXXX");
|
|
||||||
else
|
|
||||||
vfprintf(stdout, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
printf("\n");
|
|
||||||
(void) fflush(stdout);
|
|
||||||
}
|
|
||||||
if (cout == NULL) {
|
if (cout == NULL) {
|
||||||
warn("No control connection for command");
|
warn("No control connection for command");
|
||||||
code = -1;
|
code = -1;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
oldintr = signal(SIGINT, cmdabort);
|
oldintr = signal(SIGINT, cmdabort);
|
||||||
va_start(ap);
|
va_start(ap, fmt);
|
||||||
fmt = va_arg(ap, char *);
|
if(debug)
|
||||||
|
if (strncmp("PASS ", fmt, 5) == 0)
|
||||||
|
printf("PASS XXXX");
|
||||||
|
else
|
||||||
|
vfprintf(stdout, fmt, ap);
|
||||||
vfprintf(cout, fmt, ap);
|
vfprintf(cout, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
if(debug){
|
||||||
|
printf("\n");
|
||||||
|
(void) fflush(stdout);
|
||||||
|
}
|
||||||
fprintf(cout, "\r\n");
|
fprintf(cout, "\r\n");
|
||||||
(void) fflush(cout);
|
(void) fflush(cout);
|
||||||
cpend = 1;
|
cpend = 1;
|
||||||
@@ -314,13 +271,12 @@ va_dcl
|
|||||||
char reply_string[BUFSIZ]; /* last line of previous reply */
|
char reply_string[BUFSIZ]; /* last line of previous reply */
|
||||||
|
|
||||||
int
|
int
|
||||||
getreply(expecteof)
|
getreply(int expecteof)
|
||||||
int expecteof;
|
|
||||||
{
|
{
|
||||||
int c, n;
|
int c, n;
|
||||||
int dig;
|
int dig;
|
||||||
int originalcode = 0, continuation = 0;
|
int originalcode = 0, continuation = 0;
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int pflag = 0;
|
int pflag = 0;
|
||||||
char *cp, *pt = pasv;
|
char *cp, *pt = pasv;
|
||||||
|
|
||||||
@@ -355,7 +311,7 @@ getreply(expecteof)
|
|||||||
code = 221;
|
code = 221;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
lostpeer();
|
lostpeer(0);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("421 Service not available, remote server has closed connection\n");
|
printf("421 Service not available, remote server has closed connection\n");
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
@@ -408,7 +364,7 @@ getreply(expecteof)
|
|||||||
cpend = 0;
|
cpend = 0;
|
||||||
(void) signal(SIGINT,oldintr);
|
(void) signal(SIGINT,oldintr);
|
||||||
if (code == 421 || originalcode == 421)
|
if (code == 421 || originalcode == 421)
|
||||||
lostpeer();
|
lostpeer(0);
|
||||||
if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN)
|
if (abrtflag && oldintr != cmdabort && oldintr != SIG_IGN)
|
||||||
(*oldintr)(SIGINT);
|
(*oldintr)(SIGINT);
|
||||||
return (n - '0');
|
return (n - '0');
|
||||||
@@ -416,9 +372,7 @@ getreply(expecteof)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
empty(mask, sec)
|
empty(struct fd_set *mask, int sec)
|
||||||
struct fd_set *mask;
|
|
||||||
int sec;
|
|
||||||
{
|
{
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
|
|
||||||
@@ -430,7 +384,7 @@ empty(mask, sec)
|
|||||||
jmp_buf sendabort;
|
jmp_buf sendabort;
|
||||||
|
|
||||||
void
|
void
|
||||||
abortsend()
|
abortsend(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
@@ -443,16 +397,14 @@ abortsend()
|
|||||||
#define HASHBYTES 1024
|
#define HASHBYTES 1024
|
||||||
|
|
||||||
void
|
void
|
||||||
sendrequest(cmd, local, remote, printnames)
|
sendrequest(char *cmd, char *local, char *remote, int printnames)
|
||||||
char *cmd, *local, *remote;
|
|
||||||
int printnames;
|
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
struct timeval start, stop;
|
struct timeval start, stop;
|
||||||
int c, d;
|
int c, d;
|
||||||
FILE *fin, *dout = 0, *popen();
|
FILE *fin, *dout = 0, *popen(const char *, const char *);
|
||||||
int (*closefunc) __P((FILE *));
|
int (*closefunc) __P((FILE *));
|
||||||
sig_t oldintr, oldintp;
|
sighand oldintr, oldintp;
|
||||||
long bytes = 0, hashbytes = HASHBYTES;
|
long bytes = 0, hashbytes = HASHBYTES;
|
||||||
char *lmode, buf[BUFSIZ], *bufp;
|
char *lmode, buf[BUFSIZ], *bufp;
|
||||||
|
|
||||||
@@ -689,7 +641,7 @@ abort:
|
|||||||
jmp_buf recvabort;
|
jmp_buf recvabort;
|
||||||
|
|
||||||
void
|
void
|
||||||
abortrecv()
|
abortrecv(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
@@ -700,13 +652,11 @@ abortrecv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
recvrequest(cmd, local, remote, lmode, printnames)
|
recvrequest(char *cmd, char *local, char *remote, char *lmode, int printnames)
|
||||||
char *cmd, *local, *remote, *lmode;
|
|
||||||
int printnames;
|
|
||||||
{
|
{
|
||||||
FILE *fout, *din = 0;
|
FILE *fout, *din = 0;
|
||||||
int (*closefunc) __P((FILE *));
|
int (*closefunc) __P((FILE *));
|
||||||
sig_t oldintr, oldintp;
|
sighand oldintr, oldintp;
|
||||||
int c, d, is_retr, tcrflag, bare_lfs = 0;
|
int c, d, is_retr, tcrflag, bare_lfs = 0;
|
||||||
static int bufsize;
|
static int bufsize;
|
||||||
static char *buf;
|
static char *buf;
|
||||||
@@ -1001,7 +951,7 @@ abort:
|
|||||||
* otherwise the server's connect may fail.
|
* otherwise the server's connect may fail.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
initconn()
|
initconn(void)
|
||||||
{
|
{
|
||||||
char *p, *a;
|
char *p, *a;
|
||||||
int result, len, tmpno = 0;
|
int result, len, tmpno = 0;
|
||||||
@@ -1038,7 +988,7 @@ initconn()
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(&data_addr, sizeof(data_addr));
|
bzero((char*)&data_addr, sizeof(data_addr));
|
||||||
data_addr.sin_family = AF_INET;
|
data_addr.sin_family = AF_INET;
|
||||||
a = (char *)&data_addr.sin_addr.s_addr;
|
a = (char *)&data_addr.sin_addr.s_addr;
|
||||||
a[0] = a0 & 0xff;
|
a[0] = a0 & 0xff;
|
||||||
@@ -1126,8 +1076,7 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
dataconn(lmode)
|
dataconn(char *lmode)
|
||||||
char *lmode;
|
|
||||||
{
|
{
|
||||||
struct sockaddr_in from;
|
struct sockaddr_in from;
|
||||||
int s, fromlen = sizeof (from), tos;
|
int s, fromlen = sizeof (from), tos;
|
||||||
@@ -1152,37 +1101,38 @@ dataconn(lmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ptransfer(direction, bytes, t0, t1)
|
ptransfer(char *direction, long int bytes,
|
||||||
char *direction;
|
struct timeval *t0, struct timeval *t1)
|
||||||
long bytes;
|
|
||||||
struct timeval *t0, *t1;
|
|
||||||
{
|
{
|
||||||
struct timeval td;
|
struct timeval td;
|
||||||
float s;
|
float s;
|
||||||
long bs;
|
long bs;
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
timersub(t1, t0, &td);
|
td.tv_sec = t0->tv_sec - t1->tv_sec;
|
||||||
|
td.tv_usec = t0->tv_usec - t1->tv_usec;
|
||||||
|
if(td.tv_usec < 0){
|
||||||
|
td.tv_sec--;
|
||||||
|
td.tv_usec += 1000000;
|
||||||
|
}
|
||||||
s = td.tv_sec + (td.tv_usec / 1000000.);
|
s = td.tv_sec + (td.tv_usec / 1000000.);
|
||||||
#define nz(x) ((x) == 0 ? 1 : (x))
|
bs = bytes / (s?s:1);
|
||||||
bs = bytes / nz(s);
|
|
||||||
printf("%ld bytes %s in %.3g seconds (%ld bytes/s)\n",
|
printf("%ld bytes %s in %.3g seconds (%ld bytes/s)\n",
|
||||||
bytes, direction, s, bs);
|
bytes, direction, s, bs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
psabort()
|
psabort(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
abrtflag++;
|
abrtflag++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pswitch(flag)
|
pswitch(int flag)
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
static struct comvars {
|
static struct comvars {
|
||||||
int connect;
|
int connect;
|
||||||
char name[MAXHOSTNAMELEN];
|
char name[MAXHOSTNAMELEN];
|
||||||
@@ -1272,7 +1222,7 @@ pswitch(flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
abortpt()
|
abortpt(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -1284,10 +1234,9 @@ abortpt()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
proxtrans(cmd, local, remote)
|
proxtrans(char *cmd, char *local, char *remote)
|
||||||
char *cmd, *local, *remote;
|
|
||||||
{
|
{
|
||||||
sig_t oldintr;
|
sighand oldintr;
|
||||||
int secndflag = 0, prox_type, nfnd;
|
int secndflag = 0, prox_type, nfnd;
|
||||||
char *cmd2;
|
char *cmd2;
|
||||||
struct fd_set mask;
|
struct fd_set mask;
|
||||||
@@ -1389,7 +1338,7 @@ abort:
|
|||||||
}
|
}
|
||||||
if (ptabflg)
|
if (ptabflg)
|
||||||
code = -1;
|
code = -1;
|
||||||
lostpeer();
|
lostpeer(0);
|
||||||
}
|
}
|
||||||
(void) getreply(0);
|
(void) getreply(0);
|
||||||
(void) getreply(0);
|
(void) getreply(0);
|
||||||
@@ -1403,9 +1352,7 @@ abort:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
reset(argc, argv)
|
reset(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct fd_set mask;
|
struct fd_set mask;
|
||||||
int nfnd = 1;
|
int nfnd = 1;
|
||||||
@@ -1416,7 +1363,7 @@ reset(argc, argv)
|
|||||||
if ((nfnd = empty(&mask,0)) < 0) {
|
if ((nfnd = empty(&mask,0)) < 0) {
|
||||||
warn("reset");
|
warn("reset");
|
||||||
code = -1;
|
code = -1;
|
||||||
lostpeer();
|
lostpeer(0);
|
||||||
}
|
}
|
||||||
else if (nfnd) {
|
else if (nfnd) {
|
||||||
(void) getreply(0);
|
(void) getreply(0);
|
||||||
@@ -1425,8 +1372,7 @@ reset(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
gunique(local)
|
gunique(char *local)
|
||||||
char *local;
|
|
||||||
{
|
{
|
||||||
static char new[MAXPATHLEN];
|
static char new[MAXPATHLEN];
|
||||||
char *cp = strrchr(local, '/');
|
char *cp = strrchr(local, '/');
|
||||||
@@ -1471,8 +1417,7 @@ gunique(local)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
abort_remote(din)
|
abort_remote(FILE *din)
|
||||||
FILE *din;
|
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int nfnd;
|
int nfnd;
|
||||||
@@ -1498,7 +1443,7 @@ abort_remote(din)
|
|||||||
}
|
}
|
||||||
if (ptabflg)
|
if (ptabflg)
|
||||||
code = -1;
|
code = -1;
|
||||||
lostpeer();
|
lostpeer(0);
|
||||||
}
|
}
|
||||||
if (din && FD_ISSET(fileno(din), &mask)) {
|
if (din && FD_ISSET(fileno(din), &mask)) {
|
||||||
while (read(fileno(din), buf, BUFSIZ) > 0)
|
while (read(fileno(din), buf, BUFSIZ) > 0)
|
||||||
|
@@ -47,64 +47,64 @@
|
|||||||
/*
|
/*
|
||||||
* Options and other state info.
|
* Options and other state info.
|
||||||
*/
|
*/
|
||||||
int trace; /* trace packets exchanged */
|
extern int trace; /* trace packets exchanged */
|
||||||
int hash; /* print # for each buffer transferred */
|
extern int hash; /* print # for each buffer transferred */
|
||||||
int sendport; /* use PORT cmd for each data connection */
|
extern int sendport; /* use PORT cmd for each data connection */
|
||||||
int verbose; /* print messages coming back from server */
|
extern int verbose; /* print messages coming back from server */
|
||||||
int connected; /* connected to server */
|
extern int connected; /* connected to server */
|
||||||
int fromatty; /* input is from a terminal */
|
extern int fromatty; /* input is from a terminal */
|
||||||
int interactive; /* interactively prompt on m* cmds */
|
extern int interactive; /* interactively prompt on m* cmds */
|
||||||
int debug; /* debugging level */
|
extern int debug; /* debugging level */
|
||||||
int bell; /* ring bell on cmd completion */
|
extern int bell; /* ring bell on cmd completion */
|
||||||
int doglob; /* glob local file names */
|
extern int doglob; /* glob local file names */
|
||||||
int autologin; /* establish user account on connection */
|
extern int autologin; /* establish user account on connection */
|
||||||
int proxy; /* proxy server connection active */
|
extern int proxy; /* proxy server connection active */
|
||||||
int proxflag; /* proxy connection exists */
|
extern int proxflag; /* proxy connection exists */
|
||||||
int sunique; /* store files on server with unique name */
|
extern int sunique; /* store files on server with unique name */
|
||||||
int runique; /* store local files with unique name */
|
extern int runique; /* store local files with unique name */
|
||||||
int mcase; /* map upper to lower case for mget names */
|
extern int mcase; /* map upper to lower case for mget names */
|
||||||
int ntflag; /* use ntin ntout tables for name translation */
|
extern int ntflag; /* use ntin ntout tables for name translation */
|
||||||
int mapflag; /* use mapin mapout templates on file names */
|
extern int mapflag; /* use mapin mapout templates on file names */
|
||||||
int code; /* return/reply code for ftp command */
|
extern int code; /* return/reply code for ftp command */
|
||||||
int crflag; /* if 1, strip car. rets. on ascii gets */
|
extern int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||||
char pasv[64]; /* passive port for proxy data connection */
|
extern char pasv[64]; /* passive port for proxy data connection */
|
||||||
int passivemode; /* passive mode enabled */
|
extern int passivemode; /* passive mode enabled */
|
||||||
char *altarg; /* argv[1] with no shell-like preprocessing */
|
extern char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||||
char ntin[17]; /* input translation table */
|
extern char ntin[17]; /* input translation table */
|
||||||
char ntout[17]; /* output translation table */
|
extern char ntout[17]; /* output translation table */
|
||||||
char mapin[MAXPATHLEN]; /* input map template */
|
extern char mapin[MAXPATHLEN]; /* input map template */
|
||||||
char mapout[MAXPATHLEN]; /* output map template */
|
extern char mapout[MAXPATHLEN]; /* output map template */
|
||||||
char typename[32]; /* name of file transfer type */
|
extern char typename[32]; /* name of file transfer type */
|
||||||
int type; /* requested file transfer type */
|
extern int type; /* requested file transfer type */
|
||||||
int curtype; /* current file transfer type */
|
extern int curtype; /* current file transfer type */
|
||||||
char structname[32]; /* name of file transfer structure */
|
extern char structname[32]; /* name of file transfer structure */
|
||||||
int stru; /* file transfer structure */
|
extern int stru; /* file transfer structure */
|
||||||
char formname[32]; /* name of file transfer format */
|
extern char formname[32]; /* name of file transfer format */
|
||||||
int form; /* file transfer format */
|
extern int form; /* file transfer format */
|
||||||
char modename[32]; /* name of file transfer mode */
|
extern char modename[32]; /* name of file transfer mode */
|
||||||
int mode; /* file transfer mode */
|
extern int mode; /* file transfer mode */
|
||||||
char bytename[32]; /* local byte size in ascii */
|
extern char bytename[32]; /* local byte size in ascii */
|
||||||
int bytesize; /* local byte size in binary */
|
extern int bytesize; /* local byte size in binary */
|
||||||
|
|
||||||
char *hostname; /* name of host connected to */
|
extern char *hostname; /* name of host connected to */
|
||||||
int unix_server; /* server is unix, can use binary for ascii */
|
extern int unix_server; /* server is unix, can use binary for ascii */
|
||||||
int unix_proxy; /* proxy is unix, can use binary for ascii */
|
extern int unix_proxy; /* proxy is unix, can use binary for ascii */
|
||||||
|
|
||||||
struct servent *sp; /* service spec for tcp/ftp */
|
extern struct servent *sp; /* service spec for tcp/ftp */
|
||||||
|
|
||||||
jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||||
|
|
||||||
char line[200]; /* input line buffer */
|
extern char line[200]; /* input line buffer */
|
||||||
char *stringbase; /* current scan point in line buffer */
|
extern char *stringbase; /* current scan point in line buffer */
|
||||||
char argbuf[200]; /* argument storage buffer */
|
extern char argbuf[200]; /* argument storage buffer */
|
||||||
char *argbase; /* current storage point in arg buffer */
|
extern char *argbase; /* current storage point in arg buffer */
|
||||||
int margc; /* count of arguments on input line */
|
extern int margc; /* count of arguments on input line */
|
||||||
char **margv; /* args parsed from input line */
|
extern char **margv; /* args parsed from input line */
|
||||||
int margvlen; /* how large margv is currently */
|
extern int margvlen; /* how large margv is currently */
|
||||||
int cpend; /* flag: if != 0, then pending server reply */
|
extern int cpend; /* flag: if != 0, then pending server reply */
|
||||||
int mflag; /* flag: if != 0, then active multi command */
|
extern int mflag; /* flag: if != 0, then active multi command */
|
||||||
|
|
||||||
int options; /* used during socket creation */
|
extern int options; /* used during socket creation */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format of command table.
|
* Format of command table.
|
||||||
@@ -124,6 +124,6 @@ struct macel {
|
|||||||
char *mac_end; /* end of macro in macbuf */
|
char *mac_end; /* end of macro in macbuf */
|
||||||
};
|
};
|
||||||
|
|
||||||
int macnum; /* number of defined macros */
|
extern int macnum; /* number of defined macros */
|
||||||
struct macel macros[16];
|
extern struct macel macros[16];
|
||||||
char macbuf[4096];
|
extern char macbuf[4096];
|
||||||
|
71
appl/ftp/ftp/globals.c
Normal file
71
appl/ftp/ftp/globals.c
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#include "ftp_locl.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Options and other state info.
|
||||||
|
*/
|
||||||
|
int trace; /* trace packets exchanged */
|
||||||
|
int hash; /* print # for each buffer transferred */
|
||||||
|
int sendport; /* use PORT cmd for each data connection */
|
||||||
|
int verbose; /* print messages coming back from server */
|
||||||
|
int connected; /* connected to server */
|
||||||
|
int fromatty; /* input is from a terminal */
|
||||||
|
int interactive; /* interactively prompt on m* cmds */
|
||||||
|
int debug; /* debugging level */
|
||||||
|
int bell; /* ring bell on cmd completion */
|
||||||
|
int doglob; /* glob local file names */
|
||||||
|
int autologin; /* establish user account on connection */
|
||||||
|
int proxy; /* proxy server connection active */
|
||||||
|
int proxflag; /* proxy connection exists */
|
||||||
|
int sunique; /* store files on server with unique name */
|
||||||
|
int runique; /* store local files with unique name */
|
||||||
|
int mcase; /* map upper to lower case for mget names */
|
||||||
|
int ntflag; /* use ntin ntout tables for name translation */
|
||||||
|
int mapflag; /* use mapin mapout templates on file names */
|
||||||
|
int code; /* return/reply code for ftp command */
|
||||||
|
int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||||
|
char pasv[64]; /* passive port for proxy data connection */
|
||||||
|
int passivemode; /* passive mode enabled */
|
||||||
|
char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||||
|
char ntin[17]; /* input translation table */
|
||||||
|
char ntout[17]; /* output translation table */
|
||||||
|
char mapin[MAXPATHLEN]; /* input map template */
|
||||||
|
char mapout[MAXPATHLEN]; /* output map template */
|
||||||
|
char typename[32]; /* name of file transfer type */
|
||||||
|
int type; /* requested file transfer type */
|
||||||
|
int curtype; /* current file transfer type */
|
||||||
|
char structname[32]; /* name of file transfer structure */
|
||||||
|
int stru; /* file transfer structure */
|
||||||
|
char formname[32]; /* name of file transfer format */
|
||||||
|
int form; /* file transfer format */
|
||||||
|
char modename[32]; /* name of file transfer mode */
|
||||||
|
int mode; /* file transfer mode */
|
||||||
|
char bytename[32]; /* local byte size in ascii */
|
||||||
|
int bytesize; /* local byte size in binary */
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
||||||
|
struct servent *sp; /* service spec for tcp/ftp */
|
||||||
|
|
||||||
|
jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||||
|
|
||||||
|
char line[200]; /* input line buffer */
|
||||||
|
char *stringbase; /* current scan point in line buffer */
|
||||||
|
char argbuf[200]; /* argument storage buffer */
|
||||||
|
char *argbase; /* current storage point in arg buffer */
|
||||||
|
int margc; /* count of arguments on input line */
|
||||||
|
char **margv; /* args parsed from input line */
|
||||||
|
int margvlen; /* how large margv is currently */
|
||||||
|
int cpend; /* flag: if != 0, then pending server reply */
|
||||||
|
int mflag; /* flag: if != 0, then active multi command */
|
||||||
|
|
||||||
|
int options; /* used during socket creation */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Format of command table.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int macnum; /* number of defined macros */
|
||||||
|
struct macel macros[16];
|
||||||
|
char macbuf[4096];
|
@@ -31,45 +31,18 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char 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.10 1995/09/15 00:32:33 pk Exp $";
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FTP User Program -- Command Interface.
|
* FTP User Program -- Command Interface.
|
||||||
*/
|
*/
|
||||||
/*#include <sys/ioctl.h>*/
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <arpa/ftp.h>
|
#include "ftp_locl.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#ifndef HAVE___PROGNAME
|
||||||
#include <err.h>
|
char *__progname;
|
||||||
#include <netdb.h>
|
#endif
|
||||||
#include <pwd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
int ch, top;
|
int ch, top;
|
||||||
struct passwd *pw = NULL;
|
struct passwd *pw = NULL;
|
||||||
@@ -82,6 +55,10 @@ main(argc, argv)
|
|||||||
interactive = 1;
|
interactive = 1;
|
||||||
autologin = 1;
|
autologin = 1;
|
||||||
|
|
||||||
|
#ifndef HAVE___PROGNAME
|
||||||
|
__progname = argv[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "dgintv")) != EOF) {
|
while ((ch = getopt(argc, argv, "dgintv")) != EOF) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -141,7 +118,6 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
char *xargv[5];
|
char *xargv[5];
|
||||||
extern char *__progname;
|
|
||||||
|
|
||||||
if (setjmp(toplevel))
|
if (setjmp(toplevel))
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -166,14 +142,14 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
intr()
|
intr(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
longjmp(toplevel, 1);
|
longjmp(toplevel, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lostpeer()
|
lostpeer(int sig)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (connected) {
|
if (connected) {
|
||||||
@@ -225,8 +201,7 @@ tail(filename)
|
|||||||
* Command parser.
|
* Command parser.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cmdscanner(top)
|
cmdscanner(int top)
|
||||||
int top;
|
|
||||||
{
|
{
|
||||||
struct cmd *c;
|
struct cmd *c;
|
||||||
int l;
|
int l;
|
||||||
@@ -281,8 +256,7 @@ cmdscanner(top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct cmd *
|
struct cmd *
|
||||||
getcmd(name)
|
getcmd(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
struct cmd *c, *found;
|
struct cmd *c, *found;
|
||||||
@@ -316,7 +290,7 @@ getcmd(name)
|
|||||||
int slrflag;
|
int slrflag;
|
||||||
|
|
||||||
void
|
void
|
||||||
makeargv()
|
makeargv(void)
|
||||||
{
|
{
|
||||||
char **argp;
|
char **argp;
|
||||||
|
|
||||||
@@ -349,7 +323,7 @@ makeargv()
|
|||||||
* handle quoting and strings
|
* handle quoting and strings
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
slurpstring()
|
slurpstring(void)
|
||||||
{
|
{
|
||||||
int got_one = 0;
|
int got_one = 0;
|
||||||
char *sb = stringbase;
|
char *sb = stringbase;
|
||||||
@@ -473,9 +447,7 @@ OUT:
|
|||||||
* Call each command handler with argc == 0 and argv[0] == name.
|
* Call each command handler with argc == 0 and argv[0] == name.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
help(argc, argv)
|
help(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
struct cmd *c;
|
struct cmd *c;
|
||||||
|
|
||||||
|
@@ -33,22 +33,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#include "ftp_locl.h"
|
||||||
static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <err.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "ftp_var.h"
|
|
||||||
|
|
||||||
static int token __P((void));
|
static int token __P((void));
|
||||||
static FILE *cfile;
|
static FILE *cfile;
|
||||||
@@ -78,8 +63,7 @@ static struct toktab {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
ruserpass(host, aname, apass, aacct)
|
ruserpass(char *host, char **aname, char **apass, char **aacct)
|
||||||
char *host, **aname, **apass, **aacct;
|
|
||||||
{
|
{
|
||||||
char *hdir, buf[BUFSIZ], *tmp;
|
char *hdir, buf[BUFSIZ], *tmp;
|
||||||
char myname[MAXHOSTNAMELEN], *mydomain;
|
char myname[MAXHOSTNAMELEN], *mydomain;
|
||||||
@@ -244,7 +228,7 @@ bad:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
token()
|
token(void)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
int c;
|
int c;
|
||||||
|
Reference in New Issue
Block a user