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