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