xref: /csrg-svn/usr.bin/ftp/cmdtab.c (revision 62009)
121738Sdist /*
2*62009Sbostic  * Copyright (c) 1985, 1989, 1993
3*62009Sbostic  *	The Regents of the University of California.  All rights reserved.
433737Sbostic  *
542665Sbostic  * %sccs.include.redist.c%
621738Sdist  */
721738Sdist 
810295Ssam #ifndef lint
9*62009Sbostic static char sccsid[] = "@(#)cmdtab.c	8.1 (Berkeley) 06/06/93";
1033737Sbostic #endif /* not lint */
1111651Ssam 
1210295Ssam #include "ftp_var.h"
1310295Ssam 
1410295Ssam /*
1510295Ssam  * User FTP -- Command Tables.
1610295Ssam  */
1710295Ssam int	setascii(), setbell(), setbinary(), setdebug(), setform();
1814144Ssam int	setglob(), sethash(), setmode(), setpeer(), setport();
1911651Ssam int	setprompt(), setstruct();
2011350Ssam int	settenex(), settrace(), settype(), setverbose();
2137224Skarels int	disconnect(), restart(), reget(), syst();
2211651Ssam int	cd(), lcd(), delete(), mdelete(), user();
2311757Ssam int	ls(), mls(), get(), mget(), help(), append(), put(), mput();
2410295Ssam int	quit(), renamefile(), status();
2537224Skarels int	quote(), rmthelp(), shell(), site();
2626049Sminshall int	pwd(), makedir(), removedir(), setcr();
2726049Sminshall int	account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
2826049Sminshall int	setsunique(), setrunique(), cdup(), macdef(), domacro();
2937224Skarels int	sizecmd(), modtime(), newer(), rmtstatus();
3037224Skarels int	do_chmod(), do_umask(), idle();
3110295Ssam 
3226049Sminshall char	accounthelp[] =	"send account command to remote server";
3311651Ssam char	appendhelp[] =	"append to a file";
3410295Ssam char	asciihelp[] =	"set ascii transfer type";
3510295Ssam char	beephelp[] =	"beep when command completed";
3610295Ssam char	binaryhelp[] =	"set binary transfer type";
3726049Sminshall char	casehelp[] =	"toggle mget upper/lower case id mapping";
3810295Ssam char	cdhelp[] =	"change remote working directory";
3926049Sminshall char	cduphelp[] = 	"change remote working directory to parent directory";
4037224Skarels char	chmodhelp[] =	"change file permissions of remote file";
4110295Ssam char	connecthelp[] =	"connect to remote tftp";
4226049Sminshall char	crhelp[] =	"toggle carriage return stripping on ascii gets";
4310295Ssam char	deletehelp[] =	"delete remote file";
4410295Ssam char	debughelp[] =	"toggle/set debugging mode";
4510295Ssam char	dirhelp[] =	"list contents of remote directory";
4610295Ssam char	disconhelp[] =	"terminate ftp session";
4726049Sminshall char	domachelp[] = 	"execute macro";
4810295Ssam char	formhelp[] =	"set file transfer format";
4911350Ssam char	globhelp[] =	"toggle metacharacter expansion of local file names";
5011651Ssam char	hashhelp[] =	"toggle printing `#' for each buffer transferred";
5110295Ssam char	helphelp[] =	"print local help information";
5237224Skarels char	idlehelp[] =	"get (set) idle timer on remote side";
5310295Ssam char	lcdhelp[] =	"change local working directory";
5436935Skarels char	lshelp[] =	"list contents of remote directory";
5526049Sminshall char	macdefhelp[] =  "define a macro";
5611651Ssam char	mdeletehelp[] =	"delete multiple files";
5711757Ssam char	mdirhelp[] =	"list contents of multiple remote directories";
5811350Ssam char	mgethelp[] =	"get multiple files";
5910295Ssam char	mkdirhelp[] =	"make directory on the remote machine";
6037224Skarels char	mlshelp[] =	"list contents of multiple remote directories";
6136935Skarels char	modtimehelp[] = "show last modification time of remote file";
6210295Ssam char	modehelp[] =	"set file transfer mode";
6311350Ssam char	mputhelp[] =	"send multiple files";
6437224Skarels char	newerhelp[] =	"get file if remote file is newer than local file ";
6536935Skarels char	nlisthelp[] =	"nlist contents of remote directory";
6626049Sminshall char	nmaphelp[] =	"set templates for default file name mapping";
6726049Sminshall char	ntranshelp[] =	"set translation table for default file name mapping";
6811651Ssam char	porthelp[] =	"toggle use of PORT cmd for each data connection";
6910295Ssam char	prompthelp[] =	"force interactive prompting on multiple commands";
7026049Sminshall char	proxyhelp[] =	"issue command on alternate connection";
7110295Ssam char	pwdhelp[] =	"print working directory on remote machine";
7210295Ssam char	quithelp[] =	"terminate ftp session and exit";
7310295Ssam char	quotehelp[] =	"send arbitrary ftp command";
7410295Ssam char	receivehelp[] =	"receive file";
7537224Skarels char	regethelp[] =	"get file restarting at end of local file";
7610295Ssam char	remotehelp[] =	"get help from remote server";
7710295Ssam char	renamehelp[] =	"rename file";
7837224Skarels char	restarthelp[]=	"restart file transfer at bytecount";
7910295Ssam char	rmdirhelp[] =	"remove directory on the remote machine";
8036935Skarels char	rmtstatushelp[]="show status of remote machine";
8126049Sminshall char	runiquehelp[] = "toggle store unique for local files";
8226049Sminshall char	resethelp[] =	"clear queued command replies";
8311350Ssam char	sendhelp[] =	"send one file";
8437224Skarels char	sitehelp[] =	"send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
8510295Ssam char	shellhelp[] =	"escape to the shell";
8636935Skarels char	sizecmdhelp[] = "show size of remote file";
8710295Ssam char	statushelp[] =	"show current status";
8810295Ssam char	structhelp[] =	"set file transfer structure";
8926049Sminshall char	suniquehelp[] = "toggle store unique on remote machine";
9036935Skarels char	systemhelp[] =  "show remote system type";
9110295Ssam char	tenexhelp[] =	"set tenex file transfer type";
9210295Ssam char	tracehelp[] =	"toggle packet tracing";
9310295Ssam char	typehelp[] =	"set file transfer type";
9437224Skarels char	umaskhelp[] =	"get (set) umask on remote side";
9510295Ssam char	userhelp[] =	"send new user information";
9610295Ssam char	verbosehelp[] =	"toggle verbose mode";
9710295Ssam 
9810295Ssam struct cmd cmdtab[] = {
9926049Sminshall 	{ "!",		shellhelp,	0,	0,	0,	shell },
10026049Sminshall 	{ "$",		domachelp,	1,	0,	0,	domacro },
10126049Sminshall 	{ "account",	accounthelp,	0,	1,	1,	account},
10226049Sminshall 	{ "append",	appendhelp,	1,	1,	1,	put },
10326049Sminshall 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
10426049Sminshall 	{ "bell",	beephelp,	0,	0,	0,	setbell },
10526049Sminshall 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
10626049Sminshall 	{ "bye",	quithelp,	0,	0,	0,	quit },
10726049Sminshall 	{ "case",	casehelp,	0,	0,	1,	setcase },
10826049Sminshall 	{ "cd",		cdhelp,		0,	1,	1,	cd },
10926049Sminshall 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
11037224Skarels 	{ "chmod",	chmodhelp,	0,	1,	1,	do_chmod },
11126049Sminshall 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
11226049Sminshall 	{ "cr",		crhelp,		0,	0,	0,	setcr },
11326049Sminshall 	{ "delete",	deletehelp,	0,	1,	1,	delete },
11426049Sminshall 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
11526049Sminshall 	{ "dir",	dirhelp,	1,	1,	1,	ls },
11626049Sminshall 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
11726049Sminshall 	{ "form",	formhelp,	0,	1,	1,	setform },
11826049Sminshall 	{ "get",	receivehelp,	1,	1,	1,	get },
11926049Sminshall 	{ "glob",	globhelp,	0,	0,	0,	setglob },
12026049Sminshall 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
12126049Sminshall 	{ "help",	helphelp,	0,	0,	1,	help },
12237224Skarels 	{ "idle",	idlehelp,	0,	1,	1,	idle },
12331180Sbostic 	{ "image",	binaryhelp,	0,	1,	1,	setbinary },
12426049Sminshall 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
12526049Sminshall 	{ "ls",		lshelp,		1,	1,	1,	ls },
12626049Sminshall 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
12726049Sminshall 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
12826049Sminshall 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
12926049Sminshall 	{ "mget",	mgethelp,	1,	1,	1,	mget },
13026049Sminshall 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
13126049Sminshall 	{ "mls",	mlshelp,	1,	1,	1,	mls },
13226049Sminshall 	{ "mode",	modehelp,	0,	1,	1,	setmode },
13336935Skarels 	{ "modtime",	modtimehelp,	0,	1,	1,	modtime },
13426049Sminshall 	{ "mput",	mputhelp,	1,	1,	1,	mput },
13537224Skarels 	{ "newer",	newerhelp,	1,	1,	1,	newer },
13626049Sminshall 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
13736935Skarels 	{ "nlist",	nlisthelp,	1,	1,	1,	ls },
13826049Sminshall 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
13926049Sminshall 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
14026049Sminshall 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
14126049Sminshall 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
14226049Sminshall 	{ "sendport",	porthelp,	0,	0,	0,	setport },
14326049Sminshall 	{ "put",	sendhelp,	1,	1,	1,	put },
14426049Sminshall 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
14526049Sminshall 	{ "quit",	quithelp,	0,	0,	0,	quit },
14626049Sminshall 	{ "quote",	quotehelp,	1,	1,	1,	quote },
14726049Sminshall 	{ "recv",	receivehelp,	1,	1,	1,	get },
14837224Skarels 	{ "reget",	regethelp,	1,	1,	1,	reget },
14936940Skarels 	{ "rstatus",	rmtstatushelp,	0,	1,	1,	rmtstatus },
15036940Skarels 	{ "rhelp",	remotehelp,	0,	1,	1,	rmthelp },
15126049Sminshall 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
15226049Sminshall 	{ "reset",	resethelp,	0,	1,	1,	reset },
15337224Skarels 	{ "restart",	restarthelp,	1,	1,	1,	restart },
15426049Sminshall 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
15526049Sminshall 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
15626049Sminshall 	{ "send",	sendhelp,	1,	1,	1,	put },
15737224Skarels 	{ "site",	sitehelp,	0,	1,	1,	site },
15836935Skarels 	{ "size",	sizecmdhelp,	1,	1,	1,	sizecmd },
15926049Sminshall 	{ "status",	statushelp,	0,	0,	1,	status },
16026049Sminshall 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
16136935Skarels 	{ "system",	systemhelp,	0,	1,	1,	syst },
16226049Sminshall 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
16326049Sminshall 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
16426049Sminshall 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
16526049Sminshall 	{ "type",	typehelp,	0,	1,	1,	settype },
16626049Sminshall 	{ "user",	userhelp,	0,	1,	1,	user },
16737224Skarels 	{ "umask",	umaskhelp,	0,	1,	1,	do_umask },
16826049Sminshall 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
16926049Sminshall 	{ "?",		helphelp,	0,	0,	1,	help },
17011651Ssam 	{ 0 },
17110295Ssam };
17210295Ssam 
17318287Sralph int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
174