1 /* 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 are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 */ 17 18 #ifndef lint 19 static char sccsid[] = "@(#)cmdtab.c 5.8.1.2 (Berkeley) 03/01/89"; 20 #endif /* not lint */ 21 22 #include "ftp_var.h" 23 24 /* 25 * User FTP -- Command Tables. 26 */ 27 int setascii(), setbell(), setbinary(), setdebug(), setform(); 28 int setglob(), sethash(), setmode(), setpeer(), setport(); 29 int setprompt(), setstruct(); 30 int settenex(), settrace(), settype(), setverbose(); 31 int disconnect(), syst(); 32 int cd(), lcd(), delete(), mdelete(), user(); 33 int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 34 int quit(), renamefile(), status(); 35 int quote(), rmthelp(), shell(); 36 int pwd(), makedir(), removedir(), setcr(); 37 int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 38 int setsunique(), setrunique(), cdup(), macdef(), domacro(); 39 int sizecmd(), modtime(), rmtstatus(); 40 41 char accounthelp[] = "send account command to remote server"; 42 char appendhelp[] = "append to a file"; 43 char asciihelp[] = "set ascii transfer type"; 44 char beephelp[] = "beep when command completed"; 45 char binaryhelp[] = "set binary transfer type"; 46 char casehelp[] = "toggle mget upper/lower case id mapping"; 47 char cdhelp[] = "change remote working directory"; 48 char cduphelp[] = "change remote working directory to parent directory"; 49 char connecthelp[] = "connect to remote tftp"; 50 char crhelp[] = "toggle carriage return stripping on ascii gets"; 51 char deletehelp[] = "delete remote file"; 52 char debughelp[] = "toggle/set debugging mode"; 53 char dirhelp[] = "list contents of remote directory"; 54 char disconhelp[] = "terminate ftp session"; 55 char domachelp[] = "execute macro"; 56 char formhelp[] = "set file transfer format"; 57 char globhelp[] = "toggle metacharacter expansion of local file names"; 58 char hashhelp[] = "toggle printing `#' for each buffer transferred"; 59 char helphelp[] = "print local help information"; 60 char lcdhelp[] = "change local working directory"; 61 char lshelp[] = "list contents of remote directory"; 62 char macdefhelp[] = "define a macro"; 63 char mdeletehelp[] = "delete multiple files"; 64 char mdirhelp[] = "list contents of multiple remote directories"; 65 char mgethelp[] = "get multiple files"; 66 char mkdirhelp[] = "make directory on the remote machine"; 67 char mlshelp[] = "nlist contents of multiple remote directories"; 68 char modtimehelp[] = "show last modification time of remote file"; 69 char modehelp[] = "set file transfer mode"; 70 char mputhelp[] = "send multiple files"; 71 char nlisthelp[] = "nlist contents of remote directory"; 72 char nmaphelp[] = "set templates for default file name mapping"; 73 char ntranshelp[] = "set translation table for default file name mapping"; 74 char porthelp[] = "toggle use of PORT cmd for each data connection"; 75 char prompthelp[] = "force interactive prompting on multiple commands"; 76 char proxyhelp[] = "issue command on alternate connection"; 77 char pwdhelp[] = "print working directory on remote machine"; 78 char quithelp[] = "terminate ftp session and exit"; 79 char quotehelp[] = "send arbitrary ftp command"; 80 char receivehelp[] = "receive file"; 81 char remotehelp[] = "get help from remote server"; 82 char renamehelp[] = "rename file"; 83 char rmdirhelp[] = "remove directory on the remote machine"; 84 char rmtstatushelp[]="show status of remote machine"; 85 char runiquehelp[] = "toggle store unique for local files"; 86 char resethelp[] = "clear queued command replies"; 87 char sendhelp[] = "send one file"; 88 char shellhelp[] = "escape to the shell"; 89 char sizecmdhelp[] = "show size of remote file"; 90 char statushelp[] = "show current status"; 91 char structhelp[] = "set file transfer structure"; 92 char suniquehelp[] = "toggle store unique on remote machine"; 93 char systemhelp[] = "show remote system type"; 94 char tenexhelp[] = "set tenex file transfer type"; 95 char tracehelp[] = "toggle packet tracing"; 96 char typehelp[] = "set file transfer type"; 97 char userhelp[] = "send new user information"; 98 char verbosehelp[] = "toggle verbose mode"; 99 100 struct cmd cmdtab[] = { 101 { "!", shellhelp, 0, 0, 0, shell }, 102 { "$", domachelp, 1, 0, 0, domacro }, 103 { "account", accounthelp, 0, 1, 1, account}, 104 { "append", appendhelp, 1, 1, 1, put }, 105 { "ascii", asciihelp, 0, 1, 1, setascii }, 106 { "bell", beephelp, 0, 0, 0, setbell }, 107 { "binary", binaryhelp, 0, 1, 1, setbinary }, 108 { "bye", quithelp, 0, 0, 0, quit }, 109 { "case", casehelp, 0, 0, 1, setcase }, 110 { "cd", cdhelp, 0, 1, 1, cd }, 111 { "cdup", cduphelp, 0, 1, 1, cdup }, 112 { "close", disconhelp, 0, 1, 1, disconnect }, 113 { "cr", crhelp, 0, 0, 0, setcr }, 114 { "delete", deletehelp, 0, 1, 1, delete }, 115 { "debug", debughelp, 0, 0, 0, setdebug }, 116 { "dir", dirhelp, 1, 1, 1, ls }, 117 { "disconnect", disconhelp, 0, 1, 1, disconnect }, 118 { "form", formhelp, 0, 1, 1, setform }, 119 { "get", receivehelp, 1, 1, 1, get }, 120 { "glob", globhelp, 0, 0, 0, setglob }, 121 { "hash", hashhelp, 0, 0, 0, sethash }, 122 { "help", helphelp, 0, 0, 1, help }, 123 { "image", binaryhelp, 0, 1, 1, setbinary }, 124 { "lcd", lcdhelp, 0, 0, 0, lcd }, 125 { "ls", lshelp, 1, 1, 1, ls }, 126 { "macdef", macdefhelp, 0, 0, 0, macdef }, 127 { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 128 { "mdir", mdirhelp, 1, 1, 1, mls }, 129 { "mget", mgethelp, 1, 1, 1, mget }, 130 { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 131 { "mls", mlshelp, 1, 1, 1, mls }, 132 { "mode", modehelp, 0, 1, 1, setmode }, 133 { "modtime", modtimehelp, 0, 1, 1, modtime }, 134 { "mput", mputhelp, 1, 1, 1, mput }, 135 { "nmap", nmaphelp, 0, 0, 1, setnmap }, 136 { "nlist", nlisthelp, 1, 1, 1, ls }, 137 { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 138 { "open", connecthelp, 0, 0, 1, setpeer }, 139 { "prompt", prompthelp, 0, 0, 0, setprompt }, 140 { "proxy", proxyhelp, 0, 0, 1, doproxy }, 141 { "sendport", porthelp, 0, 0, 0, setport }, 142 { "put", sendhelp, 1, 1, 1, put }, 143 { "pwd", pwdhelp, 0, 1, 1, pwd }, 144 { "quit", quithelp, 0, 0, 0, quit }, 145 { "quote", quotehelp, 1, 1, 1, quote }, 146 { "recv", receivehelp, 1, 1, 1, get }, 147 { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 148 { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus }, 149 { "rhelp", remotehelp, 0, 1, 1, rmthelp }, 150 { "rename", renamehelp, 0, 1, 1, renamefile }, 151 { "reset", resethelp, 0, 1, 1, reset }, 152 { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 153 { "runique", runiquehelp, 0, 0, 1, setrunique }, 154 { "send", sendhelp, 1, 1, 1, put }, 155 { "size", sizecmdhelp, 1, 1, 1, sizecmd }, 156 { "status", statushelp, 0, 0, 1, status }, 157 { "struct", structhelp, 0, 1, 1, setstruct }, 158 { "system", systemhelp, 0, 1, 1, syst }, 159 { "sunique", suniquehelp, 0, 0, 1, setsunique }, 160 { "tenex", tenexhelp, 0, 1, 1, settenex }, 161 { "trace", tracehelp, 0, 0, 0, settrace }, 162 { "type", typehelp, 0, 1, 1, settype }, 163 { "user", userhelp, 0, 1, 1, user }, 164 { "verbose", verbosehelp, 0, 0, 0, setverbose }, 165 { "?", helphelp, 0, 0, 1, help }, 166 { 0 }, 167 }; 168 169 int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 170