1: /* 2: * Copyright (c) 1985 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: */ 6: 7: #ifndef lint 8: static char sccsid[] = "@(#)cmdtab.c 5.3 (Berkeley) 2/3/86"; 9: #endif not lint 10: 11: #include "ftp_var.h" 12: 13: /* 14: * User FTP -- Command Tables. 15: */ 16: int setascii(), setbell(), setbinary(), setdebug(), setform(); 17: int setglob(), sethash(), setmode(), setpeer(), setport(); 18: int setprompt(), setstruct(); 19: int settenex(), settrace(), settype(), setverbose(); 20: int disconnect(); 21: int cd(), lcd(), delete(), mdelete(), user(); 22: int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 23: int quit(), renamefile(), status(); 24: int quote(), rmthelp(), shell(); 25: int pwd(), makedir(), removedir(), setcr(); 26: int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 27: int setsunique(), setrunique(), cdup(), macdef(), domacro(); 28: 29: char accounthelp[] = "send account command to remote server"; 30: char appendhelp[] = "append to a file"; 31: char asciihelp[] = "set ascii transfer type"; 32: char beephelp[] = "beep when command completed"; 33: char binaryhelp[] = "set binary transfer type"; 34: char casehelp[] = "toggle mget upper/lower case id mapping"; 35: char cdhelp[] = "change remote working directory"; 36: char cduphelp[] = "change remote working directory to parent directory"; 37: char connecthelp[] = "connect to remote tftp"; 38: char crhelp[] = "toggle carriage return stripping on ascii gets"; 39: char deletehelp[] = "delete remote file"; 40: char debughelp[] = "toggle/set debugging mode"; 41: char dirhelp[] = "list contents of remote directory"; 42: char disconhelp[] = "terminate ftp session"; 43: char domachelp[] = "execute macro"; 44: char formhelp[] = "set file transfer format"; 45: char globhelp[] = "toggle metacharacter expansion of local file names"; 46: char hashhelp[] = "toggle printing `#' for each buffer transferred"; 47: char helphelp[] = "print local help information"; 48: char lcdhelp[] = "change local working directory"; 49: char lshelp[] = "nlist contents of remote directory"; 50: char macdefhelp[] = "define a macro"; 51: char mdeletehelp[] = "delete multiple files"; 52: char mdirhelp[] = "list contents of multiple remote directories"; 53: char mgethelp[] = "get multiple files"; 54: char mkdirhelp[] = "make directory on the remote machine"; 55: char mlshelp[] = "nlist contents of multiple remote directories"; 56: char modehelp[] = "set file transfer mode"; 57: char mputhelp[] = "send multiple files"; 58: char nmaphelp[] = "set templates for default file name mapping"; 59: char ntranshelp[] = "set translation table for default file name mapping"; 60: char porthelp[] = "toggle use of PORT cmd for each data connection"; 61: char prompthelp[] = "force interactive prompting on multiple commands"; 62: char proxyhelp[] = "issue command on alternate connection"; 63: char pwdhelp[] = "print working directory on remote machine"; 64: char quithelp[] = "terminate ftp session and exit"; 65: char quotehelp[] = "send arbitrary ftp command"; 66: char receivehelp[] = "receive file"; 67: char remotehelp[] = "get help from remote server"; 68: char renamehelp[] = "rename file"; 69: char rmdirhelp[] = "remove directory on the remote machine"; 70: char runiquehelp[] = "toggle store unique for local files"; 71: char resethelp[] = "clear queued command replies"; 72: char sendhelp[] = "send one file"; 73: char shellhelp[] = "escape to the shell"; 74: char statushelp[] = "show current status"; 75: char structhelp[] = "set file transfer structure"; 76: char suniquehelp[] = "toggle store unique on remote machine"; 77: char tenexhelp[] = "set tenex file transfer type"; 78: char tracehelp[] = "toggle packet tracing"; 79: char typehelp[] = "set file transfer type"; 80: char userhelp[] = "send new user information"; 81: char verbosehelp[] = "toggle verbose mode"; 82: 83: struct cmd cmdtab[] = { 84: { "!", shellhelp, 0, 0, 0, shell }, 85: { "$", domachelp, 1, 0, 0, domacro }, 86: { "account", accounthelp, 0, 1, 1, account}, 87: { "append", appendhelp, 1, 1, 1, put }, 88: { "ascii", asciihelp, 0, 1, 1, setascii }, 89: { "bell", beephelp, 0, 0, 0, setbell }, 90: { "binary", binaryhelp, 0, 1, 1, setbinary }, 91: { "bye", quithelp, 0, 0, 0, quit }, 92: { "case", casehelp, 0, 0, 1, setcase }, 93: { "cd", cdhelp, 0, 1, 1, cd }, 94: { "cdup", cduphelp, 0, 1, 1, cdup }, 95: { "close", disconhelp, 0, 1, 1, disconnect }, 96: { "cr", crhelp, 0, 0, 0, setcr }, 97: { "delete", deletehelp, 0, 1, 1, delete }, 98: { "debug", debughelp, 0, 0, 0, setdebug }, 99: { "dir", dirhelp, 1, 1, 1, ls }, 100: { "disconnect", disconhelp, 0, 1, 1, disconnect }, 101: { "form", formhelp, 0, 1, 1, setform }, 102: { "get", receivehelp, 1, 1, 1, get }, 103: { "glob", globhelp, 0, 0, 0, setglob }, 104: { "hash", hashhelp, 0, 0, 0, sethash }, 105: { "help", helphelp, 0, 0, 1, help }, 106: { "lcd", lcdhelp, 0, 0, 0, lcd }, 107: { "ls", lshelp, 1, 1, 1, ls }, 108: { "macdef", macdefhelp, 0, 0, 0, macdef }, 109: { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 110: { "mdir", mdirhelp, 1, 1, 1, mls }, 111: { "mget", mgethelp, 1, 1, 1, mget }, 112: { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 113: { "mls", mlshelp, 1, 1, 1, mls }, 114: { "mode", modehelp, 0, 1, 1, setmode }, 115: { "mput", mputhelp, 1, 1, 1, mput }, 116: { "nmap", nmaphelp, 0, 0, 1, setnmap }, 117: { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 118: { "open", connecthelp, 0, 0, 1, setpeer }, 119: { "prompt", prompthelp, 0, 0, 0, setprompt }, 120: { "proxy", proxyhelp, 0, 0, 1, doproxy }, 121: { "sendport", porthelp, 0, 0, 0, setport }, 122: { "put", sendhelp, 1, 1, 1, put }, 123: { "pwd", pwdhelp, 0, 1, 1, pwd }, 124: { "quit", quithelp, 0, 0, 0, quit }, 125: { "quote", quotehelp, 1, 1, 1, quote }, 126: { "recv", receivehelp, 1, 1, 1, get }, 127: { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 128: { "rename", renamehelp, 0, 1, 1, renamefile }, 129: { "reset", resethelp, 0, 1, 1, reset }, 130: { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 131: { "runique", runiquehelp, 0, 0, 1, setrunique }, 132: { "send", sendhelp, 1, 1, 1, put }, 133: { "status", statushelp, 0, 0, 1, status }, 134: { "struct", structhelp, 0, 1, 1, setstruct }, 135: { "sunique", suniquehelp, 0, 0, 1, setsunique }, 136: { "tenex", tenexhelp, 0, 1, 1, settenex }, 137: { "trace", tracehelp, 0, 0, 0, settrace }, 138: { "type", typehelp, 0, 1, 1, settype }, 139: { "user", userhelp, 0, 1, 1, user }, 140: { "verbose", verbosehelp, 0, 0, 0, setverbose }, 141: { "?", helphelp, 0, 0, 1, help }, 142: { 0 }, 143: }; 144: 145: int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;