121738Sdist /* 226049Sminshall * Copyright (c) 1985 Regents of the University of California. 321738Sdist * All rights reserved. The Berkeley software License Agreement 421738Sdist * specifies the terms and conditions for redistribution. 521738Sdist */ 621738Sdist 710295Ssam #ifndef lint 8*31180Sbostic static char sccsid[] = "@(#)cmdtab.c 5.4 (Berkeley) 05/22/87"; 921738Sdist #endif not lint 1011651Ssam 1110295Ssam #include "ftp_var.h" 1210295Ssam 1310295Ssam /* 1410295Ssam * User FTP -- Command Tables. 1510295Ssam */ 1610295Ssam int setascii(), setbell(), setbinary(), setdebug(), setform(); 1714144Ssam int setglob(), sethash(), setmode(), setpeer(), setport(); 1811651Ssam int setprompt(), setstruct(); 1911350Ssam int settenex(), settrace(), settype(), setverbose(); 2010295Ssam int disconnect(); 2111651Ssam int cd(), lcd(), delete(), mdelete(), user(); 2211757Ssam int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 2310295Ssam int quit(), renamefile(), status(); 2410295Ssam int quote(), rmthelp(), shell(); 2526049Sminshall int pwd(), makedir(), removedir(), setcr(); 2626049Sminshall int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 2726049Sminshall int setsunique(), setrunique(), cdup(), macdef(), domacro(); 2810295Ssam 2926049Sminshall char accounthelp[] = "send account command to remote server"; 3011651Ssam char appendhelp[] = "append to a file"; 3110295Ssam char asciihelp[] = "set ascii transfer type"; 3210295Ssam char beephelp[] = "beep when command completed"; 3310295Ssam char binaryhelp[] = "set binary transfer type"; 3426049Sminshall char casehelp[] = "toggle mget upper/lower case id mapping"; 3510295Ssam char cdhelp[] = "change remote working directory"; 3626049Sminshall char cduphelp[] = "change remote working directory to parent directory"; 3710295Ssam char connecthelp[] = "connect to remote tftp"; 3826049Sminshall char crhelp[] = "toggle carriage return stripping on ascii gets"; 3910295Ssam char deletehelp[] = "delete remote file"; 4010295Ssam char debughelp[] = "toggle/set debugging mode"; 4110295Ssam char dirhelp[] = "list contents of remote directory"; 4210295Ssam char disconhelp[] = "terminate ftp session"; 4326049Sminshall char domachelp[] = "execute macro"; 4410295Ssam char formhelp[] = "set file transfer format"; 4511350Ssam char globhelp[] = "toggle metacharacter expansion of local file names"; 4611651Ssam char hashhelp[] = "toggle printing `#' for each buffer transferred"; 4710295Ssam char helphelp[] = "print local help information"; 4810295Ssam char lcdhelp[] = "change local working directory"; 4910295Ssam char lshelp[] = "nlist contents of remote directory"; 5026049Sminshall char macdefhelp[] = "define a macro"; 5111651Ssam char mdeletehelp[] = "delete multiple files"; 5211757Ssam char mdirhelp[] = "list contents of multiple remote directories"; 5311350Ssam char mgethelp[] = "get multiple files"; 5410295Ssam char mkdirhelp[] = "make directory on the remote machine"; 5511757Ssam char mlshelp[] = "nlist contents of multiple remote directories"; 5610295Ssam char modehelp[] = "set file transfer mode"; 5711350Ssam char mputhelp[] = "send multiple files"; 5826049Sminshall char nmaphelp[] = "set templates for default file name mapping"; 5926049Sminshall char ntranshelp[] = "set translation table for default file name mapping"; 6011651Ssam char porthelp[] = "toggle use of PORT cmd for each data connection"; 6110295Ssam char prompthelp[] = "force interactive prompting on multiple commands"; 6226049Sminshall char proxyhelp[] = "issue command on alternate connection"; 6310295Ssam char pwdhelp[] = "print working directory on remote machine"; 6410295Ssam char quithelp[] = "terminate ftp session and exit"; 6510295Ssam char quotehelp[] = "send arbitrary ftp command"; 6610295Ssam char receivehelp[] = "receive file"; 6710295Ssam char remotehelp[] = "get help from remote server"; 6810295Ssam char renamehelp[] = "rename file"; 6910295Ssam char rmdirhelp[] = "remove directory on the remote machine"; 7026049Sminshall char runiquehelp[] = "toggle store unique for local files"; 7126049Sminshall char resethelp[] = "clear queued command replies"; 7211350Ssam char sendhelp[] = "send one file"; 7310295Ssam char shellhelp[] = "escape to the shell"; 7410295Ssam char statushelp[] = "show current status"; 7510295Ssam char structhelp[] = "set file transfer structure"; 7626049Sminshall char suniquehelp[] = "toggle store unique on remote machine"; 7710295Ssam char tenexhelp[] = "set tenex file transfer type"; 7810295Ssam char tracehelp[] = "toggle packet tracing"; 7910295Ssam char typehelp[] = "set file transfer type"; 8010295Ssam char userhelp[] = "send new user information"; 8110295Ssam char verbosehelp[] = "toggle verbose mode"; 8210295Ssam 8310295Ssam struct cmd cmdtab[] = { 8426049Sminshall { "!", shellhelp, 0, 0, 0, shell }, 8526049Sminshall { "$", domachelp, 1, 0, 0, domacro }, 8626049Sminshall { "account", accounthelp, 0, 1, 1, account}, 8726049Sminshall { "append", appendhelp, 1, 1, 1, put }, 8826049Sminshall { "ascii", asciihelp, 0, 1, 1, setascii }, 8926049Sminshall { "bell", beephelp, 0, 0, 0, setbell }, 9026049Sminshall { "binary", binaryhelp, 0, 1, 1, setbinary }, 9126049Sminshall { "bye", quithelp, 0, 0, 0, quit }, 9226049Sminshall { "case", casehelp, 0, 0, 1, setcase }, 9326049Sminshall { "cd", cdhelp, 0, 1, 1, cd }, 9426049Sminshall { "cdup", cduphelp, 0, 1, 1, cdup }, 9526049Sminshall { "close", disconhelp, 0, 1, 1, disconnect }, 9626049Sminshall { "cr", crhelp, 0, 0, 0, setcr }, 9726049Sminshall { "delete", deletehelp, 0, 1, 1, delete }, 9826049Sminshall { "debug", debughelp, 0, 0, 0, setdebug }, 9926049Sminshall { "dir", dirhelp, 1, 1, 1, ls }, 10026049Sminshall { "disconnect", disconhelp, 0, 1, 1, disconnect }, 10126049Sminshall { "form", formhelp, 0, 1, 1, setform }, 10226049Sminshall { "get", receivehelp, 1, 1, 1, get }, 10326049Sminshall { "glob", globhelp, 0, 0, 0, setglob }, 10426049Sminshall { "hash", hashhelp, 0, 0, 0, sethash }, 10526049Sminshall { "help", helphelp, 0, 0, 1, help }, 106*31180Sbostic { "image", binaryhelp, 0, 1, 1, setbinary }, 10726049Sminshall { "lcd", lcdhelp, 0, 0, 0, lcd }, 10826049Sminshall { "ls", lshelp, 1, 1, 1, ls }, 10926049Sminshall { "macdef", macdefhelp, 0, 0, 0, macdef }, 11026049Sminshall { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 11126049Sminshall { "mdir", mdirhelp, 1, 1, 1, mls }, 11226049Sminshall { "mget", mgethelp, 1, 1, 1, mget }, 11326049Sminshall { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 11426049Sminshall { "mls", mlshelp, 1, 1, 1, mls }, 11526049Sminshall { "mode", modehelp, 0, 1, 1, setmode }, 11626049Sminshall { "mput", mputhelp, 1, 1, 1, mput }, 11726049Sminshall { "nmap", nmaphelp, 0, 0, 1, setnmap }, 11826049Sminshall { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 11926049Sminshall { "open", connecthelp, 0, 0, 1, setpeer }, 12026049Sminshall { "prompt", prompthelp, 0, 0, 0, setprompt }, 12126049Sminshall { "proxy", proxyhelp, 0, 0, 1, doproxy }, 12226049Sminshall { "sendport", porthelp, 0, 0, 0, setport }, 12326049Sminshall { "put", sendhelp, 1, 1, 1, put }, 12426049Sminshall { "pwd", pwdhelp, 0, 1, 1, pwd }, 12526049Sminshall { "quit", quithelp, 0, 0, 0, quit }, 12626049Sminshall { "quote", quotehelp, 1, 1, 1, quote }, 12726049Sminshall { "recv", receivehelp, 1, 1, 1, get }, 12826049Sminshall { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 12926049Sminshall { "rename", renamehelp, 0, 1, 1, renamefile }, 13026049Sminshall { "reset", resethelp, 0, 1, 1, reset }, 13126049Sminshall { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 13226049Sminshall { "runique", runiquehelp, 0, 0, 1, setrunique }, 13326049Sminshall { "send", sendhelp, 1, 1, 1, put }, 13426049Sminshall { "status", statushelp, 0, 0, 1, status }, 13526049Sminshall { "struct", structhelp, 0, 1, 1, setstruct }, 13626049Sminshall { "sunique", suniquehelp, 0, 0, 1, setsunique }, 13726049Sminshall { "tenex", tenexhelp, 0, 1, 1, settenex }, 13826049Sminshall { "trace", tracehelp, 0, 0, 0, settrace }, 13926049Sminshall { "type", typehelp, 0, 1, 1, settype }, 14026049Sminshall { "user", userhelp, 0, 1, 1, user }, 14126049Sminshall { "verbose", verbosehelp, 0, 0, 0, setverbose }, 14226049Sminshall { "?", helphelp, 0, 0, 1, help }, 14311651Ssam { 0 }, 14410295Ssam }; 14510295Ssam 14618287Sralph int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 147