home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnunet10.zip / source / ftp / cmdtab.c < prev    next >
C/C++ Source or Header  |  1996-02-12  |  9KB  |  189 lines

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