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