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: #if !defined(lint) && !defined(pdp11) 19: static char sccsid[] = "@(#)cmdtab.c 5.9.1 (2.11BSD GTE) 1/1/94"; 20: #endif 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(), restart(), reget(), 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(), site(); 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(), newer(), rmtstatus(); 40: int do_chmod(), do_umask(), idle(); 41: 42: char accounthelp[] = "send account command to remote server"; 43: char appendhelp[] = "append to a file"; 44: char asciihelp[] = "set ascii transfer type"; 45: char beephelp[] = "beep when command completed"; 46: char binaryhelp[] = "set binary transfer type"; 47: char casehelp[] = "toggle mget upper/lower case id mapping"; 48: char cdhelp[] = "change remote working directory"; 49: char cduphelp[] = "change remote working directory to parent directory"; 50: char chmodhelp[] = "change file permissions of remote file"; 51: char connecthelp[] = "connect to remote tftp"; 52: char crhelp[] = "toggle carriage return stripping on ascii gets"; 53: char deletehelp[] = "delete remote file"; 54: char debughelp[] = "toggle/set debugging mode"; 55: char dirhelp[] = "list contents of remote directory"; 56: char disconhelp[] = "terminate ftp session"; 57: char domachelp[] = "execute macro"; 58: char formhelp[] = "set file transfer format"; 59: char globhelp[] = "toggle metacharacter expansion of local file names"; 60: char hashhelp[] = "toggle printing `#' for each buffer transferred"; 61: char helphelp[] = "print local help information"; 62: char idlehelp[] = "get (set) idle timer on remote side"; 63: char lcdhelp[] = "change local working directory"; 64: char lshelp[] = "list contents of remote directory"; 65: char macdefhelp[] = "define a macro"; 66: char mdeletehelp[] = "delete multiple files"; 67: char mdirhelp[] = "list contents of multiple remote directories"; 68: char mgethelp[] = "get multiple files"; 69: char mkdirhelp[] = "make directory on the remote machine"; 70: char mlshelp[] = "list contents of multiple remote directories"; 71: char modtimehelp[] = "show last modification time of remote file"; 72: char modehelp[] = "set file transfer mode"; 73: char mputhelp[] = "send multiple files"; 74: char newerhelp[] = "get file if remote file is newer than local file "; 75: char nlisthelp[] = "nlist contents of remote directory"; 76: char nmaphelp[] = "set templates for default file name mapping"; 77: char ntranshelp[] = "set translation table for default file name mapping"; 78: char porthelp[] = "toggle use of PORT cmd for each data connection"; 79: char prompthelp[] = "force interactive prompting on multiple commands"; 80: char proxyhelp[] = "issue command on alternate connection"; 81: char pwdhelp[] = "print working directory on remote machine"; 82: char quithelp[] = "terminate ftp session and exit"; 83: char quotehelp[] = "send arbitrary ftp command"; 84: char receivehelp[] = "receive file"; 85: char regethelp[] = "get file restarting at end of local file"; 86: char remotehelp[] = "get help from remote server"; 87: char renamehelp[] = "rename file"; 88: char restarthelp[]= "restart file transfer at bytecount"; 89: char rmdirhelp[] = "remove directory on the remote machine"; 90: char rmtstatushelp[]="show status of remote machine"; 91: char runiquehelp[] = "toggle store unique for local files"; 92: char resethelp[] = "clear queued command replies"; 93: char sendhelp[] = "send one file"; 94: char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information"; 95: char shellhelp[] = "escape to the shell"; 96: char sizecmdhelp[] = "show size of remote file"; 97: char statushelp[] = "show current status"; 98: char structhelp[] = "set file transfer structure"; 99: char suniquehelp[] = "toggle store unique on remote machine"; 100: char systemhelp[] = "show remote system type"; 101: char tenexhelp[] = "set tenex file transfer type"; 102: char tracehelp[] = "toggle packet tracing"; 103: char typehelp[] = "set file transfer type"; 104: char umaskhelp[] = "get (set) umask on remote side"; 105: char userhelp[] = "send new user information"; 106: char verbosehelp[] = "toggle verbose mode"; 107: 108: struct cmd cmdtab[] = { 109: { "!", shellhelp, 0, 0, 0, shell }, 110: { "$", domachelp, 1, 0, 0, domacro }, 111: { "account", accounthelp, 0, 1, 1, account}, 112: { "append", appendhelp, 1, 1, 1, put }, 113: { "ascii", asciihelp, 0, 1, 1, setascii }, 114: { "bell", beephelp, 0, 0, 0, setbell }, 115: { "binary", binaryhelp, 0, 1, 1, setbinary }, 116: { "bye", quithelp, 0, 0, 0, quit }, 117: { "case", casehelp, 0, 0, 1, setcase }, 118: { "cd", cdhelp, 0, 1, 1, cd }, 119: { "cdup", cduphelp, 0, 1, 1, cdup }, 120: { "chmod", chmodhelp, 0, 1, 1, do_chmod }, 121: { "close", disconhelp, 0, 1, 1, disconnect }, 122: { "cr", crhelp, 0, 0, 0, setcr }, 123: { "delete", deletehelp, 0, 1, 1, delete }, 124: { "debug", debughelp, 0, 0, 0, setdebug }, 125: { "dir", dirhelp, 1, 1, 1, ls }, 126: { "disconnect", disconhelp, 0, 1, 1, disconnect }, 127: { "form", formhelp, 0, 1, 1, setform }, 128: { "get", receivehelp, 1, 1, 1, get }, 129: { "glob", globhelp, 0, 0, 0, setglob }, 130: { "hash", hashhelp, 0, 0, 0, sethash }, 131: { "help", helphelp, 0, 0, 1, help }, 132: { "idle", idlehelp, 0, 1, 1, idle }, 133: { "image", binaryhelp, 0, 1, 1, setbinary }, 134: { "lcd", lcdhelp, 0, 0, 0, lcd }, 135: { "ls", lshelp, 1, 1, 1, ls }, 136: { "macdef", macdefhelp, 0, 0, 0, macdef }, 137: { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 138: { "mdir", mdirhelp, 1, 1, 1, mls }, 139: { "mget", mgethelp, 1, 1, 1, mget }, 140: { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 141: { "mls", mlshelp, 1, 1, 1, mls }, 142: { "mode", modehelp, 0, 1, 1, setmode }, 143: { "modtime", modtimehelp, 0, 1, 1, modtime }, 144: { "mput", mputhelp, 1, 1, 1, mput }, 145: { "newer", newerhelp, 1, 1, 1, newer }, 146: { "nmap", nmaphelp, 0, 0, 1, setnmap }, 147: { "nlist", nlisthelp, 1, 1, 1, ls }, 148: { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 149: { "open", connecthelp, 0, 0, 1, setpeer }, 150: { "prompt", prompthelp, 0, 0, 0, setprompt }, 151: { "proxy", proxyhelp, 0, 0, 1, doproxy }, 152: { "sendport", porthelp, 0, 0, 0, setport }, 153: { "put", sendhelp, 1, 1, 1, put }, 154: { "pwd", pwdhelp, 0, 1, 1, pwd }, 155: { "quit", quithelp, 0, 0, 0, quit }, 156: { "quote", quotehelp, 1, 1, 1, quote }, 157: { "recv", receivehelp, 1, 1, 1, get }, 158: { "reget", regethelp, 1, 1, 1, reget }, 159: { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus }, 160: { "rhelp", remotehelp, 0, 1, 1, rmthelp }, 161: { "rename", renamehelp, 0, 1, 1, renamefile }, 162: { "reset", resethelp, 0, 1, 1, reset }, 163: { "restart", restarthelp, 1, 1, 1, restart }, 164: { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 165: { "runique", runiquehelp, 0, 0, 1, setrunique }, 166: { "send", sendhelp, 1, 1, 1, put }, 167: { "site", sitehelp, 0, 1, 1, site }, 168: { "size", sizecmdhelp, 1, 1, 1, sizecmd }, 169: { "status", statushelp, 0, 0, 1, status }, 170: { "struct", structhelp, 0, 1, 1, setstruct }, 171: { "system", systemhelp, 0, 1, 1, syst }, 172: { "sunique", suniquehelp, 0, 0, 1, setsunique }, 173: { "tenex", tenexhelp, 0, 1, 1, settenex }, 174: { "trace", tracehelp, 0, 0, 0, settrace }, 175: { "type", typehelp, 0, 1, 1, settype }, 176: { "user", userhelp, 0, 1, 1, user }, 177: { "umask", umaskhelp, 0, 1, 1, do_umask }, 178: { "verbose", verbosehelp, 0, 0, 0, setverbose }, 179: { "?", helphelp, 0, 0, 1, help }, 180: { 0 }, 181: }; 182: 183: int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;