xref: /csrg-svn/usr.bin/ftp/cmdtab.c (revision 67794)
121738Sdist /*
266672Spendry  * Copyright (c) 1985, 1989, 1993, 1994
362009Sbostic  *	The Regents of the University of California.  All rights reserved.
433737Sbostic  *
542665Sbostic  * %sccs.include.redist.c%
621738Sdist  */
721738Sdist 
810295Ssam #ifndef lint
9*67794Smckusick static char sccsid[] = "@(#)cmdtab.c	8.4 (Berkeley) 10/09/94";
1033737Sbostic #endif /* not lint */
1111651Ssam 
1266670Spendry #include <stdio.h>
1310295Ssam #include "ftp_var.h"
1410295Ssam 
1510295Ssam /*
1610295Ssam  * User FTP -- Command Tables.
1710295Ssam  */
1810295Ssam 
1926049Sminshall char	accounthelp[] =	"send account command to remote server";
2011651Ssam char	appendhelp[] =	"append to a file";
2110295Ssam char	asciihelp[] =	"set ascii transfer type";
2210295Ssam char	beephelp[] =	"beep when command completed";
2310295Ssam char	binaryhelp[] =	"set binary transfer type";
2426049Sminshall char	casehelp[] =	"toggle mget upper/lower case id mapping";
2510295Ssam char	cdhelp[] =	"change remote working directory";
2626049Sminshall char	cduphelp[] = 	"change remote working directory to parent directory";
2737224Skarels char	chmodhelp[] =	"change file permissions of remote file";
2810295Ssam char	connecthelp[] =	"connect to remote tftp";
2926049Sminshall char	crhelp[] =	"toggle carriage return stripping on ascii gets";
3010295Ssam char	deletehelp[] =	"delete remote file";
3110295Ssam char	debughelp[] =	"toggle/set debugging mode";
3210295Ssam char	dirhelp[] =	"list contents of remote directory";
3310295Ssam char	disconhelp[] =	"terminate ftp session";
3426049Sminshall char	domachelp[] = 	"execute macro";
3510295Ssam char	formhelp[] =	"set file transfer format";
3611350Ssam char	globhelp[] =	"toggle metacharacter expansion of local file names";
3711651Ssam char	hashhelp[] =	"toggle printing `#' for each buffer transferred";
3810295Ssam char	helphelp[] =	"print local help information";
3937224Skarels char	idlehelp[] =	"get (set) idle timer on remote side";
4010295Ssam char	lcdhelp[] =	"change local working directory";
4136935Skarels char	lshelp[] =	"list contents of remote directory";
4226049Sminshall char	macdefhelp[] =  "define a macro";
4311651Ssam char	mdeletehelp[] =	"delete multiple files";
4411757Ssam char	mdirhelp[] =	"list contents of multiple remote directories";
4511350Ssam char	mgethelp[] =	"get multiple files";
4610295Ssam char	mkdirhelp[] =	"make directory on the remote machine";
4737224Skarels char	mlshelp[] =	"list contents of multiple remote directories";
4836935Skarels char	modtimehelp[] = "show last modification time of remote file";
4910295Ssam char	modehelp[] =	"set file transfer mode";
5011350Ssam char	mputhelp[] =	"send multiple files";
5137224Skarels char	newerhelp[] =	"get file if remote file is newer than local file ";
5236935Skarels char	nlisthelp[] =	"nlist contents of remote directory";
5326049Sminshall char	nmaphelp[] =	"set templates for default file name mapping";
5426049Sminshall char	ntranshelp[] =	"set translation table for default file name mapping";
5511651Ssam char	porthelp[] =	"toggle use of PORT cmd for each data connection";
5610295Ssam char	prompthelp[] =	"force interactive prompting on multiple commands";
5726049Sminshall char	proxyhelp[] =	"issue command on alternate connection";
5810295Ssam char	pwdhelp[] =	"print working directory on remote machine";
5910295Ssam char	quithelp[] =	"terminate ftp session and exit";
6010295Ssam char	quotehelp[] =	"send arbitrary ftp command";
6110295Ssam char	receivehelp[] =	"receive file";
6237224Skarels char	regethelp[] =	"get file restarting at end of local file";
6310295Ssam char	remotehelp[] =	"get help from remote server";
6410295Ssam char	renamehelp[] =	"rename file";
6537224Skarels char	restarthelp[]=	"restart file transfer at bytecount";
6610295Ssam char	rmdirhelp[] =	"remove directory on the remote machine";
6736935Skarels char	rmtstatushelp[]="show status of remote machine";
6826049Sminshall char	runiquehelp[] = "toggle store unique for local files";
6926049Sminshall char	resethelp[] =	"clear queued command replies";
7011350Ssam char	sendhelp[] =	"send one file";
71*67794Smckusick char	passivehelp[] =	"enter passive transfer mode";
7237224Skarels char	sitehelp[] =	"send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
7310295Ssam char	shellhelp[] =	"escape to the shell";
7436935Skarels char	sizecmdhelp[] = "show size of remote file";
7510295Ssam char	statushelp[] =	"show current status";
7610295Ssam char	structhelp[] =	"set file transfer structure";
7726049Sminshall char	suniquehelp[] = "toggle store unique on remote machine";
7836935Skarels char	systemhelp[] =  "show remote system type";
7910295Ssam char	tenexhelp[] =	"set tenex file transfer type";
8010295Ssam char	tracehelp[] =	"toggle packet tracing";
8110295Ssam char	typehelp[] =	"set file transfer type";
8237224Skarels char	umaskhelp[] =	"get (set) umask on remote side";
8310295Ssam char	userhelp[] =	"send new user information";
8410295Ssam char	verbosehelp[] =	"toggle verbose mode";
8510295Ssam 
8610295Ssam struct cmd cmdtab[] = {
8726049Sminshall 	{ "!",		shellhelp,	0,	0,	0,	shell },
8826049Sminshall 	{ "$",		domachelp,	1,	0,	0,	domacro },
8926049Sminshall 	{ "account",	accounthelp,	0,	1,	1,	account},
9026049Sminshall 	{ "append",	appendhelp,	1,	1,	1,	put },
9126049Sminshall 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
9226049Sminshall 	{ "bell",	beephelp,	0,	0,	0,	setbell },
9326049Sminshall 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
9426049Sminshall 	{ "bye",	quithelp,	0,	0,	0,	quit },
9526049Sminshall 	{ "case",	casehelp,	0,	0,	1,	setcase },
9626049Sminshall 	{ "cd",		cdhelp,		0,	1,	1,	cd },
9726049Sminshall 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
9837224Skarels 	{ "chmod",	chmodhelp,	0,	1,	1,	do_chmod },
9926049Sminshall 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
10026049Sminshall 	{ "cr",		crhelp,		0,	0,	0,	setcr },
10126049Sminshall 	{ "delete",	deletehelp,	0,	1,	1,	delete },
10226049Sminshall 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
10326049Sminshall 	{ "dir",	dirhelp,	1,	1,	1,	ls },
10426049Sminshall 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
10526049Sminshall 	{ "form",	formhelp,	0,	1,	1,	setform },
10626049Sminshall 	{ "get",	receivehelp,	1,	1,	1,	get },
10726049Sminshall 	{ "glob",	globhelp,	0,	0,	0,	setglob },
10826049Sminshall 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
10926049Sminshall 	{ "help",	helphelp,	0,	0,	1,	help },
11037224Skarels 	{ "idle",	idlehelp,	0,	1,	1,	idle },
11131180Sbostic 	{ "image",	binaryhelp,	0,	1,	1,	setbinary },
11226049Sminshall 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
11326049Sminshall 	{ "ls",		lshelp,		1,	1,	1,	ls },
11426049Sminshall 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
11526049Sminshall 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
11626049Sminshall 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
11726049Sminshall 	{ "mget",	mgethelp,	1,	1,	1,	mget },
11826049Sminshall 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
11926049Sminshall 	{ "mls",	mlshelp,	1,	1,	1,	mls },
12066670Spendry 	{ "mode",	modehelp,	0,	1,	1,	setftmode },
12136935Skarels 	{ "modtime",	modtimehelp,	0,	1,	1,	modtime },
12226049Sminshall 	{ "mput",	mputhelp,	1,	1,	1,	mput },
12337224Skarels 	{ "newer",	newerhelp,	1,	1,	1,	newer },
12426049Sminshall 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
12536935Skarels 	{ "nlist",	nlisthelp,	1,	1,	1,	ls },
12626049Sminshall 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
12726049Sminshall 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
128*67794Smckusick 	{ "passive",	passivehelp,	0,	0,	0,	setpassive },
12926049Sminshall 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
13026049Sminshall 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
13126049Sminshall 	{ "sendport",	porthelp,	0,	0,	0,	setport },
13226049Sminshall 	{ "put",	sendhelp,	1,	1,	1,	put },
13326049Sminshall 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
13426049Sminshall 	{ "quit",	quithelp,	0,	0,	0,	quit },
13526049Sminshall 	{ "quote",	quotehelp,	1,	1,	1,	quote },
13626049Sminshall 	{ "recv",	receivehelp,	1,	1,	1,	get },
13737224Skarels 	{ "reget",	regethelp,	1,	1,	1,	reget },
13836940Skarels 	{ "rstatus",	rmtstatushelp,	0,	1,	1,	rmtstatus },
13936940Skarels 	{ "rhelp",	remotehelp,	0,	1,	1,	rmthelp },
14026049Sminshall 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
14126049Sminshall 	{ "reset",	resethelp,	0,	1,	1,	reset },
14237224Skarels 	{ "restart",	restarthelp,	1,	1,	1,	restart },
14326049Sminshall 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
14426049Sminshall 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
14526049Sminshall 	{ "send",	sendhelp,	1,	1,	1,	put },
14637224Skarels 	{ "site",	sitehelp,	0,	1,	1,	site },
14736935Skarels 	{ "size",	sizecmdhelp,	1,	1,	1,	sizecmd },
14826049Sminshall 	{ "status",	statushelp,	0,	0,	1,	status },
14926049Sminshall 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
15036935Skarels 	{ "system",	systemhelp,	0,	1,	1,	syst },
15126049Sminshall 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
15226049Sminshall 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
15326049Sminshall 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
15426049Sminshall 	{ "type",	typehelp,	0,	1,	1,	settype },
15526049Sminshall 	{ "user",	userhelp,	0,	1,	1,	user },
15637224Skarels 	{ "umask",	umaskhelp,	0,	1,	1,	do_umask },
15726049Sminshall 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
15826049Sminshall 	{ "?",		helphelp,	0,	0,	1,	help },
15911651Ssam 	{ 0 },
16010295Ssam };
16110295Ssam 
16218287Sralph int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
163