121738Sdist /* 226049Sminshall * Copyright (c) 1985 Regents of the University of California. 333737Sbostic * All rights reserved. 433737Sbostic * 533737Sbostic * Redistribution and use in source and binary forms are permitted 634901Sbostic * provided that the above copyright notice and this paragraph are 734901Sbostic * duplicated in all such forms and that any documentation, 834901Sbostic * advertising materials, and other materials related to such 934901Sbostic * distribution and use acknowledge that the software was developed 1034901Sbostic * by the University of California, Berkeley. The name of the 1134901Sbostic * University may not be used to endorse or promote products derived 1234901Sbostic * from this software without specific prior written permission. 1334901Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434901Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*36935Skarels * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621738Sdist */ 1721738Sdist 1810295Ssam #ifndef lint 19*36935Skarels static char sccsid[] = "@(#)cmdtab.c 5.7 (Berkeley) 02/28/89"; 2033737Sbostic #endif /* not lint */ 2111651Ssam 2210295Ssam #include "ftp_var.h" 2310295Ssam 2410295Ssam /* 2510295Ssam * User FTP -- Command Tables. 2610295Ssam */ 2710295Ssam int setascii(), setbell(), setbinary(), setdebug(), setform(); 2814144Ssam int setglob(), sethash(), setmode(), setpeer(), setport(); 2911651Ssam int setprompt(), setstruct(); 3011350Ssam int settenex(), settrace(), settype(), setverbose(); 31*36935Skarels int disconnect(), restart(), reget(), syst(); 3211651Ssam int cd(), lcd(), delete(), mdelete(), user(); 3311757Ssam int ls(), mls(), get(), mget(), help(), append(), put(), mput(); 3410295Ssam int quit(), renamefile(), status(); 3510295Ssam int quote(), rmthelp(), shell(); 3626049Sminshall int pwd(), makedir(), removedir(), setcr(); 3726049Sminshall int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 3826049Sminshall int setsunique(), setrunique(), cdup(), macdef(), domacro(); 39*36935Skarels int sizecmd(), modtime(), newer(), rmtstatus(); 4010295Ssam 4126049Sminshall char accounthelp[] = "send account command to remote server"; 4211651Ssam char appendhelp[] = "append to a file"; 4310295Ssam char asciihelp[] = "set ascii transfer type"; 4410295Ssam char beephelp[] = "beep when command completed"; 4510295Ssam char binaryhelp[] = "set binary transfer type"; 4626049Sminshall char casehelp[] = "toggle mget upper/lower case id mapping"; 4710295Ssam char cdhelp[] = "change remote working directory"; 4826049Sminshall char cduphelp[] = "change remote working directory to parent directory"; 4910295Ssam char connecthelp[] = "connect to remote tftp"; 5026049Sminshall char crhelp[] = "toggle carriage return stripping on ascii gets"; 5110295Ssam char deletehelp[] = "delete remote file"; 5210295Ssam char debughelp[] = "toggle/set debugging mode"; 5310295Ssam char dirhelp[] = "list contents of remote directory"; 5410295Ssam char disconhelp[] = "terminate ftp session"; 5526049Sminshall char domachelp[] = "execute macro"; 5610295Ssam char formhelp[] = "set file transfer format"; 5711350Ssam char globhelp[] = "toggle metacharacter expansion of local file names"; 5811651Ssam char hashhelp[] = "toggle printing `#' for each buffer transferred"; 5910295Ssam char helphelp[] = "print local help information"; 6010295Ssam char lcdhelp[] = "change local working directory"; 61*36935Skarels char lshelp[] = "list contents of remote directory"; 6226049Sminshall char macdefhelp[] = "define a macro"; 6311651Ssam char mdeletehelp[] = "delete multiple files"; 6411757Ssam char mdirhelp[] = "list contents of multiple remote directories"; 6511350Ssam char mgethelp[] = "get multiple files"; 6610295Ssam char mkdirhelp[] = "make directory on the remote machine"; 67*36935Skarels char mlshelp[] = "list contents of multiple remote directories"; 68*36935Skarels char modtimehelp[] = "show last modification time of remote file"; 6910295Ssam char modehelp[] = "set file transfer mode"; 7011350Ssam char mputhelp[] = "send multiple files"; 71*36935Skarels char newerhelp[] = "get file if remote file is newer than local file "; 72*36935Skarels char nlisthelp[] = "nlist contents of remote directory"; 7326049Sminshall char nmaphelp[] = "set templates for default file name mapping"; 7426049Sminshall char ntranshelp[] = "set translation table for default file name mapping"; 7511651Ssam char porthelp[] = "toggle use of PORT cmd for each data connection"; 7610295Ssam char prompthelp[] = "force interactive prompting on multiple commands"; 7726049Sminshall char proxyhelp[] = "issue command on alternate connection"; 7810295Ssam char pwdhelp[] = "print working directory on remote machine"; 7910295Ssam char quithelp[] = "terminate ftp session and exit"; 8010295Ssam char quotehelp[] = "send arbitrary ftp command"; 8110295Ssam char receivehelp[] = "receive file"; 82*36935Skarels char regethelp[] = "get file restarting at end of local file"; 8310295Ssam char remotehelp[] = "get help from remote server"; 8410295Ssam char renamehelp[] = "rename file"; 85*36935Skarels char restarthelp[]= "restart file transfer at bytecount"; 8610295Ssam char rmdirhelp[] = "remove directory on the remote machine"; 87*36935Skarels char rmtstatushelp[]="show status of remote machine"; 8826049Sminshall char runiquehelp[] = "toggle store unique for local files"; 8926049Sminshall char resethelp[] = "clear queued command replies"; 9011350Ssam char sendhelp[] = "send one file"; 9110295Ssam char shellhelp[] = "escape to the shell"; 92*36935Skarels char sizecmdhelp[] = "show size of remote file"; 9310295Ssam char statushelp[] = "show current status"; 9410295Ssam char structhelp[] = "set file transfer structure"; 9526049Sminshall char suniquehelp[] = "toggle store unique on remote machine"; 96*36935Skarels char systemhelp[] = "show remote system type"; 9710295Ssam char tenexhelp[] = "set tenex file transfer type"; 9810295Ssam char tracehelp[] = "toggle packet tracing"; 9910295Ssam char typehelp[] = "set file transfer type"; 10010295Ssam char userhelp[] = "send new user information"; 10110295Ssam char verbosehelp[] = "toggle verbose mode"; 10210295Ssam 10310295Ssam struct cmd cmdtab[] = { 10426049Sminshall { "!", shellhelp, 0, 0, 0, shell }, 10526049Sminshall { "$", domachelp, 1, 0, 0, domacro }, 10626049Sminshall { "account", accounthelp, 0, 1, 1, account}, 10726049Sminshall { "append", appendhelp, 1, 1, 1, put }, 10826049Sminshall { "ascii", asciihelp, 0, 1, 1, setascii }, 10926049Sminshall { "bell", beephelp, 0, 0, 0, setbell }, 11026049Sminshall { "binary", binaryhelp, 0, 1, 1, setbinary }, 11126049Sminshall { "bye", quithelp, 0, 0, 0, quit }, 11226049Sminshall { "case", casehelp, 0, 0, 1, setcase }, 11326049Sminshall { "cd", cdhelp, 0, 1, 1, cd }, 11426049Sminshall { "cdup", cduphelp, 0, 1, 1, cdup }, 11526049Sminshall { "close", disconhelp, 0, 1, 1, disconnect }, 11626049Sminshall { "cr", crhelp, 0, 0, 0, setcr }, 11726049Sminshall { "delete", deletehelp, 0, 1, 1, delete }, 11826049Sminshall { "debug", debughelp, 0, 0, 0, setdebug }, 11926049Sminshall { "dir", dirhelp, 1, 1, 1, ls }, 12026049Sminshall { "disconnect", disconhelp, 0, 1, 1, disconnect }, 12126049Sminshall { "form", formhelp, 0, 1, 1, setform }, 12226049Sminshall { "get", receivehelp, 1, 1, 1, get }, 12326049Sminshall { "glob", globhelp, 0, 0, 0, setglob }, 12426049Sminshall { "hash", hashhelp, 0, 0, 0, sethash }, 12526049Sminshall { "help", helphelp, 0, 0, 1, help }, 12631180Sbostic { "image", binaryhelp, 0, 1, 1, setbinary }, 12726049Sminshall { "lcd", lcdhelp, 0, 0, 0, lcd }, 12826049Sminshall { "ls", lshelp, 1, 1, 1, ls }, 12926049Sminshall { "macdef", macdefhelp, 0, 0, 0, macdef }, 13026049Sminshall { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 13126049Sminshall { "mdir", mdirhelp, 1, 1, 1, mls }, 13226049Sminshall { "mget", mgethelp, 1, 1, 1, mget }, 13326049Sminshall { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 13426049Sminshall { "mls", mlshelp, 1, 1, 1, mls }, 13526049Sminshall { "mode", modehelp, 0, 1, 1, setmode }, 136*36935Skarels { "modtime", modtimehelp, 0, 1, 1, modtime }, 13726049Sminshall { "mput", mputhelp, 1, 1, 1, mput }, 138*36935Skarels { "newer", newerhelp, 1, 1, 1, newer }, 13926049Sminshall { "nmap", nmaphelp, 0, 0, 1, setnmap }, 140*36935Skarels { "nlist", nlisthelp, 1, 1, 1, ls }, 14126049Sminshall { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 14226049Sminshall { "open", connecthelp, 0, 0, 1, setpeer }, 14326049Sminshall { "prompt", prompthelp, 0, 0, 0, setprompt }, 14426049Sminshall { "proxy", proxyhelp, 0, 0, 1, doproxy }, 14526049Sminshall { "sendport", porthelp, 0, 0, 0, setport }, 14626049Sminshall { "put", sendhelp, 1, 1, 1, put }, 14726049Sminshall { "pwd", pwdhelp, 0, 1, 1, pwd }, 14826049Sminshall { "quit", quithelp, 0, 0, 0, quit }, 14926049Sminshall { "quote", quotehelp, 1, 1, 1, quote }, 15026049Sminshall { "recv", receivehelp, 1, 1, 1, get }, 151*36935Skarels { "reget", regethelp, 1, 1, 1, reget }, 152*36935Skarels { "remotestatus",rmtstatushelp, 0, 1, 1, rmtstatus }, 15326049Sminshall { "remotehelp", remotehelp, 0, 1, 1, rmthelp }, 15426049Sminshall { "rename", renamehelp, 0, 1, 1, renamefile }, 15526049Sminshall { "reset", resethelp, 0, 1, 1, reset }, 156*36935Skarels { "restart", restarthelp, 1, 1, 1, restart }, 15726049Sminshall { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 15826049Sminshall { "runique", runiquehelp, 0, 0, 1, setrunique }, 15926049Sminshall { "send", sendhelp, 1, 1, 1, put }, 160*36935Skarels { "size", sizecmdhelp, 1, 1, 1, sizecmd }, 16126049Sminshall { "status", statushelp, 0, 0, 1, status }, 16226049Sminshall { "struct", structhelp, 0, 1, 1, setstruct }, 163*36935Skarels { "system", systemhelp, 0, 1, 1, syst }, 16426049Sminshall { "sunique", suniquehelp, 0, 0, 1, setsunique }, 16526049Sminshall { "tenex", tenexhelp, 0, 1, 1, settenex }, 16626049Sminshall { "trace", tracehelp, 0, 0, 0, settrace }, 16726049Sminshall { "type", typehelp, 0, 1, 1, settype }, 16826049Sminshall { "user", userhelp, 0, 1, 1, user }, 16926049Sminshall { "verbose", verbosehelp, 0, 0, 0, setverbose }, 17026049Sminshall { "?", helphelp, 0, 0, 1, help }, 17111651Ssam { 0 }, 17210295Ssam }; 17310295Ssam 17418287Sralph int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 175