121738Sdist /* 236942Skarels * Copyright (c) 1985, 1989 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 1536935Skarels * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1621738Sdist */ 1721738Sdist 1810295Ssam #ifndef lint 19*37224Skarels static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 03/21/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*37224Skarels 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(); 35*37224Skarels int quote(), rmthelp(), shell(), site(); 3626049Sminshall int pwd(), makedir(), removedir(), setcr(); 3726049Sminshall int account(), doproxy(), reset(), setcase(), setntrans(), setnmap(); 3826049Sminshall int setsunique(), setrunique(), cdup(), macdef(), domacro(); 39*37224Skarels int sizecmd(), modtime(), newer(), rmtstatus(); 40*37224Skarels int do_chmod(), do_umask(), idle(); 4110295Ssam 4226049Sminshall char accounthelp[] = "send account command to remote server"; 4311651Ssam char appendhelp[] = "append to a file"; 4410295Ssam char asciihelp[] = "set ascii transfer type"; 4510295Ssam char beephelp[] = "beep when command completed"; 4610295Ssam char binaryhelp[] = "set binary transfer type"; 4726049Sminshall char casehelp[] = "toggle mget upper/lower case id mapping"; 4810295Ssam char cdhelp[] = "change remote working directory"; 4926049Sminshall char cduphelp[] = "change remote working directory to parent directory"; 50*37224Skarels char chmodhelp[] = "change file permissions of remote file"; 5110295Ssam char connecthelp[] = "connect to remote tftp"; 5226049Sminshall char crhelp[] = "toggle carriage return stripping on ascii gets"; 5310295Ssam char deletehelp[] = "delete remote file"; 5410295Ssam char debughelp[] = "toggle/set debugging mode"; 5510295Ssam char dirhelp[] = "list contents of remote directory"; 5610295Ssam char disconhelp[] = "terminate ftp session"; 5726049Sminshall char domachelp[] = "execute macro"; 5810295Ssam char formhelp[] = "set file transfer format"; 5911350Ssam char globhelp[] = "toggle metacharacter expansion of local file names"; 6011651Ssam char hashhelp[] = "toggle printing `#' for each buffer transferred"; 6110295Ssam char helphelp[] = "print local help information"; 62*37224Skarels char idlehelp[] = "get (set) idle timer on remote side"; 6310295Ssam char lcdhelp[] = "change local working directory"; 6436935Skarels char lshelp[] = "list contents of remote directory"; 6526049Sminshall char macdefhelp[] = "define a macro"; 6611651Ssam char mdeletehelp[] = "delete multiple files"; 6711757Ssam char mdirhelp[] = "list contents of multiple remote directories"; 6811350Ssam char mgethelp[] = "get multiple files"; 6910295Ssam char mkdirhelp[] = "make directory on the remote machine"; 70*37224Skarels char mlshelp[] = "list contents of multiple remote directories"; 7136935Skarels char modtimehelp[] = "show last modification time of remote file"; 7210295Ssam char modehelp[] = "set file transfer mode"; 7311350Ssam char mputhelp[] = "send multiple files"; 74*37224Skarels char newerhelp[] = "get file if remote file is newer than local file "; 7536935Skarels char nlisthelp[] = "nlist contents of remote directory"; 7626049Sminshall char nmaphelp[] = "set templates for default file name mapping"; 7726049Sminshall char ntranshelp[] = "set translation table for default file name mapping"; 7811651Ssam char porthelp[] = "toggle use of PORT cmd for each data connection"; 7910295Ssam char prompthelp[] = "force interactive prompting on multiple commands"; 8026049Sminshall char proxyhelp[] = "issue command on alternate connection"; 8110295Ssam char pwdhelp[] = "print working directory on remote machine"; 8210295Ssam char quithelp[] = "terminate ftp session and exit"; 8310295Ssam char quotehelp[] = "send arbitrary ftp command"; 8410295Ssam char receivehelp[] = "receive file"; 85*37224Skarels char regethelp[] = "get file restarting at end of local file"; 8610295Ssam char remotehelp[] = "get help from remote server"; 8710295Ssam char renamehelp[] = "rename file"; 88*37224Skarels char restarthelp[]= "restart file transfer at bytecount"; 8910295Ssam char rmdirhelp[] = "remove directory on the remote machine"; 9036935Skarels char rmtstatushelp[]="show status of remote machine"; 9126049Sminshall char runiquehelp[] = "toggle store unique for local files"; 9226049Sminshall char resethelp[] = "clear queued command replies"; 9311350Ssam char sendhelp[] = "send one file"; 94*37224Skarels char sitehelp[] = "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information"; 9510295Ssam char shellhelp[] = "escape to the shell"; 9636935Skarels char sizecmdhelp[] = "show size of remote file"; 9710295Ssam char statushelp[] = "show current status"; 9810295Ssam char structhelp[] = "set file transfer structure"; 9926049Sminshall char suniquehelp[] = "toggle store unique on remote machine"; 10036935Skarels char systemhelp[] = "show remote system type"; 10110295Ssam char tenexhelp[] = "set tenex file transfer type"; 10210295Ssam char tracehelp[] = "toggle packet tracing"; 10310295Ssam char typehelp[] = "set file transfer type"; 104*37224Skarels char umaskhelp[] = "get (set) umask on remote side"; 10510295Ssam char userhelp[] = "send new user information"; 10610295Ssam char verbosehelp[] = "toggle verbose mode"; 10710295Ssam 10810295Ssam struct cmd cmdtab[] = { 10926049Sminshall { "!", shellhelp, 0, 0, 0, shell }, 11026049Sminshall { "$", domachelp, 1, 0, 0, domacro }, 11126049Sminshall { "account", accounthelp, 0, 1, 1, account}, 11226049Sminshall { "append", appendhelp, 1, 1, 1, put }, 11326049Sminshall { "ascii", asciihelp, 0, 1, 1, setascii }, 11426049Sminshall { "bell", beephelp, 0, 0, 0, setbell }, 11526049Sminshall { "binary", binaryhelp, 0, 1, 1, setbinary }, 11626049Sminshall { "bye", quithelp, 0, 0, 0, quit }, 11726049Sminshall { "case", casehelp, 0, 0, 1, setcase }, 11826049Sminshall { "cd", cdhelp, 0, 1, 1, cd }, 11926049Sminshall { "cdup", cduphelp, 0, 1, 1, cdup }, 120*37224Skarels { "chmod", chmodhelp, 0, 1, 1, do_chmod }, 12126049Sminshall { "close", disconhelp, 0, 1, 1, disconnect }, 12226049Sminshall { "cr", crhelp, 0, 0, 0, setcr }, 12326049Sminshall { "delete", deletehelp, 0, 1, 1, delete }, 12426049Sminshall { "debug", debughelp, 0, 0, 0, setdebug }, 12526049Sminshall { "dir", dirhelp, 1, 1, 1, ls }, 12626049Sminshall { "disconnect", disconhelp, 0, 1, 1, disconnect }, 12726049Sminshall { "form", formhelp, 0, 1, 1, setform }, 12826049Sminshall { "get", receivehelp, 1, 1, 1, get }, 12926049Sminshall { "glob", globhelp, 0, 0, 0, setglob }, 13026049Sminshall { "hash", hashhelp, 0, 0, 0, sethash }, 13126049Sminshall { "help", helphelp, 0, 0, 1, help }, 132*37224Skarels { "idle", idlehelp, 0, 1, 1, idle }, 13331180Sbostic { "image", binaryhelp, 0, 1, 1, setbinary }, 13426049Sminshall { "lcd", lcdhelp, 0, 0, 0, lcd }, 13526049Sminshall { "ls", lshelp, 1, 1, 1, ls }, 13626049Sminshall { "macdef", macdefhelp, 0, 0, 0, macdef }, 13726049Sminshall { "mdelete", mdeletehelp, 1, 1, 1, mdelete }, 13826049Sminshall { "mdir", mdirhelp, 1, 1, 1, mls }, 13926049Sminshall { "mget", mgethelp, 1, 1, 1, mget }, 14026049Sminshall { "mkdir", mkdirhelp, 0, 1, 1, makedir }, 14126049Sminshall { "mls", mlshelp, 1, 1, 1, mls }, 14226049Sminshall { "mode", modehelp, 0, 1, 1, setmode }, 14336935Skarels { "modtime", modtimehelp, 0, 1, 1, modtime }, 14426049Sminshall { "mput", mputhelp, 1, 1, 1, mput }, 145*37224Skarels { "newer", newerhelp, 1, 1, 1, newer }, 14626049Sminshall { "nmap", nmaphelp, 0, 0, 1, setnmap }, 14736935Skarels { "nlist", nlisthelp, 1, 1, 1, ls }, 14826049Sminshall { "ntrans", ntranshelp, 0, 0, 1, setntrans }, 14926049Sminshall { "open", connecthelp, 0, 0, 1, setpeer }, 15026049Sminshall { "prompt", prompthelp, 0, 0, 0, setprompt }, 15126049Sminshall { "proxy", proxyhelp, 0, 0, 1, doproxy }, 15226049Sminshall { "sendport", porthelp, 0, 0, 0, setport }, 15326049Sminshall { "put", sendhelp, 1, 1, 1, put }, 15426049Sminshall { "pwd", pwdhelp, 0, 1, 1, pwd }, 15526049Sminshall { "quit", quithelp, 0, 0, 0, quit }, 15626049Sminshall { "quote", quotehelp, 1, 1, 1, quote }, 15726049Sminshall { "recv", receivehelp, 1, 1, 1, get }, 158*37224Skarels { "reget", regethelp, 1, 1, 1, reget }, 15936940Skarels { "rstatus", rmtstatushelp, 0, 1, 1, rmtstatus }, 16036940Skarels { "rhelp", remotehelp, 0, 1, 1, rmthelp }, 16126049Sminshall { "rename", renamehelp, 0, 1, 1, renamefile }, 16226049Sminshall { "reset", resethelp, 0, 1, 1, reset }, 163*37224Skarels { "restart", restarthelp, 1, 1, 1, restart }, 16426049Sminshall { "rmdir", rmdirhelp, 0, 1, 1, removedir }, 16526049Sminshall { "runique", runiquehelp, 0, 0, 1, setrunique }, 16626049Sminshall { "send", sendhelp, 1, 1, 1, put }, 167*37224Skarels { "site", sitehelp, 0, 1, 1, site }, 16836935Skarels { "size", sizecmdhelp, 1, 1, 1, sizecmd }, 16926049Sminshall { "status", statushelp, 0, 0, 1, status }, 17026049Sminshall { "struct", structhelp, 0, 1, 1, setstruct }, 17136935Skarels { "system", systemhelp, 0, 1, 1, syst }, 17226049Sminshall { "sunique", suniquehelp, 0, 0, 1, setsunique }, 17326049Sminshall { "tenex", tenexhelp, 0, 1, 1, settenex }, 17426049Sminshall { "trace", tracehelp, 0, 0, 0, settrace }, 17526049Sminshall { "type", typehelp, 0, 1, 1, settype }, 17626049Sminshall { "user", userhelp, 0, 1, 1, user }, 177*37224Skarels { "umask", umaskhelp, 0, 1, 1, do_umask }, 17826049Sminshall { "verbose", verbosehelp, 0, 0, 0, setverbose }, 17926049Sminshall { "?", helphelp, 0, 0, 1, help }, 18011651Ssam { 0 }, 18110295Ssam }; 18210295Ssam 18318287Sralph int NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1; 184