BSD 4_4_Lite1 release
[unix-history] / usr / src / usr.bin / ftp / cmdtab.c
CommitLineData
edf71f48 1/*
ed554bc5 2 * Copyright (c) 1985, 1989, 1993, 1994
ad787160 3 * The Regents of the University of California. All rights reserved.
11c5f0a3 4 *
ad787160
C
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.
edf71f48
DF
32 */
33
53f01c40 34#ifndef lint
ed554bc5 35static char sccsid[] = "@(#)cmdtab.c 8.3 (Berkeley) 4/2/94";
11c5f0a3 36#endif /* not lint */
5ac6fc46 37
ed554bc5 38#include <stdio.h>
53f01c40
SL
39#include "ftp_var.h"
40
41/*
42 * User FTP -- Command Tables.
43 */
53f01c40 44
9069f68e 45char accounthelp[] = "send account command to remote server";
5ac6fc46 46char appendhelp[] = "append to a file";
53f01c40
SL
47char asciihelp[] = "set ascii transfer type";
48char beephelp[] = "beep when command completed";
49char binaryhelp[] = "set binary transfer type";
9069f68e 50char casehelp[] = "toggle mget upper/lower case id mapping";
53f01c40 51char cdhelp[] = "change remote working directory";
9069f68e 52char cduphelp[] = "change remote working directory to parent directory";
23d74d65 53char chmodhelp[] = "change file permissions of remote file";
53f01c40 54char connecthelp[] = "connect to remote tftp";
9069f68e 55char crhelp[] = "toggle carriage return stripping on ascii gets";
53f01c40
SL
56char deletehelp[] = "delete remote file";
57char debughelp[] = "toggle/set debugging mode";
58char dirhelp[] = "list contents of remote directory";
59char disconhelp[] = "terminate ftp session";
9069f68e 60char domachelp[] = "execute macro";
53f01c40 61char formhelp[] = "set file transfer format";
9248b609 62char globhelp[] = "toggle metacharacter expansion of local file names";
5ac6fc46 63char hashhelp[] = "toggle printing `#' for each buffer transferred";
53f01c40 64char helphelp[] = "print local help information";
23d74d65 65char idlehelp[] = "get (set) idle timer on remote side";
53f01c40 66char lcdhelp[] = "change local working directory";
ff00793c 67char lshelp[] = "list contents of remote directory";
9069f68e 68char macdefhelp[] = "define a macro";
5ac6fc46 69char mdeletehelp[] = "delete multiple files";
9072bd8a 70char mdirhelp[] = "list contents of multiple remote directories";
9248b609 71char mgethelp[] = "get multiple files";
53f01c40 72char mkdirhelp[] = "make directory on the remote machine";
1c15e888 73char mlshelp[] = "list contents of multiple remote directories";
ff00793c 74char modtimehelp[] = "show last modification time of remote file";
53f01c40 75char modehelp[] = "set file transfer mode";
9248b609 76char mputhelp[] = "send multiple files";
1c15e888 77char newerhelp[] = "get file if remote file is newer than local file ";
ff00793c 78char nlisthelp[] = "nlist contents of remote directory";
9069f68e
GM
79char nmaphelp[] = "set templates for default file name mapping";
80char ntranshelp[] = "set translation table for default file name mapping";
5ac6fc46 81char porthelp[] = "toggle use of PORT cmd for each data connection";
53f01c40 82char prompthelp[] = "force interactive prompting on multiple commands";
9069f68e 83char proxyhelp[] = "issue command on alternate connection";
53f01c40
SL
84char pwdhelp[] = "print working directory on remote machine";
85char quithelp[] = "terminate ftp session and exit";
86char quotehelp[] = "send arbitrary ftp command";
87char receivehelp[] = "receive file";
1c15e888 88char regethelp[] = "get file restarting at end of local file";
53f01c40
SL
89char remotehelp[] = "get help from remote server";
90char renamehelp[] = "rename file";
1c15e888 91char restarthelp[]= "restart file transfer at bytecount";
53f01c40 92char rmdirhelp[] = "remove directory on the remote machine";
ff00793c 93char rmtstatushelp[]="show status of remote machine";
9069f68e
GM
94char runiquehelp[] = "toggle store unique for local files";
95char resethelp[] = "clear queued command replies";
9248b609 96char sendhelp[] = "send one file";
23d74d65 97char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
53f01c40 98char shellhelp[] = "escape to the shell";
ff00793c 99char sizecmdhelp[] = "show size of remote file";
53f01c40
SL
100char statushelp[] = "show current status";
101char structhelp[] = "set file transfer structure";
9069f68e 102char suniquehelp[] = "toggle store unique on remote machine";
ff00793c 103char systemhelp[] = "show remote system type";
53f01c40
SL
104char tenexhelp[] = "set tenex file transfer type";
105char tracehelp[] = "toggle packet tracing";
106char typehelp[] = "set file transfer type";
23d74d65 107char umaskhelp[] = "get (set) umask on remote side";
53f01c40
SL
108char userhelp[] = "send new user information";
109char verbosehelp[] = "toggle verbose mode";
110
111struct cmd cmdtab[] = {
9069f68e
GM
112 { "!", shellhelp, 0, 0, 0, shell },
113 { "$", domachelp, 1, 0, 0, domacro },
114 { "account", accounthelp, 0, 1, 1, account},
115 { "append", appendhelp, 1, 1, 1, put },
116 { "ascii", asciihelp, 0, 1, 1, setascii },
117 { "bell", beephelp, 0, 0, 0, setbell },
118 { "binary", binaryhelp, 0, 1, 1, setbinary },
119 { "bye", quithelp, 0, 0, 0, quit },
120 { "case", casehelp, 0, 0, 1, setcase },
121 { "cd", cdhelp, 0, 1, 1, cd },
122 { "cdup", cduphelp, 0, 1, 1, cdup },
23d74d65 123 { "chmod", chmodhelp, 0, 1, 1, do_chmod },
9069f68e
GM
124 { "close", disconhelp, 0, 1, 1, disconnect },
125 { "cr", crhelp, 0, 0, 0, setcr },
126 { "delete", deletehelp, 0, 1, 1, delete },
127 { "debug", debughelp, 0, 0, 0, setdebug },
128 { "dir", dirhelp, 1, 1, 1, ls },
129 { "disconnect", disconhelp, 0, 1, 1, disconnect },
130 { "form", formhelp, 0, 1, 1, setform },
131 { "get", receivehelp, 1, 1, 1, get },
132 { "glob", globhelp, 0, 0, 0, setglob },
133 { "hash", hashhelp, 0, 0, 0, sethash },
134 { "help", helphelp, 0, 0, 1, help },
23d74d65 135 { "idle", idlehelp, 0, 1, 1, idle },
a2d52b81 136 { "image", binaryhelp, 0, 1, 1, setbinary },
9069f68e
GM
137 { "lcd", lcdhelp, 0, 0, 0, lcd },
138 { "ls", lshelp, 1, 1, 1, ls },
139 { "macdef", macdefhelp, 0, 0, 0, macdef },
140 { "mdelete", mdeletehelp, 1, 1, 1, mdelete },
141 { "mdir", mdirhelp, 1, 1, 1, mls },
142 { "mget", mgethelp, 1, 1, 1, mget },
143 { "mkdir", mkdirhelp, 0, 1, 1, makedir },
144 { "mls", mlshelp, 1, 1, 1, mls },
ed554bc5 145 { "mode", modehelp, 0, 1, 1, setftmode },
ff00793c 146 { "modtime", modtimehelp, 0, 1, 1, modtime },
9069f68e 147 { "mput", mputhelp, 1, 1, 1, mput },
1c15e888 148 { "newer", newerhelp, 1, 1, 1, newer },
9069f68e 149 { "nmap", nmaphelp, 0, 0, 1, setnmap },
ff00793c 150 { "nlist", nlisthelp, 1, 1, 1, ls },
9069f68e
GM
151 { "ntrans", ntranshelp, 0, 0, 1, setntrans },
152 { "open", connecthelp, 0, 0, 1, setpeer },
153 { "prompt", prompthelp, 0, 0, 0, setprompt },
154 { "proxy", proxyhelp, 0, 0, 1, doproxy },
155 { "sendport", porthelp, 0, 0, 0, setport },
156 { "put", sendhelp, 1, 1, 1, put },
157 { "pwd", pwdhelp, 0, 1, 1, pwd },
158 { "quit", quithelp, 0, 0, 0, quit },
159 { "quote", quotehelp, 1, 1, 1, quote },
160 { "recv", receivehelp, 1, 1, 1, get },
1c15e888 161 { "reget", regethelp, 1, 1, 1, reget },
cdc35b45
MK
162 { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus },
163 { "rhelp", remotehelp, 0, 1, 1, rmthelp },
9069f68e
GM
164 { "rename", renamehelp, 0, 1, 1, renamefile },
165 { "reset", resethelp, 0, 1, 1, reset },
1c15e888 166 { "restart", restarthelp, 1, 1, 1, restart },
9069f68e
GM
167 { "rmdir", rmdirhelp, 0, 1, 1, removedir },
168 { "runique", runiquehelp, 0, 0, 1, setrunique },
169 { "send", sendhelp, 1, 1, 1, put },
23d74d65 170 { "site", sitehelp, 0, 1, 1, site },
ff00793c 171 { "size", sizecmdhelp, 1, 1, 1, sizecmd },
9069f68e
GM
172 { "status", statushelp, 0, 0, 1, status },
173 { "struct", structhelp, 0, 1, 1, setstruct },
ff00793c 174 { "system", systemhelp, 0, 1, 1, syst },
9069f68e
GM
175 { "sunique", suniquehelp, 0, 0, 1, setsunique },
176 { "tenex", tenexhelp, 0, 1, 1, settenex },
177 { "trace", tracehelp, 0, 0, 0, settrace },
178 { "type", typehelp, 0, 1, 1, settype },
179 { "user", userhelp, 0, 1, 1, user },
23d74d65 180 { "umask", umaskhelp, 0, 1, 1, do_umask },
9069f68e
GM
181 { "verbose", verbosehelp, 0, 0, 0, setverbose },
182 { "?", helphelp, 0, 0, 1, help },
5ac6fc46 183 { 0 },
53f01c40
SL
184};
185
71a655cd 186int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;