home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / NETKIT-B.05 / NETKIT-B / NetKit-B-0.05 / ftp / cmdtab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-23  |  9.3 KB  |  203 lines

  1. /*
  2.  * Copyright (c) 1985, 1989 Regents of the University of California.
  3.  * 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. #ifndef lint
  35. /*static char sccsid[] = "from: @(#)cmdtab.c    5.10 (Berkeley) 6/1/90";*/
  36. static char rcsid[] = "$Id: cmdtab.c,v 1.1 1994/05/23 09:03:41 rzsfl Exp rzsfl $";
  37. #endif /* not lint */
  38.  
  39. #include "ftp_var.h"
  40.  
  41. /*
  42.  * User FTP -- Command Tables.
  43.  */
  44. int    setascii(), setbell(), setbinary(), setdebug(), setform();
  45. int    setglob(), sethash(), settick(), setmode(), setpeer(), setport();
  46. int    setprompt(), setstruct();
  47. int    settenex(), settrace(), settype(), setverbose();
  48. int    disconnect(), restart(), reget(), syst();
  49. int    cd(), lcd(), delete_cmd(), mdelete(), user();
  50. int    ls(), mls(), get(), mget(), help(), append(), put(), mput();
  51. int    quit(), renamefile(), status();
  52. int    quote(), rmthelp(), shell(), site();
  53. int    pwd(), makedir(), removedir(), setcr();
  54. int    account(), doproxy(), reset(), setcase(), setntrans(), setnmap();
  55. int    setsunique(), setrunique(), cdup(), macdef(), domacro();
  56. int    sizecmd(), modtime(), newer(), rmtstatus();
  57. int    do_chmod(), do_umask(), idle_cmd();
  58.  
  59. char    accounthelp[] =    "send account command to remote server";
  60. char    appendhelp[] =    "append to a file";
  61. char    asciihelp[] =    "set ascii transfer type";
  62. char    beephelp[] =    "beep when command completed";
  63. char    binaryhelp[] =    "set binary transfer type";
  64. char    casehelp[] =    "toggle mget upper/lower case id mapping";
  65. char    cdhelp[] =    "change remote working directory";
  66. char    cduphelp[] =     "change remote working directory to parent directory";
  67. char    chmodhelp[] =    "change file permissions of remote file";
  68. char    connecthelp[] =    "connect to remote tftp";
  69. char    crhelp[] =    "toggle carriage return stripping on ascii gets";
  70. char    deletehelp[] =    "delete remote file";
  71. char    debughelp[] =    "toggle/set debugging mode";
  72. char    dirhelp[] =    "list contents of remote directory";
  73. char    disconhelp[] =    "terminate ftp session";
  74. char    domachelp[] =     "execute macro";
  75. char    formhelp[] =    "set file transfer format";
  76. char    globhelp[] =    "toggle metacharacter expansion of local file names";
  77. char    hashhelp[] =    "toggle printing `#' for each buffer transferred";
  78. char    helphelp[] =    "print local help information";
  79. char    idlehelp[] =    "get (set) idle timer on remote side";
  80. char    lcdhelp[] =    "change local working directory";
  81. char    lshelp[] =    "list contents of remote directory";
  82. char    macdefhelp[] =  "define a macro";
  83. char    mdeletehelp[] =    "delete multiple files";
  84. char    mdirhelp[] =    "list contents of multiple remote directories";
  85. char    mgethelp[] =    "get multiple files";
  86. char    mkdirhelp[] =    "make directory on the remote machine";
  87. char    mlshelp[] =    "list contents of multiple remote directories";
  88. char    modtimehelp[] = "show last modification time of remote file";
  89. char    modehelp[] =    "set file transfer mode";
  90. char    mputhelp[] =    "send multiple files";
  91. char    newerhelp[] =    "get file if remote file is newer than local file ";
  92. char    nlisthelp[] =    "nlist contents of remote directory";
  93. char    nmaphelp[] =    "set templates for default file name mapping";
  94. char    ntranshelp[] =    "set translation table for default file name mapping";
  95. char    porthelp[] =    "toggle use of PORT cmd for each data connection";
  96. char    prompthelp[] =    "force interactive prompting on multiple commands";
  97. char    proxyhelp[] =    "issue command on alternate connection";
  98. char    pwdhelp[] =    "print working directory on remote machine";
  99. char    quithelp[] =    "terminate ftp session and exit";
  100. char    quotehelp[] =    "send arbitrary ftp command";
  101. char    receivehelp[] =    "receive file";
  102. char    regethelp[] =    "get file restarting at end of local file";
  103. char    remotehelp[] =    "get help from remote server";
  104. char    renamehelp[] =    "rename file";
  105. char    restarthelp[]=    "restart file transfer at bytecount";
  106. char    rmdirhelp[] =    "remove directory on the remote machine";
  107. char    rmtstatushelp[]="show status of remote machine";
  108. char    runiquehelp[] = "toggle store unique for local files";
  109. char    resethelp[] =    "clear queued command replies";
  110. char    sendhelp[] =    "send one file";
  111. char    sitehelp[] =    "send site specific command to remote server\n\t\tTry \"rhelp site\" or \"site help\" for more information";
  112. char    shellhelp[] =    "escape to the shell";
  113. char    sizecmdhelp[] = "show size of remote file";
  114. char    statushelp[] =    "show current status";
  115. char    structhelp[] =    "set file transfer structure";
  116. char    suniquehelp[] = "toggle store unique on remote machine";
  117. char    systemhelp[] =  "show remote system type";
  118. char    tenexhelp[] =    "set tenex file transfer type";
  119. char    tickhelp[] =    "toggle printing byte counter during transfers";
  120. char    tracehelp[] =    "toggle packet tracing";
  121. char    typehelp[] =    "set file transfer type";
  122. char    umaskhelp[] =    "get (set) umask on remote side";
  123. char    userhelp[] =    "send new user information";
  124. char    verbosehelp[] =    "toggle verbose mode";
  125.  
  126. struct cmd cmdtab[] = {
  127.     { "!",        shellhelp,    0,    0,    0,    shell },
  128.     { "$",        domachelp,    1,    0,    0,    domacro },
  129.     { "account",    accounthelp,    0,    1,    1,    account},
  130.     { "append",    appendhelp,    1,    1,    1,    put },
  131.     { "ascii",    asciihelp,    0,    1,    1,    setascii },
  132.     { "bell",    beephelp,    0,    0,    0,    setbell },
  133.     { "binary",    binaryhelp,    0,    1,    1,    setbinary },
  134.     { "bye",    quithelp,    0,    0,    0,    quit },
  135.     { "case",    casehelp,    0,    0,    1,    setcase },
  136.     { "cd",        cdhelp,        0,    1,    1,    cd },
  137.     { "cdup",    cduphelp,    0,    1,    1,    cdup },
  138.     { "chmod",    chmodhelp,    0,    1,    1,    do_chmod },
  139.     { "close",    disconhelp,    0,    1,    1,    disconnect },
  140.     { "cr",        crhelp,        0,    0,    0,    setcr },
  141.     { "delete",    deletehelp,    0,    1,    1,    delete_cmd },
  142.     { "debug",    debughelp,    0,    0,    0,    setdebug },
  143.     { "dir",    dirhelp,    1,    1,    1,    ls },
  144.     { "disconnect",    disconhelp,    0,    1,    1,    disconnect },
  145.     { "form",    formhelp,    0,    1,    1,    setform },
  146.     { "get",    receivehelp,    1,    1,    1,    get },
  147.     { "glob",    globhelp,    0,    0,    0,    setglob },
  148.     { "hash",    hashhelp,    0,    0,    0,    sethash },
  149.     { "help",    helphelp,    0,    0,    1,    help },
  150.     { "idle",    idlehelp,    0,    1,    1,    idle_cmd },
  151.     { "image",    binaryhelp,    0,    1,    1,    setbinary },
  152.     { "lcd",    lcdhelp,    0,    0,    0,    lcd },
  153.     { "ls",        lshelp,        1,    1,    1,    ls },
  154.     { "macdef",    macdefhelp,    0,    0,    0,    macdef },
  155.     { "mdelete",    mdeletehelp,    1,    1,    1,    mdelete },
  156.     { "mdir",    mdirhelp,    1,    1,    1,    mls },
  157.     { "mget",    mgethelp,    1,    1,    1,    mget },
  158.     { "mkdir",    mkdirhelp,    0,    1,    1,    makedir },
  159.     { "mls",    mlshelp,    1,    1,    1,    mls },
  160.     { "mode",    modehelp,    0,    1,    1,    setmode },
  161.     { "modtime",    modtimehelp,    0,    1,    1,    modtime },
  162.     { "mput",    mputhelp,    1,    1,    1,    mput },
  163.     { "newer",    newerhelp,    1,    1,    1,    newer },
  164.     { "nmap",    nmaphelp,    0,    0,    1,    setnmap },
  165.     { "nlist",    nlisthelp,    1,    1,    1,    ls },
  166.     { "ntrans",    ntranshelp,    0,    0,    1,    setntrans },
  167.     { "open",    connecthelp,    0,    0,    1,    setpeer },
  168.     { "prompt",    prompthelp,    0,    0,    0,    setprompt },
  169.     { "proxy",    proxyhelp,    0,    0,    1,    doproxy },
  170.     { "sendport",    porthelp,    0,    0,    0,    setport },
  171.     { "put",    sendhelp,    1,    1,    1,    put },
  172.     { "pwd",    pwdhelp,    0,    1,    1,    pwd },
  173.     { "quit",    quithelp,    0,    0,    0,    quit },
  174.     { "quote",    quotehelp,    1,    1,    1,    quote },
  175.     { "recv",    receivehelp,    1,    1,    1,    get },
  176.     { "reget",    regethelp,    1,    1,    1,    reget },
  177.     { "rstatus",    rmtstatushelp,    0,    1,    1,    rmtstatus },
  178.     { "rhelp",    remotehelp,    0,    1,    1,    rmthelp },
  179.     { "rename",    renamehelp,    0,    1,    1,    renamefile },
  180.     { "reset",    resethelp,    0,    1,    1,    reset },
  181.     { "restart",    restarthelp,    1,    1,    1,    restart },
  182.     { "rmdir",    rmdirhelp,    0,    1,    1,    removedir },
  183.     { "runique",    runiquehelp,    0,    0,    1,    setrunique },
  184.     { "send",    sendhelp,    1,    1,    1,    put },
  185.     { "site",    sitehelp,    0,    1,    1,    site },
  186.     { "size",    sizecmdhelp,    1,    1,    1,    sizecmd },
  187.     { "status",    statushelp,    0,    0,    1,    status },
  188.     { "struct",    structhelp,    0,    1,    1,    setstruct },
  189.     { "system",    systemhelp,    0,    1,    1,    syst },
  190.     { "sunique",    suniquehelp,    0,    0,    1,    setsunique },
  191.     { "tenex",    tenexhelp,    0,    1,    1,    settenex },
  192.     { "tick",    tickhelp,    0,    0,    0,    settick },
  193.     { "trace",    tracehelp,    0,    0,    0,    settrace },
  194.     { "type",    typehelp,    0,    1,    1,    settype },
  195.     { "user",    userhelp,    0,    1,    1,    user },
  196.     { "umask",    umaskhelp,    0,    1,    1,    do_umask },
  197.     { "verbose",    verbosehelp,    0,    0,    0,    setverbose },
  198.     { "?",        helphelp,    0,    0,    1,    help },
  199.     { 0 },
  200. };
  201.  
  202. int    NCMDS = (sizeof (cmdtab) / sizeof (cmdtab[0])) - 1;
  203.