1: /* $Header: cmdtab.c,v 2.0a 85/11/21 07:22:43 jqj and danc Exp $ */ 2: /* $Log: cmdtab.c,v $ 3: * Revision 2.0 85/11/21 07:22:43 jqj 4: * 4.3BSD standard release 5: * 6: * Revision 1.1 85/11/20 14:18:58 jqj 7: * Initial revision 8: * 9: */ 10: #ifndef lint 11: static char sccsid[] = "@(#)cmdtab.c 4.7 (Berkeley) 7/26/83"; 12: #endif 13: 14: #include "ftp_var.h" 15: 16: /* 17: * User FTP -- Command Tables. 18: */ 19: int setascii(), setbell(), setbinary(), setdebug(), setform(); 20: int setglob(), sethash(), setmode(), setpeer(); 21: int setprompt(), setstruct(); 22: int settenex(), settrace(), settype(), setverbose(); 23: int disconnect(); 24: int cd(), lcd(), delete(), mdelete(), user(); 25: int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 26: int quit(), renamefile(), status(); 27: int shell(); 28: int pwd(), makedir(), removedir(); 29: 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 cdhelp[] = "change remote working directory"; 35: char connecthelp[] = "connect to remote tftp"; 36: char deletehelp[] = "delete remote file"; 37: char debughelp[] = "toggle/set debugging mode"; 38: char dirhelp[] = "list contents of remote directory"; 39: char disconhelp[] = "terminate ftp session"; 40: char formhelp[] = "set file transfer format"; 41: char globhelp[] = "toggle metacharacter expansion of local file names"; 42: char hashhelp[] = "toggle printing `#' for each buffer transferred"; 43: char helphelp[] = "print local help information"; 44: char lcdhelp[] = "change local working directory"; 45: char lshelp[] = "nlist contents of remote directory"; 46: char mdeletehelp[] = "delete multiple files"; 47: char mdirhelp[] = "list contents of multiple remote directories"; 48: char mgethelp[] = "get multiple files"; 49: char mkdirhelp[] = "make directory on the remote machine"; 50: char mlshelp[] = "nlist contents of multiple remote directories"; 51: char modehelp[] = "set file transfer mode"; 52: char mputhelp[] = "send multiple files"; 53: char porthelp[] = "toggle use of PORT cmd for each data connection"; 54: char prompthelp[] = "force interactive prompting on multiple commands"; 55: char pwdhelp[] = "print working directory on remote machine"; 56: char quithelp[] = "terminate ftp session and exit"; 57: char quotehelp[] = "send arbitrary ftp command"; 58: char receivehelp[] = "receive file"; 59: char remotehelp[] = "get help from remote server"; 60: char renamehelp[] = "rename file"; 61: char rmdirhelp[] = "remove directory on the remote machine"; 62: char sendhelp[] = "send one file"; 63: char shellhelp[] = "escape to the shell"; 64: char statushelp[] = "show current status"; 65: char structhelp[] = "set file transfer structure"; 66: char tenexhelp[] = "set tenex file transfer type"; 67: char tracehelp[] = "toggle packet tracing"; 68: char typehelp[] = "set file transfer type"; 69: char userhelp[] = "send new user information"; 70: char verbosehelp[] = "toggle verbose mode"; 71: 72: struct cmd cmdtab[] = { 73: { "!", shellhelp, 0, 0, shell }, 74: { "append", appendhelp, 1, 1, put }, 75: { "ascii", asciihelp, 0, 1, setascii }, 76: { "bell", beephelp, 0, 0, setbell }, 77: { "binary", binaryhelp, 0, 1, setbinary }, 78: { "bye", quithelp, 0, 0, quit }, 79: { "cd", cdhelp, 0, 1, cd }, 80: { "close", disconhelp, 0, 1, disconnect }, 81: { "delete", deletehelp, 0, 1, delete }, 82: { "debug", debughelp, 0, 0, setdebug }, 83: { "dir", dirhelp, 1, 1, ls }, 84: { "form", formhelp, 0, 1, setform }, 85: { "get", receivehelp, 1, 1, get }, 86: { "glob", globhelp, 0, 0, setglob }, 87: { "hash", hashhelp, 0, 0, sethash }, 88: { "help", helphelp, 0, 0, help }, 89: { "lcd", lcdhelp, 0, 0, lcd }, 90: { "ls", lshelp, 1, 1, ls }, 91: { "mdelete", mdeletehelp, 1, 1, mdelete }, 92: { "mdir", mdirhelp, 1, 1, mls }, 93: { "mget", mgethelp, 1, 1, mget }, 94: { "mkdir", mkdirhelp, 0, 1, makedir }, 95: { "mls", mlshelp, 1, 1, mls }, 96: { "mode", modehelp, 0, 1, setmode }, 97: { "mput", mputhelp, 1, 1, mput }, 98: { "open", connecthelp, 0, 0, setpeer }, 99: { "prompt", prompthelp, 0, 0, setprompt }, 100: { "put", sendhelp, 1, 1, put }, 101: { "pwd", pwdhelp, 0, 1, pwd }, 102: { "quit", quithelp, 0, 0, quit }, 103: { "recv", receivehelp, 1, 1, get }, 104: { "rename", renamehelp, 0, 1, renamefile }, 105: { "rmdir", rmdirhelp, 0, 1, removedir }, 106: { "send", sendhelp, 1, 1, put }, 107: { "status", statushelp, 0, 0, status }, 108: { "struct", structhelp, 0, 1, setstruct }, 109: { "trace", tracehelp, 0, 0, settrace }, 110: { "type", typehelp, 0, 1, settype }, 111: { "user", userhelp, 0, 1, user }, 112: { "verbose", verbosehelp, 0, 0, setverbose }, 113: { "?", helphelp, 0, 0, help }, 114: { 0 }, 115: }; 116: 117: int NCMDS = sizeof (cmdtab) / sizeof (cmdtab[0]) - 1;