xref: /csrg-svn/usr.bin/ftp/cmdtab.c (revision 34901)
121738Sdist /*
226049Sminshall  * Copyright (c) 1985 Regents of the University of California.
333737Sbostic  * All rights reserved.
433737Sbostic  *
533737Sbostic  * Redistribution and use in source and binary forms are permitted
6*34901Sbostic  * provided that the above copyright notice and this paragraph are
7*34901Sbostic  * duplicated in all such forms and that any documentation,
8*34901Sbostic  * advertising materials, and other materials related to such
9*34901Sbostic  * distribution and use acknowledge that the software was developed
10*34901Sbostic  * by the University of California, Berkeley.  The name of the
11*34901Sbostic  * University may not be used to endorse or promote products derived
12*34901Sbostic  * from this software without specific prior written permission.
13*34901Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*34901Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*34901Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1621738Sdist  */
1721738Sdist 
1810295Ssam #ifndef lint
19*34901Sbostic static char sccsid[] = "@(#)cmdtab.c	5.6 (Berkeley) 06/29/88";
2033737Sbostic #endif /* not lint */
2111651Ssam 
2210295Ssam #include "ftp_var.h"
2310295Ssam 
2410295Ssam /*
2510295Ssam  * User FTP -- Command Tables.
2610295Ssam  */
2710295Ssam int	setascii(), setbell(), setbinary(), setdebug(), setform();
2814144Ssam int	setglob(), sethash(), setmode(), setpeer(), setport();
2911651Ssam int	setprompt(), setstruct();
3011350Ssam int	settenex(), settrace(), settype(), setverbose();
3110295Ssam int	disconnect();
3211651Ssam int	cd(), lcd(), delete(), mdelete(), user();
3311757Ssam int	ls(), mls(), get(), mget(), help(), append(), put(), mput();
3410295Ssam int	quit(), renamefile(), status();
3510295Ssam int	quote(), rmthelp(), shell();
3626049Sminshall int	pwd(), makedir(), removedir(), setcr();
3726049Sminshall int	account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
3826049Sminshall int	setsunique(), setrunique(), cdup(), macdef(), domacro();
3910295Ssam 
4026049Sminshall char	accounthelp[] =	"send account command to remote server";
4111651Ssam char	appendhelp[] =	"append to a file";
4210295Ssam char	asciihelp[] =	"set ascii transfer type";
4310295Ssam char	beephelp[] =	"beep when command completed";
4410295Ssam char	binaryhelp[] =	"set binary transfer type";
4526049Sminshall char	casehelp[] =	"toggle mget upper/lower case id mapping";
4610295Ssam char	cdhelp[] =	"change remote working directory";
4726049Sminshall char	cduphelp[] = 	"change remote working directory to parent directory";
4810295Ssam char	connecthelp[] =	"connect to remote tftp";
4926049Sminshall char	crhelp[] =	"toggle carriage return stripping on ascii gets";
5010295Ssam char	deletehelp[] =	"delete remote file";
5110295Ssam char	debughelp[] =	"toggle/set debugging mode";
5210295Ssam char	dirhelp[] =	"list contents of remote directory";
5310295Ssam char	disconhelp[] =	"terminate ftp session";
5426049Sminshall char	domachelp[] = 	"execute macro";
5510295Ssam char	formhelp[] =	"set file transfer format";
5611350Ssam char	globhelp[] =	"toggle metacharacter expansion of local file names";
5711651Ssam char	hashhelp[] =	"toggle printing `#' for each buffer transferred";
5810295Ssam char	helphelp[] =	"print local help information";
5910295Ssam char	lcdhelp[] =	"change local working directory";
6010295Ssam char	lshelp[] =	"nlist contents of remote directory";
6126049Sminshall char	macdefhelp[] =  "define a macro";
6211651Ssam char	mdeletehelp[] =	"delete multiple files";
6311757Ssam char	mdirhelp[] =	"list contents of multiple remote directories";
6411350Ssam char	mgethelp[] =	"get multiple files";
6510295Ssam char	mkdirhelp[] =	"make directory on the remote machine";
6611757Ssam char	mlshelp[] =	"nlist contents of multiple remote directories";
6710295Ssam char	modehelp[] =	"set file transfer mode";
6811350Ssam char	mputhelp[] =	"send multiple files";
6926049Sminshall char	nmaphelp[] =	"set templates for default file name mapping";
7026049Sminshall char	ntranshelp[] =	"set translation table for default file name mapping";
7111651Ssam char	porthelp[] =	"toggle use of PORT cmd for each data connection";
7210295Ssam char	prompthelp[] =	"force interactive prompting on multiple commands";
7326049Sminshall char	proxyhelp[] =	"issue command on alternate connection";
7410295Ssam char	pwdhelp[] =	"print working directory on remote machine";
7510295Ssam char	quithelp[] =	"terminate ftp session and exit";
7610295Ssam char	quotehelp[] =	"send arbitrary ftp command";
7710295Ssam char	receivehelp[] =	"receive file";
7810295Ssam char	remotehelp[] =	"get help from remote server";
7910295Ssam char	renamehelp[] =	"rename file";
8010295Ssam char	rmdirhelp[] =	"remove directory on the remote machine";
8126049Sminshall char	runiquehelp[] = "toggle store unique for local files";
8226049Sminshall char	resethelp[] =	"clear queued command replies";
8311350Ssam char	sendhelp[] =	"send one file";
8410295Ssam char	shellhelp[] =	"escape to the shell";
8510295Ssam char	statushelp[] =	"show current status";
8610295Ssam char	structhelp[] =	"set file transfer structure";
8726049Sminshall char	suniquehelp[] = "toggle store unique on remote machine";
8810295Ssam char	tenexhelp[] =	"set tenex file transfer type";
8910295Ssam char	tracehelp[] =	"toggle packet tracing";
9010295Ssam char	typehelp[] =	"set file transfer type";
9110295Ssam char	userhelp[] =	"send new user information";
9210295Ssam char	verbosehelp[] =	"toggle verbose mode";
9310295Ssam 
9410295Ssam struct cmd cmdtab[] = {
9526049Sminshall 	{ "!",		shellhelp,	0,	0,	0,	shell },
9626049Sminshall 	{ "$",		domachelp,	1,	0,	0,	domacro },
9726049Sminshall 	{ "account",	accounthelp,	0,	1,	1,	account},
9826049Sminshall 	{ "append",	appendhelp,	1,	1,	1,	put },
9926049Sminshall 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
10026049Sminshall 	{ "bell",	beephelp,	0,	0,	0,	setbell },
10126049Sminshall 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
10226049Sminshall 	{ "bye",	quithelp,	0,	0,	0,	quit },
10326049Sminshall 	{ "case",	casehelp,	0,	0,	1,	setcase },
10426049Sminshall 	{ "cd",		cdhelp,		0,	1,	1,	cd },
10526049Sminshall 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
10626049Sminshall 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
10726049Sminshall 	{ "cr",		crhelp,		0,	0,	0,	setcr },
10826049Sminshall 	{ "delete",	deletehelp,	0,	1,	1,	delete },
10926049Sminshall 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
11026049Sminshall 	{ "dir",	dirhelp,	1,	1,	1,	ls },
11126049Sminshall 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
11226049Sminshall 	{ "form",	formhelp,	0,	1,	1,	setform },
11326049Sminshall 	{ "get",	receivehelp,	1,	1,	1,	get },
11426049Sminshall 	{ "glob",	globhelp,	0,	0,	0,	setglob },
11526049Sminshall 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
11626049Sminshall 	{ "help",	helphelp,	0,	0,	1,	help },
11731180Sbostic 	{ "image",	binaryhelp,	0,	1,	1,	setbinary },
11826049Sminshall 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
11926049Sminshall 	{ "ls",		lshelp,		1,	1,	1,	ls },
12026049Sminshall 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
12126049Sminshall 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
12226049Sminshall 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
12326049Sminshall 	{ "mget",	mgethelp,	1,	1,	1,	mget },
12426049Sminshall 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
12526049Sminshall 	{ "mls",	mlshelp,	1,	1,	1,	mls },
12626049Sminshall 	{ "mode",	modehelp,	0,	1,	1,	setmode },
12726049Sminshall 	{ "mput",	mputhelp,	1,	1,	1,	mput },
12826049Sminshall 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
12926049Sminshall 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
13026049Sminshall 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
13126049Sminshall 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
13226049Sminshall 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
13326049Sminshall 	{ "sendport",	porthelp,	0,	0,	0,	setport },
13426049Sminshall 	{ "put",	sendhelp,	1,	1,	1,	put },
13526049Sminshall 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
13626049Sminshall 	{ "quit",	quithelp,	0,	0,	0,	quit },
13726049Sminshall 	{ "quote",	quotehelp,	1,	1,	1,	quote },
13826049Sminshall 	{ "recv",	receivehelp,	1,	1,	1,	get },
13926049Sminshall 	{ "remotehelp",	remotehelp,	0,	1,	1,	rmthelp },
14026049Sminshall 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
14126049Sminshall 	{ "reset",	resethelp,	0,	1,	1,	reset },
14226049Sminshall 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
14326049Sminshall 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
14426049Sminshall 	{ "send",	sendhelp,	1,	1,	1,	put },
14526049Sminshall 	{ "status",	statushelp,	0,	0,	1,	status },
14626049Sminshall 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
14726049Sminshall 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
14826049Sminshall 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
14926049Sminshall 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
15026049Sminshall 	{ "type",	typehelp,	0,	1,	1,	settype },
15126049Sminshall 	{ "user",	userhelp,	0,	1,	1,	user },
15226049Sminshall 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
15326049Sminshall 	{ "?",		helphelp,	0,	0,	1,	help },
15411651Ssam 	{ 0 },
15510295Ssam };
15610295Ssam 
15718287Sralph int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
158