xref: /reactos/base/applications/network/ftp/cmdtab.c (revision c2c66aff)
1 /*
2  * Copyright (c) 1985, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  */
17 
18 #include "precomp.h"
19 
20 #ifndef lint
21 static char sccsid[] = "@(#)cmdtab.c	5.9 (Berkeley) 3/21/89";
22 #endif /* not lint */
23 
24 /*
25  * User FTP -- Command Tables.
26  */
27 
28 char	accounthelp[] =	"send account command to remote server";
29 char	appendhelp[] =	"append to a file";
30 char	asciihelp[] =	"set ascii transfer type";
31 char	beephelp[] =	"beep when command completed";
32 char	binaryhelp[] =	"set binary transfer type";
33 char	casehelp[] =	"toggle mget upper/lower case id mapping";
34 char	cdhelp[] =	"change remote working directory";
35 char	cduphelp[] = 	"change remote working directory to parent directory";
36 char	chmodhelp[] =	"change file permissions of remote file";
37 char	connecthelp[] =	"connect to remote tftp";
38 char	crhelp[] =	"toggle carriage return stripping on ascii gets";
39 char	deletehelp[] =	"delete remote file";
40 char	debughelp[] =	"toggle/set debugging mode";
41 char	dirhelp[] =	"list contents of remote directory";
42 char	disconhelp[] =	"terminate ftp session";
43 char	domachelp[] = 	"execute macro";
44 char	formhelp[] =	"set file transfer format";
45 char	globhelp[] =	"toggle metacharacter expansion of local file names";
46 char	hashhelp[] =	"toggle printing `#' for each buffer transferred";
47 char	helphelp[] =	"print local help information";
48 char	idlehelp[] =	"get (set) idle timer on remote side";
49 char	lcdhelp[] =	"change local working directory";
50 char	lshelp[] =	"list contents of remote directory";
51 char	macdefhelp[] =  "define a macro";
52 char	mdeletehelp[] =	"delete multiple files";
53 char	mdirhelp[] =	"list contents of multiple remote directories";
54 char	mgethelp[] =	"get multiple files";
55 char	mkdirhelp[] =	"make directory on the remote machine";
56 char	mlshelp[] =	"list contents of multiple remote directories";
57 char	modtimehelp[] = "show last modification time of remote file";
58 char	modehelp[] =	"set file transfer mode";
59 char	mputhelp[] =	"send multiple files";
60 char	newerhelp[] =	"get file if remote file is newer than local file ";
61 char	nlisthelp[] =	"nlist contents of remote directory";
62 char	nmaphelp[] =	"set templates for default file name mapping";
63 char	ntranshelp[] =	"set translation table for default file name mapping";
64 char	porthelp[] =	"toggle use of PORT cmd for each data connection";
65 char	prompthelp[] =	"force interactive prompting on multiple commands";
66 char	proxyhelp[] =	"issue command on alternate connection";
67 char	pwdhelp[] =	"print working directory on remote machine";
68 char	quithelp[] =	"terminate ftp session and exit";
69 char	quotehelp[] =	"send arbitrary ftp command";
70 char	receivehelp[] =	"receive file";
71 char	regethelp[] =	"get file restarting at end of local file";
72 char	remotehelp[] =	"get help from remote server";
73 char	renamehelp[] =	"rename file";
74 char	restarthelp[]=	"restart file transfer at bytecount";
75 char	rmdirhelp[] =	"remove directory on the remote machine";
76 char	rmtstatushelp[]="show status of remote machine";
77 char	runiquehelp[] = "toggle store unique for local files";
78 char	resethelp[] =	"clear queued command replies";
79 char	sendhelp[] =	"send one file";
80 char    passivehelp[] = "enter passive transfer mode";
81 char	sitehelp[] =	"send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
82 char	shellhelp[] =	"escape to the shell";
83 char	sizecmdhelp[] = "show size of remote file";
84 char	statushelp[] =	"show current status";
85 char	structhelp[] =	"set file transfer structure";
86 char	suniquehelp[] = "toggle store unique on remote machine";
87 char	systemhelp[] =  "show remote system type";
88 char	tenexhelp[] =	"set tenex file transfer type";
89 char	tracehelp[] =	"toggle packet tracing";
90 char	typehelp[] =	"set file transfer type";
91 char	umaskhelp[] =	"get (set) umask on remote side";
92 char	userhelp[] =	"send new user information";
93 char	verbosehelp[] =	"toggle verbose mode";
94 
95 struct cmd cmdtab[] = {
96 	{ "!",		shellhelp,	0,	0,	0,	shell },
97 	{ "$",		domachelp,	1,	0,	0,	domacro },
98 	{ "account",	accounthelp,	0,	1,	1,	account},
99 	{ "append",	appendhelp,	1,	1,	1,	put },
100 	{ "ascii",	asciihelp,	0,	1,	1,	setascii },
101 	{ "bell",	beephelp,	0,	0,	0,	setbell },
102 	{ "binary",	binaryhelp,	0,	1,	1,	setbinary },
103 	{ "bye",	quithelp,	0,	0,	0,	quit },
104 	{ "case",	casehelp,	0,	0,	1,	setcase },
105 	{ "cd",		cdhelp,		0,	1,	1,	cd },
106 	{ "cdup",	cduphelp,	0,	1,	1,	cdup },
107 	{ "chmod",	chmodhelp,	0,	1,	1,	do_chmod },
108 	{ "close",	disconhelp,	0,	1,	1,	disconnect },
109 	{ "cr",		crhelp,		0,	0,	0,	setcr },
110 	{ "delete",	deletehelp,	0,	1,	1,	delete },
111 	{ "debug",	debughelp,	0,	0,	0,	setdebug },
112 	{ "dir",	dirhelp,	1,	1,	1,	ls },
113 	{ "disconnect",	disconhelp,	0,	1,	1,	disconnect },
114 	{ "form",	formhelp,	0,	1,	1,	setform },
115 	{ "get",	receivehelp,	1,	1,	1,	get },
116 	{ "glob",	globhelp,	0,	0,	0,	setglob },
117 	{ "hash",	hashhelp,	0,	0,	0,	sethash },
118 	{ "help",	helphelp,	0,	0,	1,	help },
119 	{ "idle",	idlehelp,	0,	1,	1,	idle },
120 	{ "image",	binaryhelp,	0,	1,	1,	setbinary },
121 	{ "lcd",	lcdhelp,	0,	0,	0,	lcd },
122 	{ "ls",		lshelp,		1,	1,	1,	ls },
123 	{ "macdef",	macdefhelp,	0,	0,	0,	macdef },
124 	{ "mdelete",	mdeletehelp,	1,	1,	1,	mdelete },
125 	{ "mdir",	mdirhelp,	1,	1,	1,	mls },
126 	{ "mget",	mgethelp,	1,	1,	1,	mget },
127 	{ "mkdir",	mkdirhelp,	0,	1,	1,	makedir },
128 	{ "mls",	mlshelp,	1,	1,	1,	mls },
129 	{ "mode",	modehelp,	0,	1,	1,	fsetmode },
130 	{ "modtime",	modtimehelp,	0,	1,	1,	modtime },
131 	{ "mput",	mputhelp,	1,	1,	1,	mput },
132 	{ "newer",	newerhelp,	1,	1,	1,	newer },
133 	{ "nmap",	nmaphelp,	0,	0,	1,	setnmap },
134 	{ "nlist",	nlisthelp,	1,	1,	1,	ls },
135 	{ "ntrans",	ntranshelp,	0,	0,	1,	setntrans },
136 	{ "open",	connecthelp,	0,	0,	1,	setpeer },
137     { "passive",passivehelp,0,  0,  0,  setpassive },
138 	{ "prompt",	prompthelp,	0,	0,	0,	setprompt },
139 	{ "proxy",	proxyhelp,	0,	0,	1,	doproxy },
140 	{ "sendport",	porthelp,	0,	0,	0,	setport },
141 	{ "put",	sendhelp,	1,	1,	1,	put },
142 	{ "pwd",	pwdhelp,	0,	1,	1,	pwd },
143 	{ "quit",	quithelp,	0,	0,	0,	quit },
144 	{ "quote",	quotehelp,	1,	1,	1,	quote },
145 	{ "recv",	receivehelp,	1,	1,	1,	get },
146 	{ "reget",	regethelp,	1,	1,	1,	reget },
147 	{ "rstatus",	rmtstatushelp,	0,	1,	1,	rmtstatus },
148 	{ "rhelp",	remotehelp,	0,	1,	1,	rmthelp },
149 	{ "rename",	renamehelp,	0,	1,	1,	renamefile },
150 	{ "reset",	resethelp,	0,	1,	1,	reset },
151 	{ "restart",	restarthelp,	1,	1,	1,	restart },
152 	{ "rmdir",	rmdirhelp,	0,	1,	1,	removedir },
153 	{ "runique",	runiquehelp,	0,	0,	1,	setrunique },
154 	{ "send",	sendhelp,	1,	1,	1,	put },
155 	{ "site",	sitehelp,	0,	1,	1,	site },
156 	{ "size",	sizecmdhelp,	1,	1,	1,	sizecmd },
157 	{ "status",	statushelp,	0,	0,	1,	status },
158 	{ "struct",	structhelp,	0,	1,	1,	setstruct },
159 	{ "system",	systemhelp,	0,	1,	1,	syst },
160 	{ "sunique",	suniquehelp,	0,	0,	1,	setsunique },
161 	{ "tenex",	tenexhelp,	0,	1,	1,	settenex },
162 	{ "trace",	tracehelp,	0,	0,	0,	settrace },
163 	{ "type",	typehelp,	0,	1,	1,	settype },
164 	{ "user",	userhelp,	0,	1,	1,	user },
165 	{ "umask",	umaskhelp,	0,	1,	1,	do_umask },
166 	{ "verbose",	verbosehelp,	0,	0,	0,	setverbose },
167 	{ "?",		helphelp,	0,	0,	1,	help },
168 	{ 0 },
169 };
170 
171 int	NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
172