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