⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ckuusy.c

📁 C-Kermit源码。是使用串口/Modem和网络通讯的程序
💻 C
📖 第 1 页 / 共 5 页
字号:
        if (!strcmp(*xargv,"--"))       /* getopt() conformance */          return(0);#ifdef VMS        else if (**xargv == '/')          continue;#endif /* VMS */        else if (**xargv == '-') {      /* Got an option (begins with dash) */            int xx;            x = *(*xargv+1);            /* Get the option letter */            debug(F111,"cmdlin args 1",*xargv,xargc);            xx = doarg(x);            debug(F101,"cmdlin doarg","",xx);            debug(F111,"cmdlin args 2",*xargv,xargc);            if (xx < 0) {#ifndef NOICP                if (what == W_COMMAND)                  return(0);                else#endif /* NOICP */                  {#ifdef OS2                      sleep(1);         /* Give it a chance... */#endif /* OS2 */                      doexit(BAD_EXIT,1); /* Go handle option */                  }            }        } else {                        /* No dash where expected */            char buf[128];            sprintf(buf,                    "invalid command-line option, type \"%s -h\" for help",                    myname                    );            fatal2(*xargv,buf);        }    }#ifdef DEBUG    if (deblog) {#ifndef NOICP        debug(F101,"cmdlin what","",what);#endif /* NOICP */        debug(F101,"cmdlin action","",action);#ifndef NOXFER        debug(F101,"cmdlin stdouf","",stdouf);#endif /* NOXFER */    }#endif /* DEBUG */#ifdef NOICP    if (!action && !cflg && !cnflg) {        debug(F100,"cmdlin NOICP fatal no action","",0);        XFATAL("?No actions specified on command line");    }#else    if (inserver && what == 0) {        /* Internet Kermit server checks */        if (local || (action != 0 && action != 'x')) {            if (local)              printf("local\r\n");            if (action)              printf("action=%c\r\n",action);            debug(F100,"cmdlin fatal 1","",0);            XFATAL("No actions or connections allowed with -A");        }    }#endif /* NOICP */#ifndef NOLOCAL    if (!local) {        if ((action == 'c') || (cflg != 0)) {            debug(F100,"cmdlin fatal 2","",0);            XFATAL("-l or -j or -X required");        }    }#endif /* NOLOCAL */#ifndef NOXFER    if (*cmarg2 != 0) {        if ((action != 's') && (action != 'r') && (action != 'v')) {            debug(F100,"cmdlin fatal 3","",0);            XFATAL("-a without -s, -r, or -g");        }        if (action == 'r' || action == 'v') {#ifdef CK_TMPDIR            if (isdir(cmarg2)) {        /* -a is a directory */                if (!zchdir(cmarg2)) {  /* try to change to it */                    debug(F100,"cmdlin fatal 4","",0);                    XFATAL("can't change to '-a' directory");                } else cmarg2 = "";            } else#endif /* CK_TMPDIR */              if (zchko(cmarg2) < 0) {                  debug(F100,"cmdlin fatal 5","",0);                  XFATAL("write access to -a file denied");              }        }    }    if ((action == 'v') && (stdouf) && (!local)) {        if (is_a_tty(1)) {            debug(F100,"cmdlin fatal 6","",0);            XFATAL("unredirected -k can only be used in local mode");        }    }    if ((action == 's') || (action == 'v') ||        (action == 'r') || (action == 'x')) {        if (local)          displa = 1;        if (stdouf) {            displa = 0;            quiet = 1;        }    }    if (quiet) displa = 0;              /* No display if quiet requested */#endif /* NOXFER */#ifdef DEBUG    if (action)      debug(F000,"cmdlin returns action","",action);    else      debug(F101,"cmdlin returns action","",action);#endif /* DEBUG */    return(action);                     /* Then do any requested protocol */}/* Extended argument parsing: --keyword[:value] (or =value) *//*  XA_xxxx symbols are defined in ckuusr.h.  If you add a new one, also remember to update doshow(),  SHXOPT section, in ckuus5.c.*/#ifndef NOICPstruct keytab xargtab[] = {#ifdef CK_LOGIN    "anonymous",   XA_ANON, CM_ARG|CM_PRE,#endif /* CK_LOGIN */    "bannerfile",  XA_BAFI, CM_ARG,    "cdfile",      XA_CDFI, CM_ARG,    "cdmessage",   XA_CDMS, CM_ARG,    "cdmsg",       XA_CDMS, CM_ARG|CM_INV,#ifdef IKSDB    "database",    XA_DBAS, CM_ARG|CM_PRE,    "dbfile",      XA_DBFI, CM_ARG|CM_PRE,#endif /* IKSDB */    "help",        XA_HELP, 0,#ifndef NOHELP    "helpfile",    XA_HEFI, CM_ARG,#endif /* NOHELP */#ifdef CK_LOGIN    "initfile",    XA_ANFI, CM_ARG|CM_PRE,#endif /* CK_LOGIN */    "nointerrupts",XA_NOIN, CM_PRE,#ifdef CK_LOGIN#ifdef CK_PERM    "permissions", XA_PERM, CM_ARG|CM_PRE,    "perms",       XA_PERM, CM_ARG|CM_PRE|CM_INV,#endif /* CK_PERM */#ifdef CK_LOGIN    "privid",      XA_PRIV, CM_ARG|CM_PRE,#endif /* CK_LOGIN */#ifdef UNIX    "root",        XA_ROOT, CM_ARG|CM_PRE,#endif /* UNIX */#ifdef CKSYSLOG    "syslog",      XA_SYSL, CM_ARG|CM_PRE,    "timeout",     XA_TIMO, CM_ARG|CM_PRE,#endif /* CKSYSLOG */    "userfile",    XA_USFI, CM_ARG|CM_PRE,#ifdef CKWTMP    "wtmpfile",    XA_WTFI, CM_ARG|CM_PRE,    "wtmplog",     XA_WTMP, CM_ARG|CM_PRE,#endif /* CKWTMP */#endif /* CK_LOGIN */    "xferfile",    XA_IKFI, CM_ARG|CM_PRE,    "xferlog",     XA_IKLG, CM_ARG|CM_PRE,    "",            0,       0};int nxargs = sizeof(xargtab)/sizeof(struct keytab) - 1;static struct keytab oktab[] = {    "0",     0, 0,    "1",     1, 0,    "2",     2, 0,    "3",     3, 0,    "4",     4, 0,    "5",     5, 0,    "6",     6, 0,    "7",     7, 0,    "8",     8, 0,    "9",     9, 0,    "false", 0, 0,    "no",    0, 0,    "off",   0, 0,    "ok",    1, 0,    "on",    1, 0,    "true",  1, 0,    "yes",   1, 0};static int noktab = sizeof(oktab)/sizeof(struct keytab);#define XARGBUFL 32char * bannerfile = NULL;char * helpfile = NULL;extern int xferlog;extern char * xferfile;#ifndef NOHELPchar * xopthlp[XA_MAX+1];               /* Extended option help */char * xarghlp[XA_MAX+1];               /* Extended argument for option */static VOIDinixopthlp() {    int i, j, n;    for (i = 0; i <= XA_MAX; i++) {     /* Initialize all to null */        xopthlp[i] = NULL;        xarghlp[i] = NULL;    }    for (i = 0; i < nxargs; i++) {      /* Then for each defined keyword */        j = xargtab[i].kwval;           /* index by associated value */        if (j < 0 || j > XA_MAX)          continue;        switch (j) {#ifdef CK_LOGIN          case XA_ANON:                 /* "--anonymous" */            xopthlp[j] = "--anonymous:{on,off} [IKSD only]";            xarghlp[j] = "Whether to allow anonymous IKSD logins";            break;	  case XA_PRIV:            xopthlp[j] = "--privid:{on,off} [IKSD only]";            xarghlp[j] = "Whether to allow privileged IDs to login to IKSD";            break;#endif /* CK_LOGIN */          case XA_BAFI:                 /* "--bannerfile" */            xopthlp[j] = "--bannerfile:<filename>";            xarghlp[j] = "File to display upon startup or IKSD login";            break;          case XA_CDFI:                 /* "--cdfile" */            xopthlp[j] = "--cdfile:<filename>";            xarghlp[j] = "File to display when server changes directory";            break;          case XA_CDMS:                 /* "--cdmessage" */            xopthlp[j] = "--cdmessage:{on,off}";            xarghlp[j] = "Whether to display CD message file";            break;          case XA_HELP:                 /* "--help" */            xopthlp[j] = "--help";            xarghlp[j] = "Print this help text about extended options";            break;          case XA_HEFI:                 /* "--help" */            xopthlp[j] = "--helpfile:<filename>";            xarghlp[j] = "File containing custom info for HELP command";            break;          case XA_IKFI:                 /* "--xferfile" */            xopthlp[j] = "--xferfile:<filename> [IKSD only]";            xarghlp[j] = "Name of ftpd-like logfile.";            break;          case XA_IKLG:                 /* "--xferlog" */            xopthlp[j] = "--xferlog:{on,off} [IKSD only]";            xarghlp[j] = "Whether to keep an ftpd-like logfile.";            break;#ifdef CK_LOGIN          case XA_ANFI:                 /* "--initfile" */            xopthlp[j] = "--initfile:<filename> [IKSD only]";            xarghlp[j] = "Initialization file for anonymous users.";            break;#ifdef CK_PERM          case XA_PERM:                 /* "--permissions" */            xopthlp[j] = "--permissions:<octalnum> [IKSD only]";            xarghlp[j] = "Permissions for files uploaded by anonymous users.";            break;#endif /* CK_PERM */#ifdef UNIX          case XA_ROOT:                 /* "--root" */            xopthlp[j] = "--root:<directory> [IKSD only]";            xarghlp[j] = "File-system root for anonymous users.";            break;#endif /* UNIX */#endif /* CK_LOGIN */#ifdef CKSYSLOG          case XA_SYSL:                 /* "--syslog" */            xopthlp[j] = "--syslog:<digit> [IKSD only]";            xarghlp[j] = "Syslog recording level, 0-6.";            break;#endif /* CKSYSLOG */          case XA_USFI:                 /* "--userfile" */            xopthlp[j] = "--userfile:<filename> [IKSD only]";            xarghlp[j] = "Forbidden user file.";            break;#ifdef CKWTMP          case XA_WTFI:                 /* "--wtmpfile" */            xopthlp[j] = "--wtmpfile:<filename> [IKSD only]";            xarghlp[j] = "Name of wtmp logfile.";            break;          case XA_WTMP:                 /* "--wtmplog" */            xopthlp[j] = "--wtmplog:{on,off} [IKSD only]";            xarghlp[j] = "Whether to keep a wtmp logfile.";            break;#endif /* CKWTMP */#ifdef CK_LOGIN          case XA_TIMO:                 /* "--timeout" */            xopthlp[j] = "--timeout:<seconds> [IKSD only]";            xarghlp[j] = "How long to wait for login before closing the connection.";            break;#endif /* CK_LOGIN */          case XA_NOIN:            xopthlp[j] = "--nointerrupts";            xarghlp[j] = "Disable keyboard interrupts.";            break;#ifdef IKSDB          case XA_DBAS:            xopthlp[j] = "--database:{on,off}";            xarghlp[j] = "Enable/Disable IKSD database (IKSD only)";            break;          case XA_DBFI:            xopthlp[j] = "--dbfile:<filename>";            xarghlp[j] = "Specify IKSD database file (IKSD only)";            break;#endif /* IKSDB */        }    }}VOIDiniopthlp() {    int i;    for (i = 0; i < 128; i++) {        optact[i] = 0;        switch(i) {#ifdef OS2          case '#':                     /* K95 Startup Flags */            opthlp[i] = "Kermit 95 Startup Flags";            arghlp[i] =              "   1 - turn off Win95 special fixes\n"\              "   2 - do not load optional network dlls\n"\              "   4 - do not load optional tapi dlls\n"\              "   8 - do not load optional kerberos dlls\n"\              "  16 - do not load optional zmodem dlls\n"\              "  32 - use stdin for input instead of the console\n"\              "  64 - use stdout for output instead of the console\n"\              " 128 - do not terminate process in response to Session Logoff";            break;#endif /* OS2 */          case '0':                     /* In the middle */            opthlp[i] =              "100% transparent CONNECT mode for \"in-the-middle\" operation";            arghlp[i] = NULL;            break;          case '8':            opthlp[i] = "Connection is 8-bit clean";            arghlp[i] = NULL;            break;          case 'A':            opthlp[i] = "C-Kermit is to be started as an Internet service";#ifdef NT            arghlp[i] = "  socket handle of incoming connection";#else /* NT */            arghlp[i] = NULL;#endif /* NT */            break;          case 'B': opthlp[i] =            "C-Kermit is running in Batch (no controlling terminal)";            break;#ifndef NOSPL          case 'C':            opthlp[i] = "Interactive-mode Commands to be executed";            arghlp[i] = "Commands separated by commas, list in doublequotes";            break;#endif /* NOSPL */          case 'D':            opthlp[i] = "Delay before starting to send";            arghlp[i] = "Number of seconds";            break;          case 'E':            opthlp[i] = "Exit automatically when connection closes";            arghlp[i] = NULL;            break;#ifdef TCPSOCKET          case 'F':            opthlp[i] = "Make a TCP connection";            arghlp[i] = "Numeric file descriptor of open TCP connection";            break;#endif /* TCPSOCKET */          case 'G':            opthlp[i] = "GET from server, send to standard output";            arghlp[i] = "Remote file specification";            optact[i] = 1;            break;          case 'H':            opthlp[i] = "Suppress program startup Herald and greeting";            arghlp[i] = NULL;            break;          case 'I':            opthlp[i] = "Connection is relIable, streaming is allowed";            arghlp[i] = NULL;            break;#ifdef TCPSOCKET          case 'J':            opthlp[i] = "'Be like Telnet'";            arghlp[i] = "IP hostname/address optionally followed by socket";            break;#endif /* TCPSOCKET */          case 'L':            opthlp[i] = "Recursive directory descent for files in -s option";            arghlp[i] = NULL;            break;          case 'M':            opthlp[i] = "My user name (for use with Telnet, Rlogin, etc)";            arghlp[i] = "Username string";            break;#ifdef NETBIOS          case 'N':            opthlp[i] = "NETBIOS adapter number";            arghlp[i] = "Number";            break;#endif /* NETBIOS */          case 'O':                     /* Be a server for One command only */            opthlp[i] = "Be a server for One command only";            arghlp[i] = NULL;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -