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