121738Sdist /* 226049Sminshall * Copyright (c) 1985 Regents of the University of California. 3*33737Sbostic * All rights reserved. 4*33737Sbostic * 5*33737Sbostic * Redistribution and use in source and binary forms are permitted 6*33737Sbostic * provided that this notice is preserved and that due credit is given 7*33737Sbostic * to the University of California at Berkeley. The name of the University 8*33737Sbostic * may not be used to endorse or promote products derived from this 9*33737Sbostic * software without specific prior written permission. This software 10*33737Sbostic * is provided ``as is'' without express or implied warranty. 1121738Sdist */ 1221738Sdist 1310295Ssam #ifndef lint 14*33737Sbostic static char sccsid[] = "@(#)cmdtab.c 5.5 (Berkeley) 03/14/88"; 15*33737Sbostic #endif /* not lint */ 1611651Ssam 1710295Ssam #include "ftp_var.h" 1810295Ssam 1910295Ssam /* 2010295Ssam * User FTP -- Command Tables. 2110295Ssam */ 2210295Ssam int setascii(), setbell(), setbinary(), setdebug(), setform(); 2314144Ssam int setglob(), sethash(), setmode(), setpeer(), setport(); 2411651Ssam int setprompt(), setstruct(); 2511350Ssam int settenex(), settrace(), settype(), setverbose(); 2610295Ssam int disconnect(); 2711651Ssam int cd(), lcd(), delete(), mdelete(), user(); 2811757Ssam int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 2910295Ssam int quit(), renamefile(), status(); 3010295Ssam int quote(), rmthelp(), shell(); 3126049Sminshall int pwd(), makedir(), removedir(), setcr(); 3226049Sminshall int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 3326049Sminshall int setsunique(), setrunique(), cdup(), macdef(), domacro(); 3410295Ssam 3526049Sminshall char accounthelp[] = "send account command to remote server"; 3611651Ssam char appendhelp[] = "append to a file"; 3710295Ssam char asciihelp[] = "set ascii transfer type"; 3810295Ssam char beephelp[] = "beep when command completed"; 3910295Ssam char binaryhelp[] = "set binary transfer type"; 4026049Sminshall char casehelp[] = "toggle mget upper/lower case id mapping"; 4110295Ssam char cdhelp[] = "change remote working directory"; 4226049Sminshall char cduphelp[] = "change remote working directory to parent directory"; 4310295Ssam char connecthelp[] = "connect to remote tftp"; 4426049Sminshall char crhelp[] = "toggle carriage return stripping on ascii gets"; 4510295Ssam char deletehelp[] = "delete remote file"; 4610295Ssam char debughelp[] = "toggle/set debugging mode"; 4710295Ssam char dirhelp[] = "list contents of remote directory"; 4810295Ssam char disconhelp[] = "terminate ftp session"; 4926049Sminshall char domachelp[] = "execute macro"; 5010295Ssam char formhelp[] = "set file transfer format"; 5111350Ssam char globhelp[] = "toggle metacharacter expansion of local file names"; 5211651Ssam char hashhelp[] = "toggle printing `#' for each buffer transferred"; 5310295Ssam char helphelp[] = "print local help information"; 5410295Ssam char lcdhelp[] = "change local working directory"; 5510295Ssam char lshelp[] = "nlist contents of remote directory"; 5626049Sminshall char macdefhelp[] = "define a macro"; 5711651Ssam char mdeletehelp[] = "delete multiple files"; 5811757Ssam char mdirhelp[] = "list contents of multiple remote directories"; 5911350Ssam char mgethelp[] = "get multiple files"; 6010295Ssam char mkdirhelp[] = "make directory on the remote machine"; 6111757Ssam char mlshelp[] = "nlist contents of multiple remote directories"; 6210295Ssam char modehelp[] = "set file transfer mode"; 6311350Ssam char mputhelp[] = "send multiple files"; 6426049Sminshall char nmaphelp[] = "set templates for default file name mapping"; 6526049Sminshall char ntranshelp[] = "set translation table for default file name mapping"; 6611651Ssam char porthelp[] = "toggle use of PORT cmd for each data connection"; 6710295Ssam char prompthelp[] = "force interactive prompting on multiple commands"; 6826049Sminshall char proxyhelp[] = "issue command on alternate connection"; 6910295Ssam char pwdhelp[] = "print working directory on remote machine"; 7010295Ssam char quithelp[] = "terminate ftp session and exit"; 7110295Ssam char quotehelp[] = "send arbitrary ftp command"; 7210295Ssam char receivehelp[] = "receive file"; 7310295Ssam char remotehelp[] = "get help from remote server"; 7410295Ssam char renamehelp[] = "rename file"; 7510295Ssam char rmdirhelp[] = "remove directory on the remote machine"; 7626049Sminshall char runiquehelp[] = "toggle store unique for local files"; 7726049Sminshall char resethelp[] = "clear queued command replies"; 7811350Ssam char sendhelp[] = "send one file"; 7910295Ssam char shellhelp[] = "escape to the shell"; 8010295Ssam char statushelp[] = "show current status"; 8110295Ssam char structhelp[] = "set file transfer structure"; 8226049Sminshall char suniquehelp[] = "toggle store unique on remote machine"; 8310295Ssam char tenexhelp[] = "set tenex file transfer type"; 8410295Ssam char tracehelp[] = "toggle packet tracing"; 8510295Ssam char typehelp[] = "set file transfer type"; 8610295Ssam char userhelp[] = "send new user information"; 8710295Ssam char verbosehelp[] = "toggle verbose mode"; 8810295Ssam 8910295Ssam struct cmd cmdtab[] = { 9026049Sminshall { "!", shellhelp, 0, 0, 0, shell }, 9126049Sminshall { "$", domachelp, 1, 0, 0, domacro }, 9226049Sminshall { "account", accounthelp, 0, 1, 1, account}, 9326049Sminshall { "append", appendhelp, 1, 1, 1, put }, 9426049Sminshall { "ascii", asciihelp, 0, 1, 1, setascii }, 9526049Sminshall { "bell", beephelp, 0, 0, 0, setbell }, 9626049Sminshall { "binary", binaryhelp, 0, 1, 1, setbinary }, 9726049Sminshall { "bye", quithelp, 0, 0, 0, quit }, 9826049Sminshall { "case", casehelp, 0, 0, 1, setcase }, 9926049Sminshall { "cd", cdhelp, 0, 1, 1, cd }, 10026049Sminshall { "cdup", cduphelp, 0, 1, 1, cdup }, 10126049Sminshall { "close", disconhelp, 0, 1, 1, disconnect }, 10226049Sminshall { "cr", crhelp, 0, 0, 0, setcr }, 10326049Sminshall { "delete", deletehelp, 0, 1, 1, delete }, 10426049Sminshall { "debug", debughelp, 0, 0, 0, setdebug }, 10526049Sminshall { "dir", dirhelp, 1, 1, 1, ls }, 10626049Sminshall { "disconnect", disconhelp, 0, 1, 1, disconnect }, 10726049Sminshall { "form", formhelp, 0, 1, 1, setform }, 10826049Sminshall { "get", receivehelp, 1, 1, 1, get }, 10926049Sminshall { "glob", globhelp, 0, 0, 0, setglob }, 11026049Sminshall { "hash", hashhelp, 0, 0, 0, sethash }, 11126049Sminshall { "help", helphelp, 0, 0, 1, help }, 11231180Sbostic { "image", binaryhelp, 0, 1, 1, setbinary }, 11326049Sminshall { "lcd", lcdhelp, 0, 0, 0, lcd }, 11426049Sminshall { "ls", lshelp, 1, 1, 1, ls }, 11526049Sminshall { "macdef", macdefhelp, 0, 0, 0, macdef }, 11626049Sminshall { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 11726049Sminshall { "mdir", mdirhelp, 1, 1, 1, mls }, 11826049Sminshall { "mget", mgethelp, 1, 1, 1, mget }, 11926049Sminshall { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 12026049Sminshall { "mls", mlshelp, 1, 1, 1, mls }, 12126049Sminshall { "mode", modehelp, 0, 1, 1, setmode }, 12226049Sminshall { "mput", mputhelp, 1, 1, 1, mput }, 12326049Sminshall { "nmap", nmaphelp, 0, 0, 1, setnmap }, 12426049Sminshall { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 12526049Sminshall { "open", connecthelp, 0, 0, 1, setpeer }, 12626049Sminshall { "prompt", prompthelp, 0, 0, 0, setprompt }, 12726049Sminshall { "proxy", proxyhelp, 0, 0, 1, doproxy }, 12826049Sminshall { "sendport", porthelp, 0, 0, 0, setport }, 12926049Sminshall { "put", sendhelp, 1, 1, 1, put }, 13026049Sminshall { "pwd", pwdhelp, 0, 1, 1, pwd }, 13126049Sminshall { "quit", quithelp, 0, 0, 0, quit }, 13226049Sminshall { "quote", quotehelp, 1, 1, 1, quote }, 13326049Sminshall { "recv", receivehelp, 1, 1, 1, get }, 13426049Sminshall { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 13526049Sminshall { "rename", renamehelp, 0, 1, 1, renamefile }, 13626049Sminshall { "reset", resethelp, 0, 1, 1, reset }, 13726049Sminshall { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 13826049Sminshall { "runique", runiquehelp, 0, 0, 1, setrunique }, 13926049Sminshall { "send", sendhelp, 1, 1, 1, put }, 14026049Sminshall { "status", statushelp, 0, 0, 1, status }, 14126049Sminshall { "struct", structhelp, 0, 1, 1, setstruct }, 14226049Sminshall { "sunique", suniquehelp, 0, 0, 1, setsunique }, 14326049Sminshall { "tenex", tenexhelp, 0, 1, 1, settenex }, 14426049Sminshall { "trace", tracehelp, 0, 0, 0, settrace }, 14526049Sminshall { "type", typehelp, 0, 1, 1, settype }, 14626049Sminshall { "user", userhelp, 0, 1, 1, user }, 14726049Sminshall { "verbose", verbosehelp, 0, 0, 0, setverbose }, 14826049Sminshall { "?", helphelp, 0, 0, 1, help }, 14911651Ssam { 0 }, 15010295Ssam }; 15110295Ssam 15218287Sralph int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 153