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