xref: /csrg-svn/usr.bin/ftp/cmdtab.c (revision 36942)
121738Sdist /*
2*36942Skarels  * Copyright (c) 1985, 1989 Regents of the University of California.
333737Sbostic  * All rights reserved.
433737Sbostic  *
533737Sbostic  * Redistribution and use in source and binary forms are permitted
634901Sbostic  * provided that the above copyright notice and this paragraph are
734901Sbostic  * duplicated in all such forms and that any documentation,
834901Sbostic  * advertising materials, and other materials related to such
934901Sbostic  * distribution and use acknowledge that the software was developed
1034901Sbostic  * by the University of California, Berkeley.  The name of the
1134901Sbostic  * University may not be used to endorse or promote products derived
1234901Sbostic  * from this software without specific prior written permission.
1334901Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1434901Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1536935Skarels  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1621738Sdist  */
1721738Sdist 
1810295Ssam #ifndef lint
19*36942Skarels static char sccsid[] = "@(#)cmdtab.c	5.8.1.1 (Berkeley) 03/01/89";
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();
31*36942Skarels int	disconnect(), syst();
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();
39*36942Skarels int	sizecmd(), modtime(), rmtstatus();
40*36942Skarels #ifdef RESTART
41*36942Skarels int	restart(), reget(), newer();
42*36942Skarels #endif
4310295Ssam 
4426049Sminshall char	accounthelp[] =	"send account command to remote server";
4511651Ssam char	appendhelp[] =	"append to a file";
4610295Ssam char	asciihelp[] =	"set ascii transfer type";
4710295Ssam char	beephelp[] =	"beep when command completed";
4810295Ssam char	binaryhelp[] =	"set binary transfer type";
4926049Sminshall char	casehelp[] =	"toggle mget upper/lower case id mapping";
5010295Ssam char	cdhelp[] =	"change remote working directory";
5126049Sminshall char	cduphelp[] = 	"change remote working directory to parent directory";
5210295Ssam char	connecthelp[] =	"connect to remote tftp";
5326049Sminshall char	crhelp[] =	"toggle carriage return stripping on ascii gets";
5410295Ssam char	deletehelp[] =	"delete remote file";
5510295Ssam char	debughelp[] =	"toggle/set debugging mode";
5610295Ssam char	dirhelp[] =	"list contents of remote directory";
5710295Ssam char	disconhelp[] =	"terminate ftp session";
5826049Sminshall char	domachelp[] = 	"execute macro";
5910295Ssam char	formhelp[] =	"set file transfer format";
6011350Ssam char	globhelp[] =	"toggle metacharacter expansion of local file names";
6111651Ssam char	hashhelp[] =	"toggle printing `#' for each buffer transferred";
6210295Ssam char	helphelp[] =	"print local help information";
6310295Ssam char	lcdhelp[] =	"change local working directory";
6436935Skarels char	lshelp[] =	"list contents of remote directory";
6526049Sminshall char	macdefhelp[] =  "define a macro";
6611651Ssam char	mdeletehelp[] =	"delete multiple files";
6711757Ssam char	mdirhelp[] =	"list contents of multiple remote directories";
6811350Ssam char	mgethelp[] =	"get multiple files";
6910295Ssam char	mkdirhelp[] =	"make directory on the remote machine";
70*36942Skarels char	mlshelp[] =	"nlist contents of multiple remote directories";
7136935Skarels char	modtimehelp[] = "show last modification time of remote file";
7210295Ssam char	modehelp[] =	"set file transfer mode";
7311350Ssam char	mputhelp[] =	"send multiple files";
74*36942Skarels #ifdef RESTART
7536935Skarels char	newerhelp[] =	"get file if remote file is newer than local file ";
76*36942Skarels #endif
7736935Skarels char	nlisthelp[] =	"nlist contents of remote directory";
7826049Sminshall char	nmaphelp[] =	"set templates for default file name mapping";
7926049Sminshall char	ntranshelp[] =	"set translation table for default file name mapping";
8011651Ssam char	porthelp[] =	"toggle use of PORT cmd for each data connection";
8110295Ssam char	prompthelp[] =	"force interactive prompting on multiple commands";
8226049Sminshall char	proxyhelp[] =	"issue command on alternate connection";
8310295Ssam char	pwdhelp[] =	"print working directory on remote machine";
8410295Ssam char	quithelp[] =	"terminate ftp session and exit";
8510295Ssam char	quotehelp[] =	"send arbitrary ftp command";
8610295Ssam char	receivehelp[] =	"receive file";
87*36942Skarels #ifdef RESTART
8836935Skarels char	regethelp[] =	"get file restarting at end of local file";
89*36942Skarels #endif
9010295Ssam char	remotehelp[] =	"get help from remote server";
9110295Ssam char	renamehelp[] =	"rename file";
92*36942Skarels #ifdef RESTART
9336935Skarels char	restarthelp[]=	"restart file transfer at bytecount";
94*36942Skarels #endif
9510295Ssam char	rmdirhelp[] =	"remove directory on the remote machine";
9636935Skarels char	rmtstatushelp[]="show status of remote machine";
9726049Sminshall char	runiquehelp[] = "toggle store unique for local files";
9826049Sminshall char	resethelp[] =	"clear queued command replies";
9911350Ssam char	sendhelp[] =	"send one file";
10010295Ssam char	shellhelp[] =	"escape to the shell";
10136935Skarels char	sizecmdhelp[] = "show size of remote file";
10210295Ssam char	statushelp[] =	"show current status";
10310295Ssam char	structhelp[] =	"set file transfer structure";
10426049Sminshall char	suniquehelp[] = "toggle store unique on remote machine";
10536935Skarels char	systemhelp[] =  "show remote system type";
10610295Ssam char	tenexhelp[] =	"set tenex file transfer type";
10710295Ssam char	tracehelp[] =	"toggle packet tracing";
10810295Ssam char	typehelp[] =	"set file transfer type";
10910295Ssam char	userhelp[] =	"send new user information";
11010295Ssam char	verbosehelp[] =	"toggle verbose mode";
11110295Ssam 
11210295Ssam struct cmd cmdtab[] = {
11326049Sminshall 	{ "!",		shellhelp,	0,	0,	0,	shell },
11426049Sminshall 	{ "$",		domachelp,	1,	0,	0,	domacro },
11526049Sminshall 	{ "account",	accounthelp,	0,	1,	1,	account},
11626049Sminshall 	{ "append",	appendhelp,	1,	1,	1,	put },
11726049Sminshall 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
11826049Sminshall 	{ "bell",	beephelp,	0,	0,	0,	setbell },
11926049Sminshall 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
12026049Sminshall 	{ "bye",	quithelp,	0,	0,	0,	quit },
12126049Sminshall 	{ "case",	casehelp,	0,	0,	1,	setcase },
12226049Sminshall 	{ "cd",		cdhelp,		0,	1,	1,	cd },
12326049Sminshall 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
12426049Sminshall 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
12526049Sminshall 	{ "cr",		crhelp,		0,	0,	0,	setcr },
12626049Sminshall 	{ "delete",	deletehelp,	0,	1,	1,	delete },
12726049Sminshall 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
12826049Sminshall 	{ "dir",	dirhelp,	1,	1,	1,	ls },
12926049Sminshall 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
13026049Sminshall 	{ "form",	formhelp,	0,	1,	1,	setform },
13126049Sminshall 	{ "get",	receivehelp,	1,	1,	1,	get },
13226049Sminshall 	{ "glob",	globhelp,	0,	0,	0,	setglob },
13326049Sminshall 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
13426049Sminshall 	{ "help",	helphelp,	0,	0,	1,	help },
13531180Sbostic 	{ "image",	binaryhelp,	0,	1,	1,	setbinary },
13626049Sminshall 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
13726049Sminshall 	{ "ls",		lshelp,		1,	1,	1,	ls },
13826049Sminshall 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
13926049Sminshall 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
14026049Sminshall 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
14126049Sminshall 	{ "mget",	mgethelp,	1,	1,	1,	mget },
14226049Sminshall 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
14326049Sminshall 	{ "mls",	mlshelp,	1,	1,	1,	mls },
14426049Sminshall 	{ "mode",	modehelp,	0,	1,	1,	setmode },
14536935Skarels 	{ "modtime",	modtimehelp,	0,	1,	1,	modtime },
14626049Sminshall 	{ "mput",	mputhelp,	1,	1,	1,	mput },
147*36942Skarels #ifdef RESTART
14836935Skarels 	{ "newer",	newerhelp,	1,	1,	1,	newer },
149*36942Skarels #endif
15026049Sminshall 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
15136935Skarels 	{ "nlist",	nlisthelp,	1,	1,	1,	ls },
15226049Sminshall 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
15326049Sminshall 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
15426049Sminshall 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
15526049Sminshall 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
15626049Sminshall 	{ "sendport",	porthelp,	0,	0,	0,	setport },
15726049Sminshall 	{ "put",	sendhelp,	1,	1,	1,	put },
15826049Sminshall 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
15926049Sminshall 	{ "quit",	quithelp,	0,	0,	0,	quit },
16026049Sminshall 	{ "quote",	quotehelp,	1,	1,	1,	quote },
16126049Sminshall 	{ "recv",	receivehelp,	1,	1,	1,	get },
162*36942Skarels 	{ "remotehelp",	remotehelp,	0,	1,	1,	rmthelp },
163*36942Skarels #ifdef RESTART
16436935Skarels 	{ "reget",	regethelp,	1,	1,	1,	reget },
165*36942Skarels #endif
16636940Skarels 	{ "rstatus",	rmtstatushelp,	0,	1,	1,	rmtstatus },
16736940Skarels 	{ "rhelp",	remotehelp,	0,	1,	1,	rmthelp },
16826049Sminshall 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
16926049Sminshall 	{ "reset",	resethelp,	0,	1,	1,	reset },
170*36942Skarels #ifdef RESTART
17136935Skarels 	{ "restart",	restarthelp,	1,	1,	1,	restart },
172*36942Skarels #endif
17326049Sminshall 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
17426049Sminshall 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
17526049Sminshall 	{ "send",	sendhelp,	1,	1,	1,	put },
17636935Skarels 	{ "size",	sizecmdhelp,	1,	1,	1,	sizecmd },
17726049Sminshall 	{ "status",	statushelp,	0,	0,	1,	status },
17826049Sminshall 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
17936935Skarels 	{ "system",	systemhelp,	0,	1,	1,	syst },
18026049Sminshall 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
18126049Sminshall 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
18226049Sminshall 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
18326049Sminshall 	{ "type",	typehelp,	0,	1,	1,	settype },
18426049Sminshall 	{ "user",	userhelp,	0,	1,	1,	user },
18526049Sminshall 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
18626049Sminshall 	{ "?",		helphelp,	0,	0,	1,	help },
18711651Ssam 	{ 0 },
18810295Ssam };
18910295Ssam 
19018287Sralph int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
191