mirror of
https://github.com/ksherlock/marignotti.git
synced 2024-06-01 06:41:33 +00:00
ftp (from BSDi, circa FreeBSD 2.0)
https://www.gno.org/svn/gno/trunk/usr.bin/ftp/
This commit is contained in:
parent
dc8ac93eeb
commit
07cac015d4
17
bin/ftp/Makefile
Normal file
17
bin/ftp/Makefile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# $Id: Makefile 478 1998-02-17 02:44:05Z gdr $
|
||||||
|
|
||||||
|
PROG= ftp
|
||||||
|
MAIN= main
|
||||||
|
SRCS= main.c cmdtab.c domacro.c ruserpass.c ftp.c glob.c cmds.c ftp_var.c
|
||||||
|
|
||||||
|
HAS_BSD_MANPAGE = true # use ftp.1G rather than ftp.1
|
||||||
|
|
||||||
|
STACK= 2048
|
||||||
|
LDADD= -lnetdb
|
||||||
|
DEBUG= 25
|
||||||
|
|
||||||
|
.INCLUDE: /src/gno/prog.mk
|
||||||
|
|
||||||
|
#%.o : %.c
|
||||||
|
# $(CC) -o $@ $(CFLAGS) $(__OFLAG) -c $<
|
||||||
|
# @gsh -c ${mktmp cd $(OBJ_DIR); nameobj -p $@}
|
2028
bin/ftp/cmds.c
Normal file
2028
bin/ftp/cmds.c
Normal file
File diff suppressed because it is too large
Load Diff
74
bin/ftp/cmds.h
Normal file
74
bin/ftp/cmds.h
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
int another (int *pargc, char ***pargv, char *prompt);
|
||||||
|
void changetype (int newtype, int show);
|
||||||
|
void setbinary (int argc, char **argv);
|
||||||
|
void setascii (int argc, char **argv);
|
||||||
|
void settenex (int argc, char **argv);
|
||||||
|
int getit (int argc, char **argv, int restartit, char *mode);
|
||||||
|
char *remglob (char **argv, int doswitch);
|
||||||
|
char *onoff (int bool);
|
||||||
|
void setbell (int argc, char **argv);
|
||||||
|
void settrace (int argc, char **argv);
|
||||||
|
void sethash (int argc, char **argv);
|
||||||
|
void setverbose (int argc, char **argv);
|
||||||
|
void setport (int argc, char **argv);
|
||||||
|
void setprompt (int argc, char **argv);
|
||||||
|
void setglob (int argc, char **argv);
|
||||||
|
void mabort (int sig, int code);
|
||||||
|
void pwd (int argc, char **argv);
|
||||||
|
void quote1 (char *initial, int argc, char **argv);
|
||||||
|
void quit (int argc, char **argv);
|
||||||
|
void disconnect (int argc, char **argv);
|
||||||
|
int confirm (char *cmd, char *file);
|
||||||
|
void fatal (char *msg);
|
||||||
|
int globulize (char *cpp[]);
|
||||||
|
void proxabort (int sig, int code);
|
||||||
|
void setcase (int argc, char **argv);
|
||||||
|
void setcr (int argc, char **argv);
|
||||||
|
char *dotrans (char *name);
|
||||||
|
char *domap (char *name);
|
||||||
|
void setsunique (int argc, char **argv);
|
||||||
|
void setrunique (int argc, char **argv);
|
||||||
|
void cdup (int argc, char **argv);
|
||||||
|
void syst (int argc, char **argv);
|
||||||
|
|
||||||
|
void ftpsetdebug (int argc, char **argv);
|
||||||
|
void setpeer (int argc, char **argv);
|
||||||
|
void settype (int argc, char **argv);
|
||||||
|
void ftpsetmode (int argc, char **argv);
|
||||||
|
void setform (int argc, char **argv);
|
||||||
|
void setstruct (int argc, char **argv);
|
||||||
|
void put (int argc, char **argv);
|
||||||
|
void mput (int argc, char **argv);
|
||||||
|
void reget (int argc, char **argv);
|
||||||
|
void get (int argc, char **argv);
|
||||||
|
void mget (int argc, char **argv);
|
||||||
|
void status (int argc, char **argv);
|
||||||
|
void cd (int argc, char **argv);
|
||||||
|
void lcd (int argc, char **argv);
|
||||||
|
void delete (int argc, char **argv);
|
||||||
|
void mdelete (int argc, char **argv);
|
||||||
|
void renamefile (int argc, char **argv);
|
||||||
|
void ls (int argc, char **argv);
|
||||||
|
void mls (int argc, char **argv);
|
||||||
|
void shell (int argc, char **argv);
|
||||||
|
void user (int argc, char **argv);
|
||||||
|
void makedir (int argc, char **argv);
|
||||||
|
void removedir (int argc, char **argv);
|
||||||
|
void quote (int argc, char **argv);
|
||||||
|
void site (int argc, char **argv);
|
||||||
|
void do_chmod (int argc, char **argv);
|
||||||
|
void do_umask (int argc, char **argv);
|
||||||
|
void idle (int argc, char **argv);
|
||||||
|
void rmthelp (int argc, char **argv);
|
||||||
|
void account (int argc, char **argv);
|
||||||
|
void doproxy (int argc, char **argv);
|
||||||
|
void setntrans (int argc, char **argv);
|
||||||
|
void setnmap (int argc, char **argv);
|
||||||
|
void restart (int argc, char **argv);
|
||||||
|
void macdef (int argc, char **argv);
|
||||||
|
void sizecmd (int argc, char **argv);
|
||||||
|
void modtime (int argc, char **argv);
|
||||||
|
void rmtstatus (int argc, char **argv);
|
||||||
|
void newer (int argc, char **argv);
|
||||||
|
void reset (int argc, char **argv);
|
||||||
|
|
156
bin/ftp/cmdtab.c
Normal file
156
bin/ftp/cmdtab.c
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpmain ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char sccsid[] = "@(#)cmdtab.c 5.10 (Berkeley) 6/1/90";
|
||||||
|
|
||||||
|
#include "ftp.var.h"
|
||||||
|
#include "cmds.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "domacro.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* User FTP -- Command Tables.
|
||||||
|
*/
|
||||||
|
char accounthelp[] = "send account command to remote server";
|
||||||
|
char appendhelp[] = "append to a file";
|
||||||
|
char asciihelp[] = "set ascii transfer type";
|
||||||
|
char beephelp[] = "beep when command completed";
|
||||||
|
char binaryhelp[] = "set binary transfer type";
|
||||||
|
char casehelp[] = "toggle mget upper/lower case id mapping";
|
||||||
|
char cdhelp[] = "change remote working directory";
|
||||||
|
char cduphelp[] = "change remote working directory to parent directory";
|
||||||
|
char chmodhelp[] = "change file permissions of remote file";
|
||||||
|
char connecthelp[] = "connect to remote tftp";
|
||||||
|
char crhelp[] = "toggle carriage return stripping on ascii gets";
|
||||||
|
char deletehelp[] = "delete remote file";
|
||||||
|
char debughelp[] = "toggle/set debugging mode";
|
||||||
|
char dirhelp[] = "list contents of remote directory";
|
||||||
|
char disconhelp[] = "terminate ftp session";
|
||||||
|
char domachelp[] = "execute macro";
|
||||||
|
char formhelp[] = "set file transfer format";
|
||||||
|
char globhelp[] = "toggle metacharacter expansion of local file names";
|
||||||
|
char hashhelp[] = "toggle printing `#' for each buffer transferred";
|
||||||
|
char helphelp[] = "print local help information";
|
||||||
|
char idlehelp[] = "get (set) idle timer on remote side";
|
||||||
|
char lcdhelp[] = "change local working directory";
|
||||||
|
char lshelp[] = "list contents of remote directory";
|
||||||
|
char macdefhelp[] = "define a macro";
|
||||||
|
char mdeletehelp[] = "delete multiple files";
|
||||||
|
char mdirhelp[] = "list contents of multiple remote directories";
|
||||||
|
char mgethelp[] = "get multiple files";
|
||||||
|
char mkdirhelp[] = "make directory on the remote machine";
|
||||||
|
char mlshelp[] = "list contents of multiple remote directories";
|
||||||
|
char modtimehelp[] = "show last modification time of remote file";
|
||||||
|
char modehelp[] = "set file transfer mode";
|
||||||
|
char mputhelp[] = "send multiple files";
|
||||||
|
char newerhelp[] = "get file if remote file is newer than local file ";
|
||||||
|
char nlisthelp[] = "nlist contents of remote directory";
|
||||||
|
char nmaphelp[] = "set templates for default file name mapping";
|
||||||
|
char ntranshelp[] = "set translation table for default file name mapping";
|
||||||
|
char porthelp[] = "toggle use of PORT cmd for each data connection";
|
||||||
|
char prompthelp[] = "force interactive prompting on multiple commands";
|
||||||
|
char proxyhelp[] = "issue command on alternate connection";
|
||||||
|
char pwdhelp[] = "print working directory on remote machine";
|
||||||
|
char quithelp[] = "terminate ftp session and exit";
|
||||||
|
char quotehelp[] = "send arbitrary ftp command";
|
||||||
|
char receivehelp[] = "receive file";
|
||||||
|
char regethelp[] = "get file restarting at end of local file";
|
||||||
|
char remotehelp[] = "get help from remote server";
|
||||||
|
char renamehelp[] = "rename file";
|
||||||
|
char restarthelp[]= "restart file transfer at bytecount";
|
||||||
|
char rmdirhelp[] = "remove directory on the remote machine";
|
||||||
|
char rmtstatushelp[]="show status of remote machine";
|
||||||
|
char runiquehelp[] = "toggle store unique for local files";
|
||||||
|
char resethelp[] = "clear queued command replies";
|
||||||
|
char sendhelp[] = "send one file";
|
||||||
|
char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
|
||||||
|
char shellhelp[] = "escape to the shell";
|
||||||
|
char sizecmdhelp[] = "show size of remote file";
|
||||||
|
char statushelp[] = "show current status";
|
||||||
|
char structhelp[] = "set file transfer structure";
|
||||||
|
char suniquehelp[] = "toggle store unique on remote machine";
|
||||||
|
char systemhelp[] = "show remote system type";
|
||||||
|
char tenexhelp[] = "set tenex file transfer type";
|
||||||
|
char tracehelp[] = "toggle packet tracing";
|
||||||
|
char typehelp[] = "set file transfer type";
|
||||||
|
char umaskhelp[] = "get (set) umask on remote side";
|
||||||
|
char userhelp[] = "send new user information";
|
||||||
|
char verbosehelp[] = "toggle verbose mode";
|
||||||
|
|
||||||
|
struct cmd cmdtab[] = {
|
||||||
|
{ "!", shellhelp, 0, 0, 0, shell },
|
||||||
|
{ "$", domachelp, 1, 0, 0, domacro },
|
||||||
|
{ "account", accounthelp, 0, 1, 1, account},
|
||||||
|
{ "append", appendhelp, 1, 1, 1, put },
|
||||||
|
{ "ascii", asciihelp, 0, 1, 1, setascii },
|
||||||
|
{ "bell", beephelp, 0, 0, 0, setbell },
|
||||||
|
{ "binary", binaryhelp, 0, 1, 1, setbinary },
|
||||||
|
{ "bye", quithelp, 0, 0, 0, quit },
|
||||||
|
{ "case", casehelp, 0, 0, 1, setcase },
|
||||||
|
{ "cd", cdhelp, 0, 1, 1, cd },
|
||||||
|
{ "cdup", cduphelp, 0, 1, 1, cdup },
|
||||||
|
{ "chmod", chmodhelp, 0, 1, 1, do_chmod },
|
||||||
|
{ "close", disconhelp, 0, 1, 1, disconnect },
|
||||||
|
{ "cr", crhelp, 0, 0, 0, setcr },
|
||||||
|
{ "delete", deletehelp, 0, 1, 1, delete },
|
||||||
|
{ "debug", debughelp, 0, 0, 0, ftpsetdebug },
|
||||||
|
{ "dir", dirhelp, 1, 1, 1, ls },
|
||||||
|
{ "disconnect", disconhelp, 0, 1, 1, disconnect },
|
||||||
|
{ "form", formhelp, 0, 1, 1, setform },
|
||||||
|
{ "get", receivehelp, 1, 1, 1, get },
|
||||||
|
{ "glob", globhelp, 0, 0, 0, setglob },
|
||||||
|
{ "hash", hashhelp, 0, 0, 0, sethash },
|
||||||
|
{ "help", helphelp, 0, 0, 1, help },
|
||||||
|
{ "idle", idlehelp, 0, 1, 1, idle },
|
||||||
|
{ "image", binaryhelp, 0, 1, 1, setbinary },
|
||||||
|
{ "lcd", lcdhelp, 0, 0, 0, lcd },
|
||||||
|
{ "ls", lshelp, 1, 1, 1, ls },
|
||||||
|
{ "macdef", macdefhelp, 0, 0, 0, macdef },
|
||||||
|
{ "mdelete", mdeletehelp, 1, 1, 1, mdelete },
|
||||||
|
{ "mdir", mdirhelp, 1, 1, 1, mls },
|
||||||
|
{ "mget", mgethelp, 1, 1, 1, mget },
|
||||||
|
{ "mkdir", mkdirhelp, 0, 1, 1, makedir },
|
||||||
|
{ "mls", mlshelp, 1, 1, 1, mls },
|
||||||
|
{ "mode", modehelp, 0, 1, 1, ftpsetmode },
|
||||||
|
{ "modtime", modtimehelp, 0, 1, 1, modtime },
|
||||||
|
{ "mput", mputhelp, 1, 1, 1, mput },
|
||||||
|
{ "newer", newerhelp, 1, 1, 1, newer },
|
||||||
|
{ "nmap", nmaphelp, 0, 0, 1, setnmap },
|
||||||
|
{ "nlist", nlisthelp, 1, 1, 1, ls },
|
||||||
|
{ "ntrans", ntranshelp, 0, 0, 1, setntrans },
|
||||||
|
{ "open", connecthelp, 0, 0, 1, setpeer },
|
||||||
|
{ "prompt", prompthelp, 0, 0, 0, setprompt },
|
||||||
|
{ "proxy", proxyhelp, 0, 0, 1, doproxy },
|
||||||
|
{ "sendport", porthelp, 0, 0, 0, setport },
|
||||||
|
{ "put", sendhelp, 1, 1, 1, put },
|
||||||
|
{ "pwd", pwdhelp, 0, 1, 1, pwd },
|
||||||
|
{ "quit", quithelp, 0, 0, 0, quit },
|
||||||
|
{ "quote", quotehelp, 1, 1, 1, quote },
|
||||||
|
{ "recv", receivehelp, 1, 1, 1, get },
|
||||||
|
{ "reget", regethelp, 1, 1, 1, reget },
|
||||||
|
{ "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
|
||||||
|
{ "rhelp", remotehelp, 0, 1, 1, rmthelp },
|
||||||
|
{ "rename", renamehelp, 0, 1, 1, renamefile },
|
||||||
|
{ "reset", resethelp, 0, 1, 1, reset },
|
||||||
|
{ "restart", restarthelp, 1, 1, 1, restart },
|
||||||
|
{ "rmdir", rmdirhelp, 0, 1, 1, removedir },
|
||||||
|
{ "runique", runiquehelp, 0, 0, 1, setrunique },
|
||||||
|
{ "send", sendhelp, 1, 1, 1, put },
|
||||||
|
{ "site", sitehelp, 0, 1, 1, site },
|
||||||
|
{ "size", sizecmdhelp, 1, 1, 1, sizecmd },
|
||||||
|
{ "status", statushelp, 0, 0, 1, status },
|
||||||
|
{ "struct", structhelp, 0, 1, 1, setstruct },
|
||||||
|
{ "system", systemhelp, 0, 1, 1, syst },
|
||||||
|
{ "sunique", suniquehelp, 0, 0, 1, setsunique },
|
||||||
|
{ "tenex", tenexhelp, 0, 1, 1, settenex },
|
||||||
|
{ "trace", tracehelp, 0, 0, 0, settrace },
|
||||||
|
{ "type", typehelp, 0, 1, 1, settype },
|
||||||
|
{ "user", userhelp, 0, 1, 1, user },
|
||||||
|
{ "umask", umaskhelp, 0, 1, 1, do_umask },
|
||||||
|
{ "verbose", verbosehelp, 0, 0, 0, setverbose },
|
||||||
|
{ "?", helphelp, 0, 0, 1, help },
|
||||||
|
{ 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
|
121
bin/ftp/domacro.c
Normal file
121
bin/ftp/domacro.c
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpmain ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char sccsid[] = "@(#)domacro.c 1.8 (Berkeley) 9/28/90";
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/ttychars.h>
|
||||||
|
|
||||||
|
#include "ftp.var.h"
|
||||||
|
#include "cmds.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "domacro.h"
|
||||||
|
|
||||||
|
void domacro (int argc, char **argv)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
char *cp1, *cp2;
|
||||||
|
int count = 2, loopflg = 0;
|
||||||
|
static char line2[200];
|
||||||
|
struct cmd *c;
|
||||||
|
|
||||||
|
if (argc < 2 && !another(&argc, &argv, "macro name")) {
|
||||||
|
printf("Usage: %s macro_name.\n", argv[0]);
|
||||||
|
code = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (i = 0; i < macnum; ++i) {
|
||||||
|
if (!strncmp(argv[1], macros[i].mac_name, 9)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == macnum) {
|
||||||
|
printf("'%s' macro not found.\n", argv[1]);
|
||||||
|
code = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(void) strcpy(line2, line);
|
||||||
|
TOP:
|
||||||
|
cp1 = macros[i].mac_start;
|
||||||
|
while (cp1 != macros[i].mac_end) {
|
||||||
|
while (isspace(*cp1)) {
|
||||||
|
cp1++;
|
||||||
|
}
|
||||||
|
cp2 = line;
|
||||||
|
while (*cp1 != '\0') {
|
||||||
|
switch(*cp1) {
|
||||||
|
case '\\':
|
||||||
|
*cp2++ = *++cp1;
|
||||||
|
break;
|
||||||
|
case '$':
|
||||||
|
if (isdigit(*(cp1+1))) {
|
||||||
|
j = 0;
|
||||||
|
while (isdigit(*++cp1)) {
|
||||||
|
j = 10*j + *cp1 - '0';
|
||||||
|
}
|
||||||
|
cp1--;
|
||||||
|
if (argc - 2 >= j) {
|
||||||
|
(void) strcpy(cp2, argv[j+1]);
|
||||||
|
cp2 += strlen(argv[j+1]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*(cp1+1) == 'i') {
|
||||||
|
loopflg = 1;
|
||||||
|
cp1++;
|
||||||
|
if (count < argc) {
|
||||||
|
(void) strcpy(cp2, argv[count]);
|
||||||
|
cp2 += strlen(argv[count]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* intentional drop through */
|
||||||
|
default:
|
||||||
|
*cp2++ = *cp1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (*cp1 != '\0') {
|
||||||
|
cp1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*cp2 = '\0';
|
||||||
|
makeargv();
|
||||||
|
c = getcmd(margv[0]);
|
||||||
|
if (c == (struct cmd *)-1) {
|
||||||
|
printf("?Ambiguous command\n");
|
||||||
|
code = -1;
|
||||||
|
}
|
||||||
|
else if (c == 0) {
|
||||||
|
printf("?Invalid command\n");
|
||||||
|
code = -1;
|
||||||
|
}
|
||||||
|
else if (c->c_conn && !connected) {
|
||||||
|
printf("Not connected.\n");
|
||||||
|
code = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (verbose) {
|
||||||
|
printf("%s\n",line);
|
||||||
|
}
|
||||||
|
(*c->c_handler)(margc, margv);
|
||||||
|
if (bell && c->c_bell) {
|
||||||
|
(void) putchar('\007');
|
||||||
|
}
|
||||||
|
(void) strcpy(line, line2);
|
||||||
|
makeargv();
|
||||||
|
argc = margc;
|
||||||
|
argv = margv;
|
||||||
|
}
|
||||||
|
if (cp1 != macros[i].mac_end) {
|
||||||
|
cp1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (loopflg && ++count < argc) {
|
||||||
|
goto TOP;
|
||||||
|
}
|
||||||
|
}
|
1
bin/ftp/domacro.h
Normal file
1
bin/ftp/domacro.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
void domacro (int argc, char **argv);
|
1136
bin/ftp/ftp.1
Normal file
1136
bin/ftp/ftp.1
Normal file
File diff suppressed because it is too large
Load Diff
1042
bin/ftp/ftp.1G
Normal file
1042
bin/ftp/ftp.1G
Normal file
File diff suppressed because it is too large
Load Diff
1405
bin/ftp/ftp.c
Normal file
1405
bin/ftp/ftp.c
Normal file
File diff suppressed because it is too large
Load Diff
9
bin/ftp/ftp.desc
Normal file
9
bin/ftp/ftp.desc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Name: ftp
|
||||||
|
Version: 1.0 (October 1997)
|
||||||
|
Shell: GNO & GS/TCP
|
||||||
|
Author: Derek Taubert (from BSDi code)
|
||||||
|
Contact: taubert@geeks.org
|
||||||
|
Where: /usr/bin
|
||||||
|
FTP: ground.icaen.uiowa.edu apple2.caltech.edu ftp.gno.org
|
||||||
|
|
||||||
|
File transfer program.
|
21
bin/ftp/ftp.h
Normal file
21
bin/ftp/ftp.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
char *hookup (char *host, int port);
|
||||||
|
char *getlogin (void);
|
||||||
|
int login (char *host);
|
||||||
|
void cmdabort (int sig, int code);
|
||||||
|
int command (char *string, ...);
|
||||||
|
int getreply (int expecteof);
|
||||||
|
int empty (struct fd_set *mask, int sec);
|
||||||
|
void abortsend (int sig, int code);
|
||||||
|
void sendrequest (char *cmd, char *local, char *remote, int printnames);
|
||||||
|
void abortrecv (int sig, int code);
|
||||||
|
void recvrequest (char *cmd, char *local, char *remote, char *lmode, int printnames);
|
||||||
|
int initconn (void);
|
||||||
|
FILE *dataconn (char *lmode);
|
||||||
|
void ptransfer (char *direction, long bytes, struct timeval *t0, struct timeval *t1);
|
||||||
|
void tvsub (struct timeval *tdiff, struct timeval *t1, struct timeval *t0);
|
||||||
|
void psabort (int sig, int code);
|
||||||
|
void pswitch (int flag);
|
||||||
|
void abortpt (int sig, int code);
|
||||||
|
void proxtrans (char *cmd, char *local, char *remote);
|
||||||
|
char *gunique (char *local);
|
||||||
|
void abort_remote (FILE *din);
|
31
bin/ftp/ftp.rez
Normal file
31
bin/ftp/ftp.rez
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Resources for ftp version and comment
|
||||||
|
*
|
||||||
|
* $Id: ftp.rez 395 1998-01-24 08:21:33Z taubert $
|
||||||
|
*/
|
||||||
|
#define PROG "ftp"
|
||||||
|
#define DESC "File transfer program."
|
||||||
|
|
||||||
|
#include "Types.rez"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Version
|
||||||
|
*/
|
||||||
|
resource rVersion (1, purgeable3) {
|
||||||
|
{ 1, 0, 0, /* Version 1.0.0 */
|
||||||
|
release, /* development|alpha|beta|final|release */
|
||||||
|
0 }, /* non-final release number */
|
||||||
|
verUS, /* Country */
|
||||||
|
PROG, /* Program name */
|
||||||
|
DESC " Released with GNO/ME and GS/TCP."
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Comment
|
||||||
|
*/
|
||||||
|
resource rComment (1, purgeable3) {
|
||||||
|
PROG " v1.0 (October 1997)\n"
|
||||||
|
"GNO utility: " DESC "\n"
|
||||||
|
"Ported from BSDi code by Derek Taubert."
|
||||||
|
};
|
122
bin/ftp/ftp.var.h
Normal file
122
bin/ftp/ftp.var.h
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1985, 1989 Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)ftp_var.h 5.9 (Berkeley) 6/1/90
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FTP global variables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Options and other state info.
|
||||||
|
*/
|
||||||
|
extern int trace; /* trace packets exchanged */
|
||||||
|
extern int hash; /* print # for each buffer transferred */
|
||||||
|
extern int sendport; /* use PORT cmd for each data connection */
|
||||||
|
extern int verbose; /* print messages coming back from server */
|
||||||
|
extern int connected; /* connected to server */
|
||||||
|
extern int fromatty; /* input is from a terminal */
|
||||||
|
extern int interactive; /* interactively prompt on m* cmds */
|
||||||
|
extern int debug; /* debugging level */
|
||||||
|
extern int bell; /* ring bell on cmd completion */
|
||||||
|
extern int doglob; /* glob local file names */
|
||||||
|
extern int autologin; /* establish user account on connection */
|
||||||
|
extern int proxy; /* proxy server connection active */
|
||||||
|
extern int proxflag; /* proxy connection exists */
|
||||||
|
extern int sunique; /* store files on server with unique name */
|
||||||
|
extern int runique; /* store local files with unique name */
|
||||||
|
extern int mcase; /* map upper to lower case for mget names */
|
||||||
|
extern int ntflag; /* use ntin ntout tables for name translation */
|
||||||
|
extern int mapflag; /* use mapin mapout templates on file names */
|
||||||
|
extern int code; /* return/reply code for ftp command */
|
||||||
|
extern int crflag; /* if 1, strip car. rets. on ascii gets */
|
||||||
|
extern char pasv[64]; /* passive port for proxy data connection */
|
||||||
|
extern char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||||
|
extern char ntin[17]; /* input translation table */
|
||||||
|
extern char ntout[17]; /* output translation table */
|
||||||
|
#include <sys/param.h>
|
||||||
|
extern char mapin[MAXPATHLEN]; /* input map template */
|
||||||
|
extern char mapout[MAXPATHLEN]; /* output map template */
|
||||||
|
extern char typename[32]; /* name of file transfer type */
|
||||||
|
extern int type; /* requested file transfer type */
|
||||||
|
extern int curtype; /* current file transfer type */
|
||||||
|
extern char structname[32]; /* name of file transfer structure */
|
||||||
|
extern int stru; /* file transfer structure */
|
||||||
|
extern char formname[32]; /* name of file transfer format */
|
||||||
|
extern int form; /* file transfer format */
|
||||||
|
extern char modename[32]; /* name of file transfer mode */
|
||||||
|
extern int mode; /* file transfer mode */
|
||||||
|
extern char bytename[32]; /* local byte size in ascii */
|
||||||
|
extern int bytesize; /* local byte size in binary */
|
||||||
|
|
||||||
|
extern char *hostname; /* name of host connected to */
|
||||||
|
extern int unix_server; /* server is unix, can use binary for ascii */
|
||||||
|
extern int unix_proxy; /* proxy is unix, can use binary for ascii */
|
||||||
|
|
||||||
|
extern struct servent *sp; /* service spec for tcp/ftp */
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||||
|
|
||||||
|
extern char line[200]; /* input line buffer */
|
||||||
|
extern char *stringbase; /* current scan point in line buffer */
|
||||||
|
extern char argbuf[200]; /* argument storage buffer */
|
||||||
|
extern char *argbase; /* current storage point in arg buffer */
|
||||||
|
extern int margc; /* count of arguments on input line */
|
||||||
|
extern char *margv[20]; /* args parsed from input line */
|
||||||
|
extern int cpend; /* flag: if != 0, then pending server reply */
|
||||||
|
extern int mflag; /* flag: if != 0, then active multi command */
|
||||||
|
|
||||||
|
extern int options; /* used during socket creation */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Format of command table.
|
||||||
|
*/
|
||||||
|
struct cmd {
|
||||||
|
char *c_name; /* name of command */
|
||||||
|
char *c_help; /* help string */
|
||||||
|
char c_bell; /* give bell when command completes */
|
||||||
|
char c_conn; /* must be connected to use command */
|
||||||
|
char c_proxy; /* proxy server may execute */
|
||||||
|
void (*c_handler)(int argc, char **argv); /* function to call */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct macel {
|
||||||
|
char mac_name[9]; /* macro name */
|
||||||
|
char *mac_start; /* start of macro in macbuf */
|
||||||
|
char *mac_end; /* end of macro in macbuf */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int macnum; /* number of defined macros */
|
||||||
|
extern struct macel macros[16];
|
||||||
|
extern char macbuf[4096];
|
91
bin/ftp/ftp_var.c
Normal file
91
bin/ftp/ftp_var.c
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpglobals";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FTP global variables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 */
|
||||||
|
char *altarg; /* argv[1] with no shell-like preprocessing */
|
||||||
|
char ntin[17]; /* input translation table */
|
||||||
|
char ntout[17]; /* output translation table */
|
||||||
|
#include <sys/param.h>
|
||||||
|
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 */
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
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[20]; /* args parsed from input line */
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
struct cmd {
|
||||||
|
char *c_name; /* name of command */
|
||||||
|
char *c_help; /* help string */
|
||||||
|
char c_bell; /* give bell when command completes */
|
||||||
|
char c_conn; /* must be connected to use command */
|
||||||
|
char c_proxy; /* proxy server may execute */
|
||||||
|
void (*c_handler)(int argc, char **argv); /* function to call */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct macel {
|
||||||
|
char mac_name[9]; /* macro name */
|
||||||
|
char *mac_start; /* start of macro in macbuf */
|
||||||
|
char *mac_end; /* end of macro in macbuf */
|
||||||
|
};
|
||||||
|
|
||||||
|
int macnum; /* number of defined macros */
|
||||||
|
struct macel macros[16];
|
||||||
|
char macbuf[4096];
|
609
bin/ftp/glob.c
Normal file
609
bin/ftp/glob.c
Normal file
|
@ -0,0 +1,609 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpmain ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char sccsid[] = "@(#)glob.c 5.9 (Berkeley) 2/25/91";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* C-shell glob for random programs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "ftp.var.h"
|
||||||
|
#include "cmds.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "domacro.h"
|
||||||
|
#include "ruserpass.h"
|
||||||
|
#include "ftp.h"
|
||||||
|
#include "glob.h"
|
||||||
|
|
||||||
|
static void ginit (char **agargv);
|
||||||
|
static void collect (char *as);
|
||||||
|
static void acollect (char *as);
|
||||||
|
static void sort (void);
|
||||||
|
static void expand (char *as);
|
||||||
|
static void matchdir (char *pattern);
|
||||||
|
static int execbrc (char *p, char *s);
|
||||||
|
static int match (char *s, char *p);
|
||||||
|
static int amatch (char *s, char *p);
|
||||||
|
static int Gmatch (char *s, char *p);
|
||||||
|
static void Gcat (char *s1, char *s2);
|
||||||
|
static void addpath (char c);
|
||||||
|
static void rscan (char **t, int (*f)(char));
|
||||||
|
static int tglob (char c);
|
||||||
|
static char *strspl (char *cp, char *dp);
|
||||||
|
static char *strend (char *cp);
|
||||||
|
|
||||||
|
#define QUOTE 0200
|
||||||
|
#define TRIM 0177
|
||||||
|
#define eq(a,b) (strcmp(a, b)==0)
|
||||||
|
#define GAVSIZ (NCARGS/6)
|
||||||
|
#define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR)
|
||||||
|
|
||||||
|
static char **gargv; /* Pointer to the (stack) arglist */
|
||||||
|
static int gargc; /* Number args in gargv */
|
||||||
|
static int gnleft;
|
||||||
|
static short gflag;
|
||||||
|
char *globerr;
|
||||||
|
char *home;
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
static int globcnt;
|
||||||
|
|
||||||
|
char *globchars = "`{[*?";
|
||||||
|
|
||||||
|
static char *gpath, *gpathp, *lastgpathp;
|
||||||
|
static int globbed;
|
||||||
|
static char *entp;
|
||||||
|
static char **sortbas;
|
||||||
|
|
||||||
|
char **ftpglob (char *v)
|
||||||
|
{
|
||||||
|
static char agpath[BUFSIZ];
|
||||||
|
static char *agargv[GAVSIZ];
|
||||||
|
char *vv[2];
|
||||||
|
|
||||||
|
vv[0] = strspl(v, "");
|
||||||
|
vv[1] = 0;
|
||||||
|
gflag = 0;
|
||||||
|
rscan (vv, tglob);
|
||||||
|
if (gflag == 0)
|
||||||
|
return (copyblk(vv));
|
||||||
|
else
|
||||||
|
blkfree(vv); /* free what strspl() created */
|
||||||
|
|
||||||
|
globerr = 0;
|
||||||
|
gpath = agpath; gpathp = gpath; *gpathp = 0;
|
||||||
|
lastgpathp = &gpath[sizeof agpath - 2];
|
||||||
|
ginit(agargv); globcnt = 0;
|
||||||
|
collect(v);
|
||||||
|
if (globcnt == 0 && (gflag&1)) {
|
||||||
|
blkfree(gargv), gargv = 0;
|
||||||
|
return (0);
|
||||||
|
} else
|
||||||
|
return (gargv = copyblk(gargv));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ginit (char **agargv)
|
||||||
|
{
|
||||||
|
agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
|
||||||
|
gnleft = NCARGS - 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void collect (char *as)
|
||||||
|
{
|
||||||
|
if (eq(as, "{") || eq(as, "{}")) {
|
||||||
|
Gcat(as, "");
|
||||||
|
sort();
|
||||||
|
} else
|
||||||
|
acollect(as);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void acollect (char *as)
|
||||||
|
{
|
||||||
|
int ogargc;
|
||||||
|
|
||||||
|
ogargc = gargc;
|
||||||
|
gpathp = gpath; *gpathp = 0; globbed = 0;
|
||||||
|
expand(as);
|
||||||
|
if (gargc != ogargc)
|
||||||
|
sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sort (void)
|
||||||
|
{
|
||||||
|
char **p1, **p2, *c;
|
||||||
|
char **Gvp;
|
||||||
|
|
||||||
|
Gvp = &gargv[gargc];
|
||||||
|
|
||||||
|
p1 = sortbas;
|
||||||
|
while (p1 < Gvp-1) {
|
||||||
|
p2 = p1;
|
||||||
|
while (++p2 < Gvp)
|
||||||
|
if (strcmp(*p1, *p2) > 0)
|
||||||
|
c = *p1, *p1 = *p2, *p2 = c;
|
||||||
|
p1++;
|
||||||
|
}
|
||||||
|
sortbas = Gvp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void expand (char *as)
|
||||||
|
{
|
||||||
|
char *cs;
|
||||||
|
char *sgpathp, *oldcs;
|
||||||
|
static struct stat stb;
|
||||||
|
|
||||||
|
sgpathp = gpathp;
|
||||||
|
cs = as;
|
||||||
|
if (*cs == '~' && gpathp == gpath) {
|
||||||
|
addpath('~');
|
||||||
|
for (cs++; letter(*cs) || digit(*cs) || *cs == '-';)
|
||||||
|
addpath(*cs++);
|
||||||
|
if (!*cs || *cs == '/') {
|
||||||
|
if (gpathp != gpath + 1) {
|
||||||
|
*gpathp = 0;
|
||||||
|
if (gethdir(gpath + 1))
|
||||||
|
globerr = "Unknown user name after ~";
|
||||||
|
(void) strcpy(gpath, gpath + 1);
|
||||||
|
} else
|
||||||
|
(void) strcpy(gpath, home);
|
||||||
|
gpathp = strend(gpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (!any(*cs, globchars)) {
|
||||||
|
if (*cs == 0) {
|
||||||
|
if (!globbed)
|
||||||
|
Gcat(gpath, "");
|
||||||
|
else if (stat(gpath, &stb) >= 0) {
|
||||||
|
Gcat(gpath, "");
|
||||||
|
globcnt++;
|
||||||
|
}
|
||||||
|
goto endit;
|
||||||
|
}
|
||||||
|
addpath(*cs++);
|
||||||
|
}
|
||||||
|
oldcs = cs;
|
||||||
|
while (cs > as && *cs != '/')
|
||||||
|
cs--, gpathp--;
|
||||||
|
if (*cs == '/')
|
||||||
|
cs++, gpathp++;
|
||||||
|
*gpathp = 0;
|
||||||
|
if (*oldcs == '{') {
|
||||||
|
(void) execbrc(cs, ((char *)0));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
matchdir(cs);
|
||||||
|
endit:
|
||||||
|
gpathp = sgpathp;
|
||||||
|
*gpathp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void matchdir (char *pattern)
|
||||||
|
{
|
||||||
|
static struct stat stb;
|
||||||
|
struct dirent *dp;
|
||||||
|
DIR *dirp;
|
||||||
|
|
||||||
|
dirp = opendir(gpath);
|
||||||
|
if (dirp == NULL) {
|
||||||
|
if (globbed)
|
||||||
|
return;
|
||||||
|
goto patherr2;
|
||||||
|
}
|
||||||
|
if (fstat(dirp->dd_fd, &stb) < 0)
|
||||||
|
goto patherr1;
|
||||||
|
if (!isdir(stb)) {
|
||||||
|
errno = ENOTDIR;
|
||||||
|
goto patherr1;
|
||||||
|
}
|
||||||
|
while ((dp = readdir(dirp)) != NULL) {
|
||||||
|
if (dp->d_ino == 0)
|
||||||
|
continue;
|
||||||
|
if (match(dp->d_name, pattern)) {
|
||||||
|
Gcat(gpath, dp->d_name);
|
||||||
|
globcnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dirp);
|
||||||
|
return;
|
||||||
|
|
||||||
|
patherr1:
|
||||||
|
closedir(dirp);
|
||||||
|
patherr2:
|
||||||
|
globerr = "Bad directory components";
|
||||||
|
}
|
||||||
|
|
||||||
|
static int execbrc (char *p, char *s)
|
||||||
|
{
|
||||||
|
static char restbuf[BUFSIZ + 2];
|
||||||
|
char *pe, *pm, *pl;
|
||||||
|
int brclev = 0;
|
||||||
|
char *lm, savec, *sgpathp;
|
||||||
|
|
||||||
|
for (lm = restbuf; *p != '{'; *lm++ = *p++)
|
||||||
|
continue;
|
||||||
|
for (pe = ++p; *pe; pe++)
|
||||||
|
switch (*pe) {
|
||||||
|
|
||||||
|
case '{':
|
||||||
|
brclev++;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '}':
|
||||||
|
if (brclev == 0)
|
||||||
|
goto pend;
|
||||||
|
brclev--;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '[':
|
||||||
|
for (pe++; *pe && *pe != ']'; pe++)
|
||||||
|
continue;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pend:
|
||||||
|
brclev = 0;
|
||||||
|
for (pl = pm = p; pm <= pe; pm++)
|
||||||
|
switch (*pm & (QUOTE|TRIM)) {
|
||||||
|
|
||||||
|
case '{':
|
||||||
|
brclev++;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '}':
|
||||||
|
if (brclev) {
|
||||||
|
brclev--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
goto doit;
|
||||||
|
|
||||||
|
case ','|QUOTE:
|
||||||
|
case ',':
|
||||||
|
if (brclev)
|
||||||
|
continue;
|
||||||
|
doit:
|
||||||
|
savec = *pm;
|
||||||
|
*pm = 0;
|
||||||
|
(void) strcpy(lm, pl);
|
||||||
|
(void) strcat(restbuf, pe + 1);
|
||||||
|
*pm = savec;
|
||||||
|
if (s == 0) {
|
||||||
|
sgpathp = gpathp;
|
||||||
|
expand(restbuf);
|
||||||
|
gpathp = sgpathp;
|
||||||
|
*gpathp = 0;
|
||||||
|
} else if (amatch(s, restbuf))
|
||||||
|
return (1);
|
||||||
|
sort();
|
||||||
|
pl = pm + 1;
|
||||||
|
if (brclev)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '[':
|
||||||
|
for (pm++; *pm && *pm != ']'; pm++)
|
||||||
|
continue;
|
||||||
|
if (!*pm)
|
||||||
|
pm--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (brclev)
|
||||||
|
goto doit;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int match (char *s, char *p)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
char *sentp;
|
||||||
|
char sglobbed;
|
||||||
|
|
||||||
|
sglobbed = globbed;
|
||||||
|
|
||||||
|
if (*s == '.' && *p != '.')
|
||||||
|
return (0);
|
||||||
|
sentp = entp;
|
||||||
|
entp = s;
|
||||||
|
c = amatch(s, p);
|
||||||
|
entp = sentp;
|
||||||
|
globbed = sglobbed;
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int amatch (char *s, char *p)
|
||||||
|
{
|
||||||
|
int scc;
|
||||||
|
int ok, lc;
|
||||||
|
char *sgpathp;
|
||||||
|
static struct stat stb;
|
||||||
|
int c, cc;
|
||||||
|
|
||||||
|
globbed = 1;
|
||||||
|
for (;;) {
|
||||||
|
scc = *s++ & TRIM;
|
||||||
|
switch (c = *p++) {
|
||||||
|
|
||||||
|
case '{':
|
||||||
|
return (execbrc(p - 1, s - 1));
|
||||||
|
|
||||||
|
case '[':
|
||||||
|
ok = 0;
|
||||||
|
lc = 077777;
|
||||||
|
while (cc = *p++) {
|
||||||
|
if (cc == ']') {
|
||||||
|
if (ok)
|
||||||
|
break;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (cc == '-') {
|
||||||
|
if (lc <= scc && scc <= *p++)
|
||||||
|
ok++;
|
||||||
|
} else
|
||||||
|
if (scc == (lc = cc))
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
if (cc == 0)
|
||||||
|
if (ok)
|
||||||
|
p--;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
if (!*p)
|
||||||
|
return (1);
|
||||||
|
if (*p == '/') {
|
||||||
|
p++;
|
||||||
|
goto slash;
|
||||||
|
}
|
||||||
|
s--;
|
||||||
|
do {
|
||||||
|
if (amatch(s, p))
|
||||||
|
return (1);
|
||||||
|
} while (*s++);
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
return (scc == 0);
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (c != scc)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
if (scc == 0)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '/':
|
||||||
|
if (scc)
|
||||||
|
return (0);
|
||||||
|
slash:
|
||||||
|
s = entp;
|
||||||
|
sgpathp = gpathp;
|
||||||
|
while (*s)
|
||||||
|
addpath(*s++);
|
||||||
|
addpath('/');
|
||||||
|
if (stat(gpath, &stb) == 0 && isdir(stb))
|
||||||
|
if (*p == 0) {
|
||||||
|
Gcat(gpath, "");
|
||||||
|
globcnt++;
|
||||||
|
} else
|
||||||
|
expand(p);
|
||||||
|
gpathp = sgpathp;
|
||||||
|
*gpathp = 0;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int Gmatch (char *s, char *p)
|
||||||
|
{
|
||||||
|
int scc;
|
||||||
|
int ok, lc;
|
||||||
|
int c, cc;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
scc = *s++ & TRIM;
|
||||||
|
switch (c = *p++) {
|
||||||
|
|
||||||
|
case '[':
|
||||||
|
ok = 0;
|
||||||
|
lc = 077777;
|
||||||
|
while (cc = *p++) {
|
||||||
|
if (cc == ']') {
|
||||||
|
if (ok)
|
||||||
|
break;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (cc == '-') {
|
||||||
|
if (lc <= scc && scc <= *p++)
|
||||||
|
ok++;
|
||||||
|
} else
|
||||||
|
if (scc == (lc = cc))
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
if (cc == 0)
|
||||||
|
if (ok)
|
||||||
|
p--;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '*':
|
||||||
|
if (!*p)
|
||||||
|
return (1);
|
||||||
|
for (s--; *s; s++)
|
||||||
|
if (Gmatch(s, p))
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
return (scc == 0);
|
||||||
|
|
||||||
|
default:
|
||||||
|
if ((c & TRIM) != scc)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
if (scc == 0)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Gcat (char *s1, char *s2)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strlen(s1) + strlen(s2) + 1;
|
||||||
|
|
||||||
|
if (len >= gnleft || gargc >= GAVSIZ - 1)
|
||||||
|
globerr = "Arguments too long";
|
||||||
|
else {
|
||||||
|
gargc++;
|
||||||
|
gnleft -= len;
|
||||||
|
gargv[gargc] = 0;
|
||||||
|
gargv[gargc - 1] = strspl(s1, s2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addpath (char c)
|
||||||
|
{
|
||||||
|
if (gpathp >= lastgpathp)
|
||||||
|
globerr = "Pathname too long";
|
||||||
|
else {
|
||||||
|
*gpathp++ = c;
|
||||||
|
*gpathp = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rscan (char **t, int (*f)(char))
|
||||||
|
{
|
||||||
|
char *p, c;
|
||||||
|
|
||||||
|
while (p = *t++) {
|
||||||
|
if (f == tglob)
|
||||||
|
if (*p == '~')
|
||||||
|
gflag |= 2;
|
||||||
|
else if (eq(p, "{") || eq(p, "{}"))
|
||||||
|
continue;
|
||||||
|
while (c = *p++)
|
||||||
|
(*f)(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int tglob (char c)
|
||||||
|
{
|
||||||
|
if (any(c, globchars))
|
||||||
|
gflag |= c == '{' ? 2 : 1;
|
||||||
|
return (c);
|
||||||
|
}
|
||||||
|
|
||||||
|
int letter (char c)
|
||||||
|
{
|
||||||
|
return (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
int digit (char c)
|
||||||
|
{
|
||||||
|
return (c >= '0' && c <= '9');
|
||||||
|
}
|
||||||
|
|
||||||
|
int any (int c, char *s)
|
||||||
|
{
|
||||||
|
while (*s)
|
||||||
|
if (*s++ == c)
|
||||||
|
return(1);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int blklen (char **av)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (*av++)
|
||||||
|
i++;
|
||||||
|
return (i);
|
||||||
|
}
|
||||||
|
|
||||||
|
char **blkcpy (char **oav, char **bv)
|
||||||
|
{
|
||||||
|
char **av;
|
||||||
|
|
||||||
|
av = oav;
|
||||||
|
while (*av++ = *bv++)
|
||||||
|
continue;
|
||||||
|
return (oav);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blkfree (char **av0)
|
||||||
|
{
|
||||||
|
char **av;
|
||||||
|
|
||||||
|
av = av0;
|
||||||
|
|
||||||
|
while (*av)
|
||||||
|
free(*av++);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *strspl (char *cp, char *dp)
|
||||||
|
{
|
||||||
|
char *ep;
|
||||||
|
|
||||||
|
ep = malloc((unsigned)(strlen(cp) + strlen(dp) + 1));
|
||||||
|
|
||||||
|
if (ep == (char *)0)
|
||||||
|
fatal("Out of memory");
|
||||||
|
(void) strcpy(ep, cp);
|
||||||
|
(void) strcat(ep, dp);
|
||||||
|
return (ep);
|
||||||
|
}
|
||||||
|
|
||||||
|
char **copyblk (char **v)
|
||||||
|
{
|
||||||
|
char **nv;
|
||||||
|
|
||||||
|
nv = (char **)malloc((unsigned)((blklen(v) + 1) * sizeof(char **)));
|
||||||
|
if (nv == (char **)0)
|
||||||
|
fatal("Out of memory");
|
||||||
|
|
||||||
|
return (blkcpy(nv, v));
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *strend (char *cp)
|
||||||
|
{
|
||||||
|
while (*cp)
|
||||||
|
cp++;
|
||||||
|
return (cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Extract a home directory from the password file
|
||||||
|
* The argument points to a buffer where the name of the
|
||||||
|
* user whose home directory is sought is currently.
|
||||||
|
* We write the home directory of the user back there.
|
||||||
|
*/
|
||||||
|
int gethdir (char *home)
|
||||||
|
{
|
||||||
|
struct passwd *pp = getpwnam(home);
|
||||||
|
|
||||||
|
if (!pp || home + strlen(pp->pw_dir) >= lastgpathp)
|
||||||
|
return (1);
|
||||||
|
(void) strcpy(home, pp->pw_dir);
|
||||||
|
return (0);
|
||||||
|
}
|
9
bin/ftp/glob.h
Normal file
9
bin/ftp/glob.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
char **ftpglob (char *v);
|
||||||
|
int letter (char c);
|
||||||
|
int digit (char c);
|
||||||
|
int any (int c, char *s);
|
||||||
|
int blklen (char **av);
|
||||||
|
char **blkcpy (char **oav, char **bv);
|
||||||
|
void blkfree (char **av0);
|
||||||
|
char **copyblk (char **v);
|
||||||
|
int gethdir (char *home);
|
470
bin/ftp/main.c
Normal file
470
bin/ftp/main.c
Normal file
|
@ -0,0 +1,470 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpmain ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char copyright[] =
|
||||||
|
"@(#) Copyright (c) 1985, 1989 Regents of the University of California.\n\
|
||||||
|
All rights reserved.\n";
|
||||||
|
|
||||||
|
static char sccsid[] = "@(#)main.c 5.18 (Berkeley) 3/1/91";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FTP User Program -- Command Interface.
|
||||||
|
*/
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#include <arpa/ftp.h>
|
||||||
|
|
||||||
|
#include <gno/gno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
#include "ftp.var.h"
|
||||||
|
#include "ftp.h"
|
||||||
|
#include "cmds.h"
|
||||||
|
#include "domacro.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
extern char *home;
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
char *cp;
|
||||||
|
int top;
|
||||||
|
struct passwd *pw = NULL;
|
||||||
|
static char homedir[MAXPATHLEN];
|
||||||
|
|
||||||
|
sp = getservbyname("ftp", "tcp");
|
||||||
|
if (sp == 0) {
|
||||||
|
fprintf(stderr, "ftp: ftp/tcp: unknown service\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
doglob = 1;
|
||||||
|
interactive = 1;
|
||||||
|
autologin = 1;
|
||||||
|
argc--, argv++;
|
||||||
|
while (argc > 0 && **argv == '-') {
|
||||||
|
for (cp = *argv + 1; *cp; cp++)
|
||||||
|
switch (*cp) {
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
options |= SO_DEBUG;
|
||||||
|
debug++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
verbose++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
trace++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
interactive = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
autologin = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'g':
|
||||||
|
doglob = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stdout,
|
||||||
|
"ftp: %c: unknown option\n", *cp);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
argc--, argv++;
|
||||||
|
}
|
||||||
|
fromatty = isatty(fileno(stdin));
|
||||||
|
if (fromatty)
|
||||||
|
verbose++;
|
||||||
|
cpend = 0; /* no pending replies */
|
||||||
|
proxy = 0; /* proxy not active */
|
||||||
|
crflag = 1; /* strip c.r. on ascii gets */
|
||||||
|
sendport = -1; /* not using ports */
|
||||||
|
/*
|
||||||
|
* Set up the home directory in case we're globbing.
|
||||||
|
*/
|
||||||
|
cp = getlogin();
|
||||||
|
if (cp != NULL) {
|
||||||
|
pw = getpwnam(cp);
|
||||||
|
}
|
||||||
|
if (pw == NULL)
|
||||||
|
pw = getpwuid(getuid());
|
||||||
|
if (pw != NULL) {
|
||||||
|
home = homedir;
|
||||||
|
strcpy(home, pw->pw_dir);
|
||||||
|
}
|
||||||
|
if (argc > 0) {
|
||||||
|
if (setjmp(toplevel))
|
||||||
|
exit(0);
|
||||||
|
signal(SIGINT, intr);
|
||||||
|
signal(SIGPIPE, lostpeer);
|
||||||
|
setpeer(argc + 1, argv - 1);
|
||||||
|
}
|
||||||
|
top = setjmp(toplevel) == 0;
|
||||||
|
if (top) {
|
||||||
|
signal(SIGINT, intr);
|
||||||
|
signal(SIGPIPE, lostpeer);
|
||||||
|
}
|
||||||
|
for (;;) {
|
||||||
|
cmdscanner(top);
|
||||||
|
top = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma databank 1
|
||||||
|
void
|
||||||
|
intr (int sig, int code)
|
||||||
|
{
|
||||||
|
longjmp (toplevel, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
lostpeer (int sig, int code)
|
||||||
|
{
|
||||||
|
extern FILE *cout;
|
||||||
|
extern int data;
|
||||||
|
|
||||||
|
if (connected) {
|
||||||
|
if (cout != NULL) {
|
||||||
|
#ifdef HAVE_SHUTDOWN
|
||||||
|
shutdown(fileno(cout), 1+1);
|
||||||
|
#endif
|
||||||
|
fclose(cout);
|
||||||
|
cout = NULL;
|
||||||
|
}
|
||||||
|
if (data >= 0) {
|
||||||
|
#ifdef HAVE_SHUTDOWN
|
||||||
|
shutdown(data, 1+1);
|
||||||
|
#endif
|
||||||
|
close(data);
|
||||||
|
data = -1;
|
||||||
|
}
|
||||||
|
connected = 0;
|
||||||
|
}
|
||||||
|
pswitch(1);
|
||||||
|
if (connected) {
|
||||||
|
if (cout != NULL) {
|
||||||
|
#ifdef HAVE_SHUTDOWN
|
||||||
|
shutdown(fileno(cout), 1+1);
|
||||||
|
#endif
|
||||||
|
fclose(cout);
|
||||||
|
cout = NULL;
|
||||||
|
}
|
||||||
|
connected = 0;
|
||||||
|
}
|
||||||
|
proxflag = 0;
|
||||||
|
pswitch(0);
|
||||||
|
}
|
||||||
|
#pragma databank 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Command parser.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
cmdscanner (int top)
|
||||||
|
{
|
||||||
|
struct cmd *c;
|
||||||
|
int l;
|
||||||
|
|
||||||
|
if (!top)
|
||||||
|
putchar('\n');
|
||||||
|
for (;;) {
|
||||||
|
if (fromatty) {
|
||||||
|
printf("ftp> ");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
if (fgets(line, 200, stdin) == NULL)
|
||||||
|
quit(0, NULL);
|
||||||
|
l = strlen(line);
|
||||||
|
if (l == 0)
|
||||||
|
break;
|
||||||
|
if (line[--l] == '\n') {
|
||||||
|
if (l == 0)
|
||||||
|
break;
|
||||||
|
line[l] = '\0';
|
||||||
|
} else if (l == sizeof(line) - 2) {
|
||||||
|
printf("sorry, input line too long\n");
|
||||||
|
while ((l = getchar()) != '\n' && l != EOF)
|
||||||
|
/* void */;
|
||||||
|
break;
|
||||||
|
} /* else it was a line without a newline */
|
||||||
|
makeargv();
|
||||||
|
if (margc == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
c = getcmd(margv[0]);
|
||||||
|
if (c == (struct cmd *)-1) {
|
||||||
|
printf("?Ambiguous command\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c == 0) {
|
||||||
|
printf("?Invalid command\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c->c_conn && !connected) {
|
||||||
|
printf("Not connected.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
(*c->c_handler)(margc, margv);
|
||||||
|
if (bell && c->c_bell)
|
||||||
|
putchar('\007');
|
||||||
|
if (c->c_handler != help)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
signal(SIGINT, intr);
|
||||||
|
signal(SIGPIPE, lostpeer);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cmd *
|
||||||
|
getcmd (char *name)
|
||||||
|
{
|
||||||
|
extern struct cmd cmdtab[];
|
||||||
|
char *p, *q;
|
||||||
|
struct cmd *c, *found;
|
||||||
|
int nmatches, longest;
|
||||||
|
|
||||||
|
longest = 0;
|
||||||
|
nmatches = 0;
|
||||||
|
found = 0;
|
||||||
|
for (c = cmdtab; p = c->c_name; c++) {
|
||||||
|
for (q = name; *q == *p++; q++)
|
||||||
|
if (*q == 0) /* exact match? */
|
||||||
|
return (c);
|
||||||
|
if (!*q) { /* the name was a prefix */
|
||||||
|
if (q - name > longest) {
|
||||||
|
longest = q - name;
|
||||||
|
nmatches = 1;
|
||||||
|
found = c;
|
||||||
|
} else if (q - name == longest)
|
||||||
|
nmatches++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nmatches > 1)
|
||||||
|
return ((struct cmd *)-1);
|
||||||
|
return (found);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Slice a string up into argc/argv.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int slrflag;
|
||||||
|
|
||||||
|
void
|
||||||
|
makeargv (void)
|
||||||
|
{
|
||||||
|
char **argp;
|
||||||
|
|
||||||
|
margc = 0;
|
||||||
|
argp = margv;
|
||||||
|
stringbase = line; /* scan from first of buffer */
|
||||||
|
argbase = argbuf; /* store from first of buffer */
|
||||||
|
slrflag = 0;
|
||||||
|
while (*argp++ = slurpstring())
|
||||||
|
margc++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse string into argbuf;
|
||||||
|
* implemented with FSM to
|
||||||
|
* handle quoting and strings
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
slurpstring (void)
|
||||||
|
{
|
||||||
|
int got_one = 0;
|
||||||
|
char *sb = stringbase;
|
||||||
|
char *ap = argbase;
|
||||||
|
char *tmp = argbase; /* will return this if token found */
|
||||||
|
|
||||||
|
if (*sb == '!' || *sb == '$') { /* recognize ! as a token for shell */
|
||||||
|
switch (slrflag) { /* and $ as token for macro invoke */
|
||||||
|
case 0:
|
||||||
|
slrflag++;
|
||||||
|
stringbase++;
|
||||||
|
return ((*sb == '!') ? "!" : "$");
|
||||||
|
/* NOTREACHED */
|
||||||
|
case 1:
|
||||||
|
slrflag++;
|
||||||
|
altarg = stringbase;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
S0:
|
||||||
|
switch (*sb) {
|
||||||
|
|
||||||
|
case '\0':
|
||||||
|
goto OUT;
|
||||||
|
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
sb++; goto S0;
|
||||||
|
|
||||||
|
default:
|
||||||
|
switch (slrflag) {
|
||||||
|
case 0:
|
||||||
|
slrflag++;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
slrflag++;
|
||||||
|
altarg = sb;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto S1;
|
||||||
|
}
|
||||||
|
|
||||||
|
S1:
|
||||||
|
switch (*sb) {
|
||||||
|
|
||||||
|
case ' ':
|
||||||
|
case '\t':
|
||||||
|
case '\0':
|
||||||
|
goto OUT; /* end of token */
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
sb++; goto S2; /* slurp next character */
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
sb++; goto S3; /* slurp quoted string */
|
||||||
|
|
||||||
|
default:
|
||||||
|
*ap++ = *sb++; /* add character to token */
|
||||||
|
got_one = 1;
|
||||||
|
goto S1;
|
||||||
|
}
|
||||||
|
|
||||||
|
S2:
|
||||||
|
switch (*sb) {
|
||||||
|
|
||||||
|
case '\0':
|
||||||
|
goto OUT;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*ap++ = *sb++;
|
||||||
|
got_one = 1;
|
||||||
|
goto S1;
|
||||||
|
}
|
||||||
|
|
||||||
|
S3:
|
||||||
|
switch (*sb) {
|
||||||
|
|
||||||
|
case '\0':
|
||||||
|
goto OUT;
|
||||||
|
|
||||||
|
case '"':
|
||||||
|
sb++; goto S1;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*ap++ = *sb++;
|
||||||
|
got_one = 1;
|
||||||
|
goto S3;
|
||||||
|
}
|
||||||
|
|
||||||
|
OUT:
|
||||||
|
if (got_one)
|
||||||
|
*ap++ = '\0';
|
||||||
|
argbase = ap; /* update storage pointer */
|
||||||
|
stringbase = sb; /* update scan pointer */
|
||||||
|
if (got_one) {
|
||||||
|
return(tmp);
|
||||||
|
}
|
||||||
|
switch (slrflag) {
|
||||||
|
case 0:
|
||||||
|
slrflag++;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
slrflag++;
|
||||||
|
altarg = (char *) 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return((char *)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Help command.
|
||||||
|
* Call each command handler with argc == 0 and argv[0] == name.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
help (int argc, char **argv)
|
||||||
|
{
|
||||||
|
extern struct cmd cmdtab[];
|
||||||
|
struct cmd *c;
|
||||||
|
|
||||||
|
if (argc == 1) {
|
||||||
|
int i, j, w, k;
|
||||||
|
int columns, width = 0, lines;
|
||||||
|
extern int NCMDS;
|
||||||
|
|
||||||
|
printf("Commands may be abbreviated. Commands are:\n\n");
|
||||||
|
for (c = cmdtab; c < &cmdtab[NCMDS]; c++) {
|
||||||
|
int len = strlen(c->c_name);
|
||||||
|
|
||||||
|
if (len > width)
|
||||||
|
width = len;
|
||||||
|
}
|
||||||
|
width = (width + 8) &~ 7;
|
||||||
|
columns = 80 / width;
|
||||||
|
if (columns == 0)
|
||||||
|
columns = 1;
|
||||||
|
lines = (NCMDS + columns - 1) / columns;
|
||||||
|
for (i = 0; i < lines; i++) {
|
||||||
|
for (j = 0; j < columns; j++) {
|
||||||
|
c = cmdtab + j * lines + i;
|
||||||
|
if (c->c_name && (!proxy || c->c_proxy)) {
|
||||||
|
printf("%s", c->c_name);
|
||||||
|
}
|
||||||
|
else if (c->c_name) {
|
||||||
|
for (k=0; k < strlen(c->c_name); k++) {
|
||||||
|
putchar(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (c + lines >= &cmdtab[NCMDS]) {
|
||||||
|
printf("\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
w = strlen(c->c_name);
|
||||||
|
while (w < width) {
|
||||||
|
w = (w + 8) &~ 7;
|
||||||
|
putchar('\t');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (--argc > 0) {
|
||||||
|
char *arg;
|
||||||
|
arg = *++argv;
|
||||||
|
c = getcmd(arg);
|
||||||
|
if (c == (struct cmd *)-1)
|
||||||
|
printf("?Ambiguous help command %s\n", arg);
|
||||||
|
else if (c == (struct cmd *)0)
|
||||||
|
printf("?Invalid help command %s\n", arg);
|
||||||
|
else
|
||||||
|
printf("%10s\t%s\n", c->c_name, c->c_help);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
7
bin/ftp/main.h
Normal file
7
bin/ftp/main.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
void intr (int sig, int code);
|
||||||
|
void lostpeer (int sig, int code);
|
||||||
|
int cmdscanner (int top);
|
||||||
|
struct cmd *getcmd (char *name);
|
||||||
|
void makeargv (void);
|
||||||
|
char *slurpstring (void);
|
||||||
|
void help (int argc, char **argv);
|
39
bin/ftp/pathnames.h
Normal file
39
bin/ftp/pathnames.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 1989 The Regents of the University of California.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)pathnames.h 5.2 (Berkeley) 6/1/90
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <paths.h>
|
||||||
|
|
||||||
|
#undef _PATH_TMP
|
||||||
|
#define _PATH_TMP "/tmp/ftpXXXXXX"
|
252
bin/ftp/ruserpass.c
Normal file
252
bin/ftp/ruserpass.c
Normal file
|
@ -0,0 +1,252 @@
|
||||||
|
#ifdef __ORCAC__
|
||||||
|
segment "ftpmain ";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char sccsid[] = "@(#)ruserpass.c 5.3 (Berkeley) 3/1/91";
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <utmp.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
|
||||||
|
#include "ftp.var.h"
|
||||||
|
#include "cmds.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include "domacro.h"
|
||||||
|
#include "ruserpass.h"
|
||||||
|
|
||||||
|
static FILE *cfile;
|
||||||
|
|
||||||
|
#define DEFAULT 1
|
||||||
|
#define LOGIN 2
|
||||||
|
#define PASSWD 3
|
||||||
|
#define ACCOUNT 4
|
||||||
|
#define MACDEF 5
|
||||||
|
#define ID 10
|
||||||
|
#define MACH 11
|
||||||
|
|
||||||
|
static char tokval[100];
|
||||||
|
|
||||||
|
static struct toktab {
|
||||||
|
char *tokstr;
|
||||||
|
int tval;
|
||||||
|
} toktab[]= {
|
||||||
|
"default", DEFAULT,
|
||||||
|
"login", LOGIN,
|
||||||
|
"password", PASSWD,
|
||||||
|
"passwd", PASSWD,
|
||||||
|
"account", ACCOUNT,
|
||||||
|
"machine", MACH,
|
||||||
|
"macdef", MACDEF,
|
||||||
|
0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static int token (void)
|
||||||
|
{
|
||||||
|
char *cp;
|
||||||
|
int c;
|
||||||
|
struct toktab *t;
|
||||||
|
|
||||||
|
if (feof(cfile))
|
||||||
|
return (0);
|
||||||
|
while ((c = getc(cfile)) != EOF &&
|
||||||
|
(c == '\n' || c == '\t' || c == ' ' || c == ','))
|
||||||
|
continue;
|
||||||
|
if (c == EOF)
|
||||||
|
return (0);
|
||||||
|
cp = tokval;
|
||||||
|
if (c == '"') {
|
||||||
|
while ((c = getc(cfile)) != EOF && c != '"') {
|
||||||
|
if (c == '\\')
|
||||||
|
c = getc(cfile);
|
||||||
|
*cp++ = c;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*cp++ = c;
|
||||||
|
while ((c = getc(cfile)) != EOF
|
||||||
|
&& c != '\n' && c != '\t' && c != ' ' && c != ',') {
|
||||||
|
if (c == '\\')
|
||||||
|
c = getc(cfile);
|
||||||
|
*cp++ = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*cp = 0;
|
||||||
|
if (tokval[0] == 0)
|
||||||
|
return (0);
|
||||||
|
for (t = toktab; t->tokstr; t++)
|
||||||
|
if (!strcmp(t->tokstr, tokval))
|
||||||
|
return (t->tval);
|
||||||
|
return (ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ruserpass (char *host, char **aname, char **apass, char **aacct)
|
||||||
|
{
|
||||||
|
char *hdir, *tmp;
|
||||||
|
static char buf[BUFSIZ];
|
||||||
|
static char myname[MAXHOSTNAMELEN];
|
||||||
|
char *mydomain;
|
||||||
|
int t, i, c, usedefault = 0;
|
||||||
|
static struct stat stb;
|
||||||
|
|
||||||
|
hdir = getenv("HOME");
|
||||||
|
if (hdir == NULL)
|
||||||
|
hdir = ".";
|
||||||
|
sprintf(buf, "%s/.netrc", hdir);
|
||||||
|
cfile = fopen(buf, "r");
|
||||||
|
if (cfile == NULL) {
|
||||||
|
if (errno != ENOENT)
|
||||||
|
perror(buf);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if (gethostname(myname, sizeof(myname)) < 0)
|
||||||
|
myname[0] = '\0';
|
||||||
|
if ((mydomain = index(myname, '.')) == NULL)
|
||||||
|
mydomain = "";
|
||||||
|
next:
|
||||||
|
while ((t = token())) switch(t) {
|
||||||
|
|
||||||
|
case DEFAULT:
|
||||||
|
usedefault = 1;
|
||||||
|
/* FALL THROUGH */
|
||||||
|
|
||||||
|
case MACH:
|
||||||
|
if (!usedefault) {
|
||||||
|
if (token() != ID)
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
* Allow match either for user's input host name
|
||||||
|
* or official hostname. Also allow match of
|
||||||
|
* incompletely-specified host in local domain.
|
||||||
|
*/
|
||||||
|
if (strcasecmp(host, tokval) == 0)
|
||||||
|
goto match;
|
||||||
|
if (strcasecmp(hostname, tokval) == 0)
|
||||||
|
goto match;
|
||||||
|
if ((tmp = index(hostname, '.')) != NULL &&
|
||||||
|
strcasecmp(tmp, mydomain) == 0 &&
|
||||||
|
strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
|
||||||
|
tokval[tmp - hostname] == '\0')
|
||||||
|
goto match;
|
||||||
|
if ((tmp = index(host, '.')) != NULL &&
|
||||||
|
strcasecmp(tmp, mydomain) == 0 &&
|
||||||
|
strncasecmp(host, tokval, tmp - host) == 0 &&
|
||||||
|
tokval[tmp - host] == '\0')
|
||||||
|
goto match;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
match:
|
||||||
|
while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
|
||||||
|
|
||||||
|
case LOGIN:
|
||||||
|
if (token())
|
||||||
|
if (*aname == 0) {
|
||||||
|
*aname = malloc((unsigned) strlen(tokval) + 1);
|
||||||
|
strcpy(*aname, tokval);
|
||||||
|
} else {
|
||||||
|
if (strcmp(*aname, tokval))
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PASSWD:
|
||||||
|
if (strcmp(*aname, "anonymous") &&
|
||||||
|
fstat(fileno(cfile), &stb) >= 0 &&
|
||||||
|
(stb.st_mode & 077) != 0) {
|
||||||
|
fprintf(stderr, "Error - .netrc file not correct mode.\n");
|
||||||
|
fprintf(stderr, "Remove password or correct mode.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
if (token() && *apass == 0) {
|
||||||
|
*apass = malloc((unsigned) strlen(tokval) + 1);
|
||||||
|
strcpy(*apass, tokval);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ACCOUNT:
|
||||||
|
if (fstat(fileno(cfile), &stb) >= 0
|
||||||
|
&& (stb.st_mode & 077) != 0) {
|
||||||
|
fprintf(stderr, "Error - .netrc file not correct mode.\n");
|
||||||
|
fprintf(stderr, "Remove account or correct mode.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
if (token() && *aacct == 0) {
|
||||||
|
*aacct = malloc((unsigned) strlen(tokval) + 1);
|
||||||
|
strcpy(*aacct, tokval);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MACDEF:
|
||||||
|
if (proxy) {
|
||||||
|
fclose(cfile);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
while ((c=getc(cfile)) != EOF && c == ' ' || c == '\t');
|
||||||
|
if (c == EOF || c == '\n') {
|
||||||
|
printf("Missing macdef name argument.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
if (macnum == 16) {
|
||||||
|
printf("Limit of 16 macros have already been defined\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
tmp = macros[macnum].mac_name;
|
||||||
|
*tmp++ = c;
|
||||||
|
for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
|
||||||
|
!isspace(c); ++i) {
|
||||||
|
*tmp++ = c;
|
||||||
|
}
|
||||||
|
if (c == EOF) {
|
||||||
|
printf("Macro definition missing null line terminator.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
*tmp = '\0';
|
||||||
|
if (c != '\n') {
|
||||||
|
while ((c=getc(cfile)) != EOF && c != '\n');
|
||||||
|
}
|
||||||
|
if (c == EOF) {
|
||||||
|
printf("Macro definition missing null line terminator.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
if (macnum == 0) {
|
||||||
|
macros[macnum].mac_start = macbuf;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
|
||||||
|
}
|
||||||
|
tmp = macros[macnum].mac_start;
|
||||||
|
while (tmp != macbuf + 4096) {
|
||||||
|
if ((c=getc(cfile)) == EOF) {
|
||||||
|
printf("Macro definition missing null line terminator.\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
*tmp = c;
|
||||||
|
if (*tmp == '\n') {
|
||||||
|
if (*(tmp-1) == '\0') {
|
||||||
|
macros[macnum++].mac_end = tmp - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*tmp = '\0';
|
||||||
|
}
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
if (tmp == macbuf + 4096) {
|
||||||
|
printf("4K macro buffer exceeded\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown .netrc keyword %s\n", tokval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
done:
|
||||||
|
fclose(cfile);
|
||||||
|
return(0);
|
||||||
|
bad:
|
||||||
|
fclose(cfile);
|
||||||
|
return(-1);
|
||||||
|
}
|
1
bin/ftp/ruserpass.h
Normal file
1
bin/ftp/ruserpass.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
int ruserpass (char *host, char **aname, char **apass, char **aacct);
|
152
bin/ftp/tags
Normal file
152
bin/ftp/tags
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
ACCOUNT ruserpass.c /^#define ACCOUNT 4$/
|
||||||
|
DEFAULT ruserpass.c /^#define DEFAULT 1$/
|
||||||
|
GAVSIZ glob.c /^#define GAVSIZ (NCARGS\/6)$/
|
||||||
|
Gcat glob.c /^static void Gcat (char \*s1, char \*s2)$/
|
||||||
|
Gmatch glob.c /^static int Gmatch (char \*s, char \*p)$/
|
||||||
|
HASHBYTES ftp.c /^#define HASHBYTES 1024$/
|
||||||
|
ID ruserpass.c /^#define ID 10$/
|
||||||
|
LOGIN ruserpass.c /^#define LOGIN 2$/
|
||||||
|
MACDEF ruserpass.c /^#define MACDEF 5$/
|
||||||
|
MACH ruserpass.c /^#define MACH 11$/
|
||||||
|
Mmain main.c /^main (int argc, char \*\*argv)$/
|
||||||
|
PASSWD ruserpass.c /^#define PASSWD 3$/
|
||||||
|
QUOTE glob.c /^#define QUOTE 0200$/
|
||||||
|
TRIM glob.c /^#define TRIM 0177$/
|
||||||
|
UC ftp.c /^#define UC(b) (((unsigned int)b)&0xff)$/
|
||||||
|
_PATH_TMP pathnames.h /^#define _PATH_TMP "\/tmp\/ftpXXXXXX"$/
|
||||||
|
abort_remote ftp.c /^void abort_remote (FILE \*din)$/
|
||||||
|
abortpt ftp.c /^void abortpt (int sig, int code)$/
|
||||||
|
abortrecv ftp.c /^void abortrecv (int sig, int code)$/
|
||||||
|
abortsend ftp.c /^void abortsend (int sig, int code)$/
|
||||||
|
account cmds.c /^void account (int argc, char \*\*argv)$/
|
||||||
|
acollect glob.c /^static void acollect (char \*as)$/
|
||||||
|
addpath glob.c /^static void addpath (char c)$/
|
||||||
|
amatch glob.c /^static int amatch (char \*s, char \*p)$/
|
||||||
|
another cmds.c /^int another (int \*pargc, char \*\*\*pargv, char /
|
||||||
|
any glob.c /^int any (int c, char \*s)$/
|
||||||
|
blkcpy glob.c /^char \*\*blkcpy (char \*\*oav, char \*\*bv)$/
|
||||||
|
blkfree glob.c /^void blkfree (char \*\*av0)$/
|
||||||
|
blklen glob.c /^int blklen (char \*\*av)$/
|
||||||
|
cd cmds.c /^void cd (int argc, char \*\*argv)$/
|
||||||
|
cdup cmds.c /^void cdup (int argc, char \*\*argv)$/
|
||||||
|
changetype cmds.c /^void changetype (int newtype, int show)$/
|
||||||
|
cmd ftp.var.c /^struct cmd {$/
|
||||||
|
cmdabort ftp.c /^void cmdabort (int sig, int code)$/
|
||||||
|
cmdscanner main.c /^cmdscanner (int top)$/
|
||||||
|
collect glob.c /^static void collect (char \*as)$/
|
||||||
|
command ftp.c /^int command (char \*string, \.\.\.)$/
|
||||||
|
comvars ftp.c /^static struct comvars {$/
|
||||||
|
confirm cmds.c /^int confirm (char \*cmd, char \*file)$/
|
||||||
|
copyblk glob.c /^char \*\*copyblk (char \*\*v)$/
|
||||||
|
dataconn ftp.c /^FILE \*dataconn (char \*lmode)$/
|
||||||
|
delete cmds.c /^void delete (int argc, char \*\*argv)$/
|
||||||
|
digit glob.c /^int digit (char c)$/
|
||||||
|
disconnect cmds.c /^void disconnect (int argc, char \*\*argv)$/
|
||||||
|
do_chmod cmds.c /^void do_chmod (int argc, char \*\*argv)$/
|
||||||
|
do_umask cmds.c /^void do_umask (int argc, char \*\*argv)$/
|
||||||
|
domacro domacro.c /^void domacro (int argc, char \*\*argv)$/
|
||||||
|
domap cmds.c /^char \*domap (char \*name)$/
|
||||||
|
doproxy cmds.c /^void doproxy (int argc, char \*\*argv)$/
|
||||||
|
dotrans cmds.c /^char \*dotrans (char \*name)$/
|
||||||
|
empty ftp.c /^int empty (struct fd_set \*mask, int sec)$/
|
||||||
|
eq glob.c /^#define eq(a,b) (strcmp(a, b)==0)$/
|
||||||
|
execbrc glob.c /^static int execbrc (char \*p, char \*s)$/
|
||||||
|
expand glob.c /^static void expand (char \*as)$/
|
||||||
|
fatal cmds.c /^void fatal (char \*msg)$/
|
||||||
|
ftpglob glob.c /^char \*\*ftpglob (char \*v)$/
|
||||||
|
ftpsetdebug cmds.c /^void ftpsetdebug (int argc, char \*\*argv)$/
|
||||||
|
get cmds.c /^void get (int argc, char \*\*argv)$/
|
||||||
|
getcmd main.c /^getcmd (char \*name)$/
|
||||||
|
gethdir glob.c /^int gethdir (char \*home)$/
|
||||||
|
getit cmds.c /^int getit (int argc, char \*\*argv, int restartit,/
|
||||||
|
getlogin ftp.c /^char \*getlogin (void)$/
|
||||||
|
getreply ftp.c /^int getreply (int expecteof)$/
|
||||||
|
gettimeofday ftp.c /^int gettimeofday(struct timeval \*tp, struct timez/
|
||||||
|
ginit glob.c /^static void ginit (char \*\*agargv)$/
|
||||||
|
globulize cmds.c /^int globulize (char \*cpp\[\])$/
|
||||||
|
gunique ftp.c /^char \*gunique (char \*local)$/
|
||||||
|
help main.c /^help (int argc, char \*\*argv)$/
|
||||||
|
hookup ftp.c /^char \*hookup (char \*host, int port)$/
|
||||||
|
idle cmds.c /^void idle (int argc, char \*\*argv)$/
|
||||||
|
initconn ftp.c /^int initconn (void)$/
|
||||||
|
intr main.c /^intr (int sig, int code)$/
|
||||||
|
isdir glob.c /^#define isdir(d) ((d\.st_mode & S_IFMT) == S_IFDIR/
|
||||||
|
lcd cmds.c /^void lcd (int argc, char \*\*argv)$/
|
||||||
|
letter glob.c /^int letter (char c)$/
|
||||||
|
login ftp.c /^int login (char \*host)$/
|
||||||
|
lostpeer main.c /^lostpeer (int sig, int code)$/
|
||||||
|
ls cmds.c /^void ls (int argc, char \*\*argv)$/
|
||||||
|
mabort cmds.c /^void mabort (int sig, int code)$/
|
||||||
|
macdef cmds.c /^void macdef (int argc, char \*\*argv)$/
|
||||||
|
macel ftp.var.c /^struct macel {$/
|
||||||
|
makeargv main.c /^makeargv (void)$/
|
||||||
|
makedir cmds.c /^void makedir (int argc, char \*\*argv)$/
|
||||||
|
match glob.c /^static int match (char \*s, char \*p)$/
|
||||||
|
matchdir glob.c /^static void matchdir (char \*pattern)$/
|
||||||
|
mdelete cmds.c /^void mdelete (int argc, char \*\*argv)$/
|
||||||
|
mget cmds.c /^void mget (int argc, char \*\*argv)$/
|
||||||
|
mls cmds.c /^void mls (int argc, char \*\*argv)$/
|
||||||
|
modtime cmds.c /^void modtime (int argc, char \*\*argv)$/
|
||||||
|
mput cmds.c /^void mput (int argc, char \*\*argv)$/
|
||||||
|
newer cmds.c /^void newer (int argc, char \*\*argv)$/
|
||||||
|
nz ftp.c /^#define nz(x) ((x) == 0 ? 1 : (x))$/
|
||||||
|
onoff cmds.c /^char \*onoff (int bool)$/
|
||||||
|
proxabort cmds.c /^void proxabort (int sig, int code)$/
|
||||||
|
proxtrans ftp.c /^void proxtrans (char \*cmd, char \*local, char \*r/
|
||||||
|
psabort ftp.c /^void psabort (int sig, int code)$/
|
||||||
|
pswitch ftp.c /^void pswitch (int flag)$/
|
||||||
|
ptransfer ftp.c /^void ptransfer(char \*direction, long bytes, struc/
|
||||||
|
put cmds.c /^void put (int argc, char \*\*argv)$/
|
||||||
|
pwd cmds.c /^void pwd (int argc, char \*\*argv)$/
|
||||||
|
quit cmds.c /^void quit (int argc, char \*\*argv)$/
|
||||||
|
quote cmds.c /^void quote (int argc, char \*\*argv)$/
|
||||||
|
quote1 cmds.c /^void quote1 (char \*initial, int argc, char \*\*ar/
|
||||||
|
recvrequest ftp.c /^void recvrequest (char \*cmd, char \*local, char /
|
||||||
|
reget cmds.c /^void reget (int argc, char \*\*argv)$/
|
||||||
|
remglob cmds.c /^char \*remglob (char \*\*argv, int doswitch)$/
|
||||||
|
removedir cmds.c /^void removedir (int argc, char \*\*argv)$/
|
||||||
|
renamefile cmds.c /^void renamefile (int argc, char \*\*argv)$/
|
||||||
|
reset cmds.c /^void reset (int argc, char \*\*argv)$/
|
||||||
|
restart cmds.c /^void restart (int argc, char \*\*argv)$/
|
||||||
|
rmthelp cmds.c /^void rmthelp (int argc, char \*\*argv)$/
|
||||||
|
rmtstatus cmds.c /^void rmtstatus (int argc, char \*\*argv)$/
|
||||||
|
rscan glob.c /^static void rscan (char \*\*t, int (\*f)(char))$/
|
||||||
|
ruserpass ruserpass.c /^int ruserpass (char \*host, char \*\*aname, char /
|
||||||
|
sendrequest ftp.c /^void sendrequest (char \*cmd, char \*local, char /
|
||||||
|
setascii cmds.c /^void setascii (int argc, char \*\*argv)$/
|
||||||
|
setbell cmds.c /^void setbell (int argc, char \*\*argv)$/
|
||||||
|
setbinary cmds.c /^void setbinary (int argc, char \*\*argv)$/
|
||||||
|
setcase cmds.c /^void setcase (int argc, char \*\*argv)$/
|
||||||
|
setcr cmds.c /^void setcr (int argc, char \*\*argv)$/
|
||||||
|
setform cmds.c /^void setform (int argc, char \*\*argv)$/
|
||||||
|
setglob cmds.c /^void setglob (int argc, char \*\*argv)$/
|
||||||
|
sethash cmds.c /^void sethash (int argc, char \*\*argv)$/
|
||||||
|
setmode cmds.c /^void setmode (int argc, char \*\*argv)$/
|
||||||
|
setnmap cmds.c /^void setnmap (int argc, char \*\*argv)$/
|
||||||
|
setntrans cmds.c /^void setntrans (int argc, char \*\*argv)$/
|
||||||
|
setpeer cmds.c /^void setpeer (int argc, char \*\*argv)$/
|
||||||
|
setport cmds.c /^void setport (int argc, char \*\*argv)$/
|
||||||
|
setprompt cmds.c /^void setprompt (int argc, char \*\*argv)$/
|
||||||
|
setrunique cmds.c /^void setrunique (int argc, char \*\*argv)$/
|
||||||
|
setstruct cmds.c /^void setstruct (int argc, char \*\*argv)$/
|
||||||
|
setsunique cmds.c /^void setsunique (int argc, char \*\*argv)$/
|
||||||
|
settenex cmds.c /^void settenex (int argc, char \*\*argv)$/
|
||||||
|
settrace cmds.c /^void settrace (int argc, char \*\*argv)$/
|
||||||
|
settype cmds.c /^void settype (int argc, char \*\*argv)$/
|
||||||
|
setverbose cmds.c /^void setverbose (int argc, char \*\*argv)$/
|
||||||
|
shell cmds.c /^void shell (int argc, char \*\*argv)$/
|
||||||
|
site cmds.c /^void site (int argc, char \*\*argv)$/
|
||||||
|
sizecmd cmds.c /^void sizecmd (int argc, char \*\*argv)$/
|
||||||
|
slurpstring main.c /^slurpstring (void)$/
|
||||||
|
sort glob.c /^static void sort (void)$/
|
||||||
|
status cmds.c /^void status (int argc, char \*\*argv)$/
|
||||||
|
strend glob.c /^static char \*strend (char \*cp)$/
|
||||||
|
strspl glob.c /^static char \*strspl (char \*cp, char \*dp)$/
|
||||||
|
syst cmds.c /^void syst (int argc, char \*\*argv)$/
|
||||||
|
tglob glob.c /^static int tglob (char c)$/
|
||||||
|
token ruserpass.c /^static int token (void)$/
|
||||||
|
toktab ruserpass.c /^static struct toktab {$/
|
||||||
|
tvadd ftp.c /^void tvadd (struct timeval \*tsum, struct timeval /
|
||||||
|
tvsub ftp.c /^void tvsub (struct timeval \*tdiff, struct timeval/
|
||||||
|
types cmds.c /^struct types {$/
|
||||||
|
user cmds.c /^void user (int argc, char \*\*argv)$/
|
Loading…
Reference in New Issue
Block a user