1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2002 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 28 /* All Rights Reserved */ 29 30 /* 31 * University Copyright- Copyright (c) 1982, 1986, 1988 32 * The Regents of the University of California 33 * All Rights Reserved 34 * 35 * University Acknowledgment- Portions of this document are derived from 36 * software developed by the University of California, Berkeley, and its 37 * contributors. 38 */ 39 40 #include "ftp_var.h" 41 42 /* 43 * User FTP -- Command Tables. 44 */ 45 46 static char accounthelp[] = "send account command to remote server"; 47 static char appendhelp[] = "append to a file"; 48 static char asciihelp[] = "set ascii transfer type"; 49 static char beephelp[] = "beep when command completed"; 50 static char binaryhelp[] = "set binary transfer type"; 51 static char casehelp[] = "toggle mget upper/lower case id mapping"; 52 static char ccchelp[] = "set clear protection level for commands"; 53 static char cdhelp[] = "change remote working directory"; 54 static char cduphelp[] = "change remote working directory to parent " 55 "directory"; 56 static char clearhelp[] = "set clear protection level for data"; 57 static char connecthelp[] = "connect to remote tftp"; 58 static char crhelp[] = "toggle carriage return stripping on ascii " 59 "gets"; 60 static char deletehelp[] = "delete remote file"; 61 static char debughelp[] = "toggle/set debugging mode"; 62 static char dirhelp[] = "list contents of remote directory"; 63 static char disconhelp[] = "terminate ftp session"; 64 static char domachelp[] = "execute macro"; 65 static char formhelp[] = "set file transfer format"; 66 static char globhelp[] = "toggle metacharacter expansion of local file " 67 "names"; 68 static char hashhelp[] = "toggle printing `#' for each buffer " 69 "transferred"; 70 static char helphelp[] = "print local help information"; 71 static char lcdhelp[] = "change local working directory"; 72 static char lshelp[] = "display contents of remote directory"; 73 static char macdefhelp[] = "define a macro"; 74 static char mdeletehelp[] = "delete multiple files"; 75 static char mdirhelp[] = "list contents of multiple remote directories"; 76 static char mechhelp[] = "set mechanism type"; 77 static char mgethelp[] = "get multiple files"; 78 static char mkdirhelp[] = "make directory on the remote machine"; 79 static char mlshelp[] = "nlist contents of multiple remote directories"; 80 static char modehelp[] = "set file transfer mode"; 81 static char mputhelp[] = "send multiple files"; 82 static char nlisthelp[] = "nlist contents of remote directory"; 83 static char nmaphelp[] = "set templates for default file name mapping"; 84 static char ntranshelp[] = "set translation table for default file name " 85 "mapping"; 86 static char passivehelp[] = "toggle passive transfer mode"; 87 static char porthelp[] = "toggle use of PORT cmd for each data " 88 "connection"; 89 static char privatehelp[] = "set private protection level for data"; 90 static char prompthelp[] = "force interactive prompting on multiple " 91 "commands"; 92 static char protecthelp[] = "set protection level for data"; 93 static char proxyhelp[] = "issue command on alternate connection"; 94 static char pwdhelp[] = "print working directory on remote machine"; 95 static char quithelp[] = "terminate ftp session and exit"; 96 static char quotehelp[] = "send arbitrary ftp command"; 97 static char receivehelp[] = "receive file"; 98 static char regethelp[] = "get file restarting at end of local file"; 99 static char remotehelp[] = "get help from remote server"; 100 static char renamehelp[] = "rename file"; 101 static char resethelp[] = "clear queued command replies"; 102 static char restarthelp[] = "restart file transfer at bytecount"; 103 static char rmdirhelp[] = "remove directory on the remote machine"; 104 static char runiquehelp[] = "toggle store unique for local files"; 105 static char safehelp[] = "set safe protection level for data"; 106 static char sendhelp[] = "send one file"; 107 static char shellhelp[] = "escape to the shell"; 108 static char sitehelp[] = "send site specific command to remote server\n" 109 "\t\tTry \"remotehelp site\" or \"site help\" " 110 "for more information"; 111 static char statushelp[] = "show current status"; 112 static char structhelp[] = "set file transfer structure"; 113 static char suniquehelp[] = "toggle store unique on remote machine"; 114 static char tenexhelp[] = "set tenex file transfer type"; 115 static char tracehelp[] = "toggle packet tracing"; 116 static char typehelp[] = "set file transfer type"; 117 static char userhelp[] = "send new user information"; 118 static char verbosehelp[] = "toggle verbose mode"; 119 static char windowhelp[] = "set TCP window size for the data connection"; 120 121 /* 122 * NOTE : The BUFSIZE defined in ftp_var.h includes MAXCMDLEN chars to 123 * accomodate the longest command in the cmdtab[] defined below. 124 * If anyone plans to add a new command that is longer than the MAXCMDLEN 125 * make sure to update it in ftp_var.h. 126 */ 127 128 struct cmd cmdtab[] = { 129 { "!", shellhelp, 0, 0, 0, shell }, 130 { "$", domachelp, 1, 0, 0, domacro }, 131 { "account", accounthelp, 0, 1, 1, account}, 132 { "append", appendhelp, 1, 1, 1, put }, 133 { "ascii", asciihelp, 0, 1, 1, setascii }, 134 { "bell", beephelp, 0, 0, 0, setbell }, 135 { "binary", binaryhelp, 0, 1, 1, setbinary }, 136 { "bye", quithelp, 0, 0, 0, quit }, 137 { "case", casehelp, 0, 0, 1, setcase }, 138 139 { "ccc", ccchelp, 0, 1, 1, ccc }, 140 141 { "cd", cdhelp, 0, 1, 1, cd }, 142 { "cdup", cduphelp, 0, 1, 1, cdup }, 143 144 { "clear", clearhelp, 0, 1, 1, setclear }, 145 146 { "close", disconhelp, 0, 1, 1, disconnect }, 147 { "cr", crhelp, 0, 0, 0, setcr }, 148 { "delete", deletehelp, 0, 1, 1, delete }, 149 { "debug", debughelp, 0, 0, 0, setdebug }, 150 { "dir", dirhelp, 1, 1, 1, ls }, 151 { "disconnect", disconhelp, 0, 1, 1, disconnect }, 152 { "form", formhelp, 0, 1, 1, setform }, 153 { "get", receivehelp, 1, 1, 1, get }, 154 { "glob", globhelp, 0, 0, 0, setglob }, 155 { "hash", hashhelp, 0, 0, 0, sethash }, 156 { "help", helphelp, 0, 0, 1, help }, 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 163 { "mechanism", mechhelp, 1, 0, 1, setmech }, 164 165 { "mget", mgethelp, 1, 1, 1, mget }, 166 { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 167 { "mls", mlshelp, 1, 1, 1, mls }, 168 { "mode", modehelp, 0, 1, 1, setmode }, 169 { "mput", mputhelp, 1, 1, 1, mput }, 170 { "nlist", nlisthelp, 1, 1, 1, ls }, 171 { "nmap", nmaphelp, 0, 0, 1, setnmap }, 172 { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 173 { "open", connecthelp, 0, 0, 1, setpeer }, 174 { "passive", passivehelp, 0, 0, 0, setpassive }, 175 176 { "private", privatehelp, 0, 1, 1, setprivate }, 177 178 { "prompt", prompthelp, 0, 0, 0, setprompt }, 179 180 { "protect", protecthelp, 0, 1, 1, setdlevel }, 181 182 { "proxy", proxyhelp, 0, 0, 1, doproxy }, 183 { "put", sendhelp, 1, 1, 1, put }, 184 { "pwd", pwdhelp, 0, 1, 1, pwd }, 185 { "quit", quithelp, 0, 0, 0, quit }, 186 { "quote", quotehelp, 1, 1, 1, quote }, 187 { "recv", receivehelp, 1, 1, 1, get }, 188 { "reget", regethelp, 1, 1, 1, reget }, 189 { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 190 { "rename", renamehelp, 0, 1, 1, renamefile }, 191 { "reset", resethelp, 0, 1, 1, reset }, 192 { "restart", restarthelp, 1, 1, 1, restart }, 193 { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 194 { "runique", runiquehelp, 0, 0, 1, setrunique }, 195 196 { "safe", safehelp, 0, 1, 1, setsafe }, 197 198 { "send", sendhelp, 1, 1, 1, put }, 199 { "sendport", porthelp, 0, 0, 0, setport }, 200 { "site", sitehelp, 0, 1, 1, site }, 201 { "status", statushelp, 0, 0, 1, status }, 202 { "struct", structhelp, 0, 1, 1, setstruct }, 203 { "sunique", suniquehelp, 0, 0, 1, setsunique }, 204 { "tcpwindow", windowhelp, 0, 0, 0, settcpwindow }, 205 { "tenex", tenexhelp, 0, 1, 1, settenex }, 206 { "trace", tracehelp, 0, 0, 0, settrace }, 207 { "type", typehelp, 0, 1, 1, settype }, 208 { "user", userhelp, 0, 1, 1, user }, 209 { "verbose", verbosehelp, 0, 0, 0, setverbose }, 210 { "?", helphelp, 0, 0, 1, help }, 211 { 0 }, 212 }; 213 214 int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 215