386BSD 0.1 development
[unix-history] / usr / src / usr.bin / ftp / cmdtab.c
CommitLineData
f54c1094
WJ
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, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35static char sccsid[] = "@(#)cmdtab.c 5.10 (Berkeley) 6/1/90";
36#endif /* not lint */
37
38#include "ftp_var.h"
39
40/*
41 * User FTP -- Command Tables.
42 */
43int setascii(), setbell(), setbinary(), setdebug(), setform();
44int setglob(), sethash(), setmode(), setpeer(), setport();
45int setprompt(), setstruct();
46int settenex(), settrace(), settype(), setverbose();
47int disconnect(), restart(), reget(), syst();
48int cd(), lcd(), delete(), mdelete(), user();
49int ls(), mls(), get(), mget(), help(), append(), put(), mput();
50int quit(), renamefile(), status();
51int quote(), rmthelp(), shell(), site();
52int pwd(), makedir(), removedir(), setcr();
53int account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
54int setsunique(), setrunique(), cdup(), macdef(), domacro();
55int sizecmd(), modtime(), newer(), rmtstatus();
56int do_chmod(), do_umask(), idle();
57
58char accounthelp[] = "send account command to remote server";
59char appendhelp[] = "append to a file";
60char asciihelp[] = "set ascii transfer type";
61char beephelp[] = "beep when command completed";
62char binaryhelp[] = "set binary transfer type";
63char casehelp[] = "toggle mget upper/lower case id mapping";
64char cdhelp[] = "change remote working directory";
65char cduphelp[] = "change remote working directory to parent directory";
66char chmodhelp[] = "change file permissions of remote file";
67char connecthelp[] = "connect to remote tftp";
68char crhelp[] = "toggle carriage return stripping on ascii gets";
69char deletehelp[] = "delete remote file";
70char debughelp[] = "toggle/set debugging mode";
71char dirhelp[] = "list contents of remote directory";
72char disconhelp[] = "terminate ftp session";
73char domachelp[] = "execute macro";
74char formhelp[] = "set file transfer format";
75char globhelp[] = "toggle metacharacter expansion of local file names";
76char hashhelp[] = "toggle printing `#' for each buffer transferred";
77char helphelp[] = "print local help information";
78char idlehelp[] = "get (set) idle timer on remote side";
79char lcdhelp[] = "change local working directory";
80char lshelp[] = "list contents of remote directory";
81char macdefhelp[] = "define a macro";
82char mdeletehelp[] = "delete multiple files";
83char mdirhelp[] = "list contents of multiple remote directories";
84char mgethelp[] = "get multiple files";
85char mkdirhelp[] = "make directory on the remote machine";
86char mlshelp[] = "list contents of multiple remote directories";
87char modtimehelp[] = "show last modification time of remote file";
88char modehelp[] = "set file transfer mode";
89char mputhelp[] = "send multiple files";
90char newerhelp[] = "get file if remote file is newer than local file ";
91char nlisthelp[] = "nlist contents of remote directory";
92char nmaphelp[] = "set templates for default file name mapping";
93char ntranshelp[] = "set translation table for default file name mapping";
94char porthelp[] = "toggle use of PORT cmd for each data connection";
95char prompthelp[] = "force interactive prompting on multiple commands";
96char proxyhelp[] = "issue command on alternate connection";
97char pwdhelp[] = "print working directory on remote machine";
98char quithelp[] = "terminate ftp session and exit";
99char quotehelp[] = "send arbitrary ftp command";
100char receivehelp[] = "receive file";
101char regethelp[] = "get file restarting at end of local file";
102char remotehelp[] = "get help from remote server";
103char renamehelp[] = "rename file";
104char restarthelp[]= "restart file transfer at bytecount";
105char rmdirhelp[] = "remove directory on the remote machine";
106char rmtstatushelp[]="show status of remote machine";
107char runiquehelp[] = "toggle store unique for local files";
108char resethelp[] = "clear queued command replies";
109char sendhelp[] = "send one file";
110char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
111char shellhelp[] = "escape to the shell";
112char sizecmdhelp[] = "show size of remote file";
113char statushelp[] = "show current status";
114char structhelp[] = "set file transfer structure";
115char suniquehelp[] = "toggle store unique on remote machine";
116char systemhelp[] = "show remote system type";
117char tenexhelp[] = "set tenex file transfer type";
118char tracehelp[] = "toggle packet tracing";
119char typehelp[] = "set file transfer type";
120char umaskhelp[] = "get (set) umask on remote side";
121char userhelp[] = "send new user information";
122char verbosehelp[] = "toggle verbose mode";
123
124struct cmd cmdtab[] = {
125 { "!", shellhelp, 0, 0, 0, shell },
126 { "$", domachelp, 1, 0, 0, domacro },
127 { "account", accounthelp, 0, 1, 1, account},
128 { "append", appendhelp, 1, 1, 1, put },
129 { "ascii", asciihelp, 0, 1, 1, setascii },
130 { "bell", beephelp, 0, 0, 0, setbell },
131 { "binary", binaryhelp, 0, 1, 1, setbinary },
132 { "bye", quithelp, 0, 0, 0, quit },
133 { "case", casehelp, 0, 0, 1, setcase },
134 { "cd", cdhelp, 0, 1, 1, cd },
135 { "cdup", cduphelp, 0, 1, 1, cdup },
136 { "chmod", chmodhelp, 0, 1, 1, do_chmod },
137 { "close", disconhelp, 0, 1, 1, disconnect },
138 { "cr", crhelp, 0, 0, 0, setcr },
139 { "delete", deletehelp, 0, 1, 1, delete },
140 { "debug", debughelp, 0, 0, 0, setdebug },
141 { "dir", dirhelp, 1, 1, 1, ls },
142 { "disconnect", disconhelp, 0, 1, 1, disconnect },
143 { "form", formhelp, 0, 1, 1, setform },
144 { "get", receivehelp, 1, 1, 1, get },
145 { "glob", globhelp, 0, 0, 0, setglob },
146 { "hash", hashhelp, 0, 0, 0, sethash },
147 { "help", helphelp, 0, 0, 1, help },
148 { "idle", idlehelp, 0, 1, 1, idle },
149 { "image", binaryhelp, 0, 1, 1, setbinary },
150 { "lcd", lcdhelp, 0, 0, 0, lcd },
151 { "ls", lshelp, 1, 1, 1, ls },
152 { "macdef", macdefhelp, 0, 0, 0, macdef },
153 { "mdelete", mdeletehelp, 1, 1, 1, mdelete },
154 { "mdir", mdirhelp, 1, 1, 1, mls },
155 { "mget", mgethelp, 1, 1, 1, mget },
156 { "mkdir", mkdirhelp, 0, 1, 1, makedir },
157 { "mls", mlshelp, 1, 1, 1, mls },
158 { "mode", modehelp, 0, 1, 1, setmode },
159 { "modtime", modtimehelp, 0, 1, 1, modtime },
160 { "mput", mputhelp, 1, 1, 1, mput },
161 { "newer", newerhelp, 1, 1, 1, newer },
162 { "nmap", nmaphelp, 0, 0, 1, setnmap },
163 { "nlist", nlisthelp, 1, 1, 1, ls },
164 { "ntrans", ntranshelp, 0, 0, 1, setntrans },
165 { "open", connecthelp, 0, 0, 1, setpeer },
166 { "prompt", prompthelp, 0, 0, 0, setprompt },
167 { "proxy", proxyhelp, 0, 0, 1, doproxy },
168 { "sendport", porthelp, 0, 0, 0, setport },
169 { "put", sendhelp, 1, 1, 1, put },
170 { "pwd", pwdhelp, 0, 1, 1, pwd },
171 { "quit", quithelp, 0, 0, 0, quit },
172 { "quote", quotehelp, 1, 1, 1, quote },
173 { "recv", receivehelp, 1, 1, 1, get },
174 { "reget", regethelp, 1, 1, 1, reget },
175 { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
176 { "rhelp", remotehelp, 0, 1, 1, rmthelp },
177 { "rename", renamehelp, 0, 1, 1, renamefile },
178 { "reset", resethelp, 0, 1, 1, reset },
179 { "restart", restarthelp, 1, 1, 1, restart },
180 { "rmdir", rmdirhelp, 0, 1, 1, removedir },
181 { "runique", runiquehelp, 0, 0, 1, setrunique },
182 { "send", sendhelp, 1, 1, 1, put },
183 { "site", sitehelp, 0, 1, 1, site },
184 { "size", sizecmdhelp, 1, 1, 1, sizecmd },
185 { "status", statushelp, 0, 0, 1, status },
186 { "struct", structhelp, 0, 1, 1, setstruct },
187 { "system", systemhelp, 0, 1, 1, syst },
188 { "sunique", suniquehelp, 0, 0, 1, setsunique },
189 { "tenex", tenexhelp, 0, 1, 1, settenex },
190 { "trace", tracehelp, 0, 0, 0, settrace },
191 { "type", typehelp, 0, 1, 1, settype },
192 { "user", userhelp, 0, 1, 1, user },
193 { "umask", umaskhelp, 0, 1, 1, do_umask },
194 { "verbose", verbosehelp, 0, 0, 0, setverbose },
195 { "?", helphelp, 0, 0, 1, help },
196 { 0 },
197};
198
199int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;