xref: /onnv-gate/usr/src/cmd/cmd-inet/usr.bin/ftp/cmdtab.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  *	Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  *	Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28*0Sstevel@tonic-gate /*	All Rights Reserved  	*/
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate /*
31*0Sstevel@tonic-gate  *	University Copyright- Copyright (c) 1982, 1986, 1988
32*0Sstevel@tonic-gate  *	The Regents of the University of California
33*0Sstevel@tonic-gate  *	All Rights Reserved
34*0Sstevel@tonic-gate  *
35*0Sstevel@tonic-gate  *	University Acknowledgment- Portions of this document are derived from
36*0Sstevel@tonic-gate  *	software developed by the University of California, Berkeley, and its
37*0Sstevel@tonic-gate  *	contributors.
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate #include "ftp_var.h"
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * User FTP -- Command Tables.
46*0Sstevel@tonic-gate  */
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate static char	accounthelp[] =	"send account command to remote server";
49*0Sstevel@tonic-gate static char	appendhelp[] =	"append to a file";
50*0Sstevel@tonic-gate static char	asciihelp[] =	"set ascii transfer type";
51*0Sstevel@tonic-gate static char	beephelp[] =	"beep when command completed";
52*0Sstevel@tonic-gate static char	binaryhelp[] =	"set binary transfer type";
53*0Sstevel@tonic-gate static char	casehelp[] =	"toggle mget upper/lower case id mapping";
54*0Sstevel@tonic-gate static char	ccchelp[] =	"set clear protection level for commands";
55*0Sstevel@tonic-gate static char	cdhelp[] =	"change remote working directory";
56*0Sstevel@tonic-gate static char	cduphelp[] = 	"change remote working directory to parent "
57*0Sstevel@tonic-gate 				"directory";
58*0Sstevel@tonic-gate static char	clearhelp[] =	"set clear protection level for data";
59*0Sstevel@tonic-gate static char	connecthelp[] =	"connect to remote tftp";
60*0Sstevel@tonic-gate static char	crhelp[] =	"toggle carriage return stripping on ascii "
61*0Sstevel@tonic-gate 				"gets";
62*0Sstevel@tonic-gate static char	deletehelp[] =	"delete remote file";
63*0Sstevel@tonic-gate static char	debughelp[] =	"toggle/set debugging mode";
64*0Sstevel@tonic-gate static char	dirhelp[] =	"list contents of remote directory";
65*0Sstevel@tonic-gate static char	disconhelp[] =	"terminate ftp session";
66*0Sstevel@tonic-gate static char	domachelp[] = 	"execute macro";
67*0Sstevel@tonic-gate static char	formhelp[] =	"set file transfer format";
68*0Sstevel@tonic-gate static char	globhelp[] =	"toggle metacharacter expansion of local file "
69*0Sstevel@tonic-gate 				"names";
70*0Sstevel@tonic-gate static char	hashhelp[] =	"toggle printing `#' for each buffer "
71*0Sstevel@tonic-gate 				"transferred";
72*0Sstevel@tonic-gate static char	helphelp[] =	"print local help information";
73*0Sstevel@tonic-gate static char	lcdhelp[] =	"change local working directory";
74*0Sstevel@tonic-gate static char	lshelp[] =	"display contents of remote directory";
75*0Sstevel@tonic-gate static char	macdefhelp[] =  "define a macro";
76*0Sstevel@tonic-gate static char	mdeletehelp[] =	"delete multiple files";
77*0Sstevel@tonic-gate static char	mdirhelp[] =	"list contents of multiple remote directories";
78*0Sstevel@tonic-gate static char	mechhelp[] =	"set mechanism type";
79*0Sstevel@tonic-gate static char	mgethelp[] =	"get multiple files";
80*0Sstevel@tonic-gate static char	mkdirhelp[] =	"make directory on the remote machine";
81*0Sstevel@tonic-gate static char	mlshelp[] =	"nlist contents of multiple remote directories";
82*0Sstevel@tonic-gate static char	modehelp[] =	"set file transfer mode";
83*0Sstevel@tonic-gate static char	mputhelp[] =	"send multiple files";
84*0Sstevel@tonic-gate static char	nlisthelp[] =	"nlist contents of remote directory";
85*0Sstevel@tonic-gate static char	nmaphelp[] =	"set templates for default file name mapping";
86*0Sstevel@tonic-gate static char	ntranshelp[] =	"set translation table for default file name "
87*0Sstevel@tonic-gate 				"mapping";
88*0Sstevel@tonic-gate static char	passivehelp[] =	"toggle passive transfer mode";
89*0Sstevel@tonic-gate static char	porthelp[] =	"toggle use of PORT cmd for each data "
90*0Sstevel@tonic-gate 				"connection";
91*0Sstevel@tonic-gate static char	privatehelp[] =	"set private protection level for data";
92*0Sstevel@tonic-gate static char	prompthelp[] =	"force interactive prompting on multiple "
93*0Sstevel@tonic-gate 				"commands";
94*0Sstevel@tonic-gate static char	protecthelp[] =	"set protection level for data";
95*0Sstevel@tonic-gate static char	proxyhelp[] =	"issue command on alternate connection";
96*0Sstevel@tonic-gate static char	pwdhelp[] =	"print working directory on remote machine";
97*0Sstevel@tonic-gate static char	quithelp[] =	"terminate ftp session and exit";
98*0Sstevel@tonic-gate static char	quotehelp[] =	"send arbitrary ftp command";
99*0Sstevel@tonic-gate static char	receivehelp[] =	"receive file";
100*0Sstevel@tonic-gate static char	regethelp[] =	"get file restarting at end of local file";
101*0Sstevel@tonic-gate static char	remotehelp[] =	"get help from remote server";
102*0Sstevel@tonic-gate static char	renamehelp[] =	"rename file";
103*0Sstevel@tonic-gate static char	resethelp[] =	"clear queued command replies";
104*0Sstevel@tonic-gate static char	restarthelp[] =	"restart file transfer at bytecount";
105*0Sstevel@tonic-gate static char	rmdirhelp[] =	"remove directory on the remote machine";
106*0Sstevel@tonic-gate static char	runiquehelp[] = "toggle store unique for local files";
107*0Sstevel@tonic-gate static char	safehelp[] =	"set safe protection level for data";
108*0Sstevel@tonic-gate static char	sendhelp[] =	"send one file";
109*0Sstevel@tonic-gate static char	shellhelp[] =	"escape to the shell";
110*0Sstevel@tonic-gate static char	sitehelp[] =	"send site specific command to remote server\n"
111*0Sstevel@tonic-gate 				"\t\tTry \"remotehelp site\" or \"site help\" "
112*0Sstevel@tonic-gate 				"for more information";
113*0Sstevel@tonic-gate static char	statushelp[] =	"show current status";
114*0Sstevel@tonic-gate static char	structhelp[] =	"set file transfer structure";
115*0Sstevel@tonic-gate static char	suniquehelp[] = "toggle store unique on remote machine";
116*0Sstevel@tonic-gate static char	tenexhelp[] =	"set tenex file transfer type";
117*0Sstevel@tonic-gate static char	tracehelp[] =	"toggle packet tracing";
118*0Sstevel@tonic-gate static char	typehelp[] =	"set file transfer type";
119*0Sstevel@tonic-gate static char	userhelp[] =	"send new user information";
120*0Sstevel@tonic-gate static char	verbosehelp[] =	"toggle verbose mode";
121*0Sstevel@tonic-gate static char	windowhelp[] =	"set TCP window size for the data connection";
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate /*
124*0Sstevel@tonic-gate  * NOTE : The BUFSIZE defined in ftp_var.h includes MAXCMDLEN chars to
125*0Sstevel@tonic-gate  * accomodate the longest command in the cmdtab[] defined below.
126*0Sstevel@tonic-gate  * If anyone plans to add a new command that is longer than the MAXCMDLEN
127*0Sstevel@tonic-gate  * make sure to update it in ftp_var.h.
128*0Sstevel@tonic-gate  */
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate struct cmd cmdtab[] = {
131*0Sstevel@tonic-gate 	{ "!",		shellhelp,	0,	0,	0,	shell },
132*0Sstevel@tonic-gate 	{ "$",		domachelp,	1,	0,	0,	domacro },
133*0Sstevel@tonic-gate 	{ "account",	accounthelp,	0,	1,	1,	account},
134*0Sstevel@tonic-gate 	{ "append",	appendhelp,	1,	1,	1,	put },
135*0Sstevel@tonic-gate 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
136*0Sstevel@tonic-gate 	{ "bell",	beephelp,	0,	0,	0,	setbell },
137*0Sstevel@tonic-gate 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
138*0Sstevel@tonic-gate 	{ "bye",	quithelp,	0,	0,	0,	quit },
139*0Sstevel@tonic-gate 	{ "case",	casehelp,	0,	0,	1,	setcase },
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate 	{ "ccc",	ccchelp,	0,	1,	1,	ccc },
142*0Sstevel@tonic-gate 
143*0Sstevel@tonic-gate 	{ "cd",		cdhelp,		0,	1,	1,	cd },
144*0Sstevel@tonic-gate 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate 	{ "clear",	clearhelp,	0,	1,	1,	setclear },
147*0Sstevel@tonic-gate 
148*0Sstevel@tonic-gate 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
149*0Sstevel@tonic-gate 	{ "cr",		crhelp,		0,	0,	0,	setcr },
150*0Sstevel@tonic-gate 	{ "delete",	deletehelp,	0,	1,	1,	delete },
151*0Sstevel@tonic-gate 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
152*0Sstevel@tonic-gate 	{ "dir",	dirhelp,	1,	1,	1,	ls },
153*0Sstevel@tonic-gate 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
154*0Sstevel@tonic-gate 	{ "form",	formhelp,	0,	1,	1,	setform },
155*0Sstevel@tonic-gate 	{ "get",	receivehelp,	1,	1,	1,	get },
156*0Sstevel@tonic-gate 	{ "glob",	globhelp,	0,	0,	0,	setglob },
157*0Sstevel@tonic-gate 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
158*0Sstevel@tonic-gate 	{ "help",	helphelp,	0,	0,	1,	help },
159*0Sstevel@tonic-gate 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
160*0Sstevel@tonic-gate 	{ "ls",		lshelp,		1,	1,	1,	ls },
161*0Sstevel@tonic-gate 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
162*0Sstevel@tonic-gate 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
163*0Sstevel@tonic-gate 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
164*0Sstevel@tonic-gate 
165*0Sstevel@tonic-gate 	{ "mechanism",	mechhelp,	1,	0,	1,	setmech },
166*0Sstevel@tonic-gate 
167*0Sstevel@tonic-gate 	{ "mget",	mgethelp,	1,	1,	1,	mget },
168*0Sstevel@tonic-gate 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
169*0Sstevel@tonic-gate 	{ "mls",	mlshelp,	1,	1,	1,	mls },
170*0Sstevel@tonic-gate 	{ "mode",	modehelp,	0,	1,	1,	setmode },
171*0Sstevel@tonic-gate 	{ "mput",	mputhelp,	1,	1,	1,	mput },
172*0Sstevel@tonic-gate 	{ "nlist",	nlisthelp,	1,	1,	1,	ls },
173*0Sstevel@tonic-gate 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
174*0Sstevel@tonic-gate 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
175*0Sstevel@tonic-gate 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
176*0Sstevel@tonic-gate 	{ "passive",	passivehelp,	0,	0,	0,	setpassive },
177*0Sstevel@tonic-gate 
178*0Sstevel@tonic-gate 	{ "private",	privatehelp,	0,	1,	1,	setprivate },
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
181*0Sstevel@tonic-gate 
182*0Sstevel@tonic-gate 	{ "protect",	protecthelp,	0,	1,	1,	setdlevel },
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
185*0Sstevel@tonic-gate 	{ "put",	sendhelp,	1,	1,	1,	put },
186*0Sstevel@tonic-gate 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
187*0Sstevel@tonic-gate 	{ "quit",	quithelp,	0,	0,	0,	quit },
188*0Sstevel@tonic-gate 	{ "quote",	quotehelp,	1,	1,	1,	quote },
189*0Sstevel@tonic-gate 	{ "recv",	receivehelp,	1,	1,	1,	get },
190*0Sstevel@tonic-gate 	{ "reget",	regethelp,	1,	1,	1,	reget },
191*0Sstevel@tonic-gate 	{ "remotehelp",	remotehelp,	0,	1,	1,	rmthelp },
192*0Sstevel@tonic-gate 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
193*0Sstevel@tonic-gate 	{ "reset",	resethelp,	0,	1,	1,	reset },
194*0Sstevel@tonic-gate 	{ "restart",	restarthelp,	1,	1,	1,	restart },
195*0Sstevel@tonic-gate 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
196*0Sstevel@tonic-gate 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
197*0Sstevel@tonic-gate 
198*0Sstevel@tonic-gate 	{ "safe",	safehelp,	0,	1,	1,	setsafe },
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate 	{ "send",	sendhelp,	1,	1,	1,	put },
201*0Sstevel@tonic-gate 	{ "sendport",	porthelp,	0,	0,	0,	setport },
202*0Sstevel@tonic-gate 	{ "site",	sitehelp,	0,	1,	1,	site },
203*0Sstevel@tonic-gate 	{ "status",	statushelp,	0,	0,	1,	status },
204*0Sstevel@tonic-gate 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
205*0Sstevel@tonic-gate 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
206*0Sstevel@tonic-gate 	{ "tcpwindow",	windowhelp,	0,	0,	0,	settcpwindow },
207*0Sstevel@tonic-gate 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
208*0Sstevel@tonic-gate 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
209*0Sstevel@tonic-gate 	{ "type",	typehelp,	0,	1,	1,	settype },
210*0Sstevel@tonic-gate 	{ "user",	userhelp,	0,	1,	1,	user },
211*0Sstevel@tonic-gate 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
212*0Sstevel@tonic-gate 	{ "?",		helphelp,	0,	0,	1,	help },
213*0Sstevel@tonic-gate 	{ 0 },
214*0Sstevel@tonic-gate };
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
217