[BACK]Return to cmdtab.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ftp

Annotation of src/usr.bin/ftp/cmdtab.c, Revision 1.3

1.3     ! kstailey    1: /*      $OpenBSD: cmdtab.c,v 1.2 1996/06/26 05:33:34 deraadt Exp $      */
1.1       deraadt     2: /*      $NetBSD: cmdtab.c,v 1.6 1995/09/08 01:06:10 tls Exp $      */
                      3:
                      4: /*
                      5:  * Copyright (c) 1985, 1989, 1993, 1994
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the University of
                     19:  *     California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  */
                     36:
                     37: #ifndef lint
                     38: #if 0
                     39: static char sccsid[] = "@(#)cmdtab.c   8.4 (Berkeley) 10/9/94";
                     40: #else
1.3     ! kstailey   41: static char rcsid[] = "$OpenBSD: cmdtab.c,v 1.2 1996/06/26 05:33:34 deraadt Exp $";
1.1       deraadt    42: #endif
                     43: #endif /* not lint */
                     44:
                     45: #include <stdio.h>
                     46: #include "ftp_var.h"
                     47:
                     48: /*
                     49:  * User FTP -- Command Tables.
                     50:  */
                     51:
                     52: char   accounthelp[] = "send account command to remote server";
                     53: char   appendhelp[] =  "append to a file";
                     54: char   asciihelp[] =   "set ascii transfer type";
                     55: char   beephelp[] =    "beep when command completed";
                     56: char   binaryhelp[] =  "set binary transfer type";
                     57: char   casehelp[] =    "toggle mget upper/lower case id mapping";
                     58: char   cdhelp[] =      "change remote working directory";
                     59: char   cduphelp[] =    "change remote working directory to parent directory";
                     60: char   chmodhelp[] =   "change file permissions of remote file";
                     61: char   connecthelp[] = "connect to remote tftp";
                     62: char   crhelp[] =      "toggle carriage return stripping on ascii gets";
                     63: char   deletehelp[] =  "delete remote file";
                     64: char   debughelp[] =   "toggle/set debugging mode";
                     65: char   dirhelp[] =     "list contents of remote directory";
                     66: char   disconhelp[] =  "terminate ftp session";
                     67: char   domachelp[] =   "execute macro";
                     68: char   formhelp[] =    "set file transfer format";
                     69: char   globhelp[] =    "toggle metacharacter expansion of local file names";
1.3     ! kstailey   70: char   hashhelp[] =    "toggle printing `#' marks; specify number to set size";
1.1       deraadt    71: char   helphelp[] =    "print local help information";
                     72: char   idlehelp[] =    "get (set) idle timer on remote side";
                     73: char   lcdhelp[] =     "change local working directory";
                     74: char   lshelp[] =      "list contents of remote directory";
                     75: char   macdefhelp[] =  "define a macro";
                     76: char   mdeletehelp[] = "delete multiple files";
                     77: char   mdirhelp[] =    "list contents of multiple remote directories";
                     78: char   mgethelp[] =    "get multiple files";
                     79: char   mkdirhelp[] =   "make directory on the remote machine";
                     80: char   mlshelp[] =     "list contents of multiple remote directories";
                     81: char   modtimehelp[] = "show last modification time of remote file";
                     82: char   modehelp[] =    "set file transfer mode";
                     83: char   mputhelp[] =    "send multiple files";
                     84: char   newerhelp[] =   "get file if remote file is newer than local file ";
                     85: char   nlisthelp[] =   "nlist contents of remote directory";
                     86: char   nmaphelp[] =    "set templates for default file name mapping";
                     87: char   ntranshelp[] =  "set translation table for default file name mapping";
                     88: char   porthelp[] =    "toggle use of PORT cmd for each data connection";
                     89: char   prompthelp[] =  "force interactive prompting on multiple commands";
                     90: char   proxyhelp[] =   "issue command on alternate connection";
                     91: char   pwdhelp[] =     "print working directory on remote machine";
                     92: char   quithelp[] =    "terminate ftp session and exit";
                     93: char   quotehelp[] =   "send arbitrary ftp command";
                     94: char   receivehelp[] = "receive file";
                     95: char   regethelp[] =   "get file restarting at end of local file";
                     96: char   remotehelp[] =  "get help from remote server";
                     97: char   renamehelp[] =  "rename file";
                     98: char   restarthelp[]=  "restart file transfer at bytecount";
                     99: char   rmdirhelp[] =   "remove directory on the remote machine";
                    100: char   rmtstatushelp[]="show status of remote machine";
                    101: char   runiquehelp[] = "toggle store unique for local files";
                    102: char   resethelp[] =   "clear queued command replies";
                    103: char   sendhelp[] =    "send one file";
                    104: char   passivehelp[] = "enter passive transfer mode";
                    105: char   sitehelp[] =    "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
                    106: char   shellhelp[] =   "escape to the shell";
                    107: char   sizecmdhelp[] = "show size of remote file";
                    108: char   statushelp[] =  "show current status";
                    109: char   structhelp[] =  "set file transfer structure";
                    110: char   suniquehelp[] = "toggle store unique on remote machine";
                    111: char   systemhelp[] =  "show remote system type";
                    112: char   tenexhelp[] =   "set tenex file transfer type";
                    113: char   tracehelp[] =   "toggle packet tracing";
                    114: char   typehelp[] =    "set file transfer type";
                    115: char   umaskhelp[] =   "get (set) umask on remote side";
                    116: char   userhelp[] =    "send new user information";
                    117: char   verbosehelp[] = "toggle verbose mode";
                    118:
                    119: struct cmd cmdtab[] = {
                    120:        { "!",          shellhelp,      0,      0,      0,      shell },
                    121:        { "$",          domachelp,      1,      0,      0,      domacro },
                    122:        { "account",    accounthelp,    0,      1,      1,      account},
                    123:        { "append",     appendhelp,     1,      1,      1,      put },
                    124:        { "ascii",      asciihelp,      0,      1,      1,      setascii },
                    125:        { "bell",       beephelp,       0,      0,      0,      setbell },
                    126:        { "binary",     binaryhelp,     0,      1,      1,      setbinary },
                    127:        { "bye",        quithelp,       0,      0,      0,      quit },
                    128:        { "case",       casehelp,       0,      0,      1,      setcase },
                    129:        { "cd",         cdhelp,         0,      1,      1,      cd },
                    130:        { "cdup",       cduphelp,       0,      1,      1,      cdup },
                    131:        { "chmod",      chmodhelp,      0,      1,      1,      do_chmod },
                    132:        { "close",      disconhelp,     0,      1,      1,      disconnect },
                    133:        { "cr",         crhelp,         0,      0,      0,      setcr },
                    134:        { "delete",     deletehelp,     0,      1,      1,      delete },
                    135:        { "debug",      debughelp,      0,      0,      0,      setdebug },
                    136:        { "dir",        dirhelp,        1,      1,      1,      ls },
                    137:        { "disconnect", disconhelp,     0,      1,      1,      disconnect },
                    138:        { "form",       formhelp,       0,      1,      1,      setform },
                    139:        { "get",        receivehelp,    1,      1,      1,      get },
                    140:        { "glob",       globhelp,       0,      0,      0,      setglob },
                    141:        { "hash",       hashhelp,       0,      0,      0,      sethash },
                    142:        { "help",       helphelp,       0,      0,      1,      help },
                    143:        { "idle",       idlehelp,       0,      1,      1,      idle },
                    144:        { "image",      binaryhelp,     0,      1,      1,      setbinary },
                    145:        { "lcd",        lcdhelp,        0,      0,      0,      lcd },
                    146:        { "ls",         lshelp,         1,      1,      1,      ls },
                    147:        { "macdef",     macdefhelp,     0,      0,      0,      macdef },
                    148:        { "mdelete",    mdeletehelp,    1,      1,      1,      mdelete },
                    149:        { "mdir",       mdirhelp,       1,      1,      1,      mls },
                    150:        { "mget",       mgethelp,       1,      1,      1,      mget },
                    151:        { "mkdir",      mkdirhelp,      0,      1,      1,      makedir },
                    152:        { "mls",        mlshelp,        1,      1,      1,      mls },
                    153:        { "mode",       modehelp,       0,      1,      1,      setftmode },
                    154:        { "modtime",    modtimehelp,    0,      1,      1,      modtime },
                    155:        { "mput",       mputhelp,       1,      1,      1,      mput },
                    156:        { "newer",      newerhelp,      1,      1,      1,      newer },
                    157:        { "nmap",       nmaphelp,       0,      0,      1,      setnmap },
                    158:        { "nlist",      nlisthelp,      1,      1,      1,      ls },
                    159:        { "ntrans",     ntranshelp,     0,      0,      1,      setntrans },
                    160:        { "open",       connecthelp,    0,      0,      1,      setpeer },
                    161:        { "passive",    passivehelp,    0,      0,      0,      setpassive },
                    162:        { "prompt",     prompthelp,     0,      0,      0,      setprompt },
                    163:        { "proxy",      proxyhelp,      0,      0,      1,      doproxy },
                    164:        { "sendport",   porthelp,       0,      0,      0,      setport },
                    165:        { "put",        sendhelp,       1,      1,      1,      put },
                    166:        { "pwd",        pwdhelp,        0,      1,      1,      pwd },
                    167:        { "quit",       quithelp,       0,      0,      0,      quit },
                    168:        { "quote",      quotehelp,      1,      1,      1,      quote },
                    169:        { "recv",       receivehelp,    1,      1,      1,      get },
                    170:        { "reget",      regethelp,      1,      1,      1,      reget },
                    171:        { "rstatus",    rmtstatushelp,  0,      1,      1,      rmtstatus },
                    172:        { "rhelp",      remotehelp,     0,      1,      1,      rmthelp },
                    173:        { "rename",     renamehelp,     0,      1,      1,      renamefile },
                    174:        { "reset",      resethelp,      0,      1,      1,      reset },
                    175:        { "restart",    restarthelp,    1,      1,      1,      restart },
                    176:        { "rmdir",      rmdirhelp,      0,      1,      1,      removedir },
                    177:        { "runique",    runiquehelp,    0,      0,      1,      setrunique },
                    178:        { "send",       sendhelp,       1,      1,      1,      put },
                    179:        { "site",       sitehelp,       0,      1,      1,      site },
                    180:        { "size",       sizecmdhelp,    1,      1,      1,      sizecmd },
                    181:        { "status",     statushelp,     0,      0,      1,      status },
                    182:        { "struct",     structhelp,     0,      1,      1,      setstruct },
                    183:        { "system",     systemhelp,     0,      1,      1,      syst },
                    184:        { "sunique",    suniquehelp,    0,      0,      1,      setsunique },
                    185:        { "tenex",      tenexhelp,      0,      1,      1,      settenex },
                    186:        { "trace",      tracehelp,      0,      0,      0,      settrace },
                    187:        { "type",       typehelp,       0,      1,      1,      settype },
                    188:        { "user",       userhelp,       0,      1,      1,      user },
                    189:        { "umask",      umaskhelp,      0,      1,      1,      do_umask },
                    190:        { "verbose",    verbosehelp,    0,      0,      0,      setverbose },
                    191:        { "?",          helphelp,       0,      0,      1,      help },
                    192:        { 0 },
                    193: };
                    194:
                    195: int    NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;