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

📄 ckuusy.c

📁 C-Kermit源码。是使用串口/Modem和网络通讯的程序
💻 C
📖 第 1 页 / 共 5 页
字号:
      case XA_NOIN:                     /* No interrupts */#ifndef NOICP        cmdint = 0;#endif /* NOICP */        suspend = 0;        break;#ifdef IKSDB      case XA_DBFI: {          extern char * dbdir, * dbfile;          extern int dbenabled;          struct zfnfp * zz;          if ((zz = zfnqfp(p,CKMAXPATH,tmpbuf))) {              makestr(&dbdir,zz->fpath);              makestr(&dbfile,(char *)tmpbuf);          }          dbenabled = 1;          break;      }      case XA_DBAS: {          extern int dbenabled;          y = lookup(oktab,p,noktab,&z);          if (y < 0) return(-1);          dbenabled = y;          break;      }#endif /* IKSDB */      default:        return(-1);    }    return(0);}#endif /* NOICP *//*  D O A R G  --  Do a command-line argument.  */int#ifdef CK_ANSICdoarg(char x)#elsedoarg(x) char x;#endif /* CK_ANSIC *//* doarg */ {    int i, n, y, z, xx; long zz; char *xp;#ifdef NETCONN#define YYBUFLEN 256    char tmpbuf[YYBUFLEN+1];            /* Local storage for network things */    char line[YYBUFLEN+1];#endif /* NETCONN */#ifdef IKSD    /* Internet Kermit Server set some way besides -A... */    if (inserver)      dofast();#endif /* IKSD */    xp = *xargv+1;                      /* Pointer for bundled args */    debug(F111,"doarg entry",xp,xargc);    while (x) {        debug(F000,"doarg arg","",x);        switch (x) {                    /* Big switch on arg */#ifndef NOICPcase '-':                               /* Extended commands... */    if (doxarg(xargv,0) < 0) {        XFATAL("Extended option error");    }                                   /* Full thru... */case '+':                               /* Extended command for prescan() */    return(0);#else  /* NOICP */case '-':case '+':    XFATAL("Extended options not configured");#endif /* NOICP */#ifndef NOSPLcase 'C': {                             /* Commands for parser */    char * s;    xargv++, xargc--;    if ((xargc < 1) || (**xargv == '-')) {        XFATAL("No commands given for -C");    }    s = *xargv;                         /* Get the argument (must be quoted) */    if (!*s)                            /* If empty quotes */      s = NULL;                         /* ignore this option */    if (s) {        makestr(&clcmds,s);             /* Make pokeable copy */        s = clcmds;                     /* Change tabs to spaces */        while (*s) {            if (*s == '\t') *s = ' ';            s++;        }    }    break;  }#endif /* NOSPL */#ifndef NOXFERcase 'D':                               /* Delay */    if (*(xp+1)) {        XFATAL("invalid argument bundling");    }    xargv++, xargc--;    if ((xargc < 1) || (**xargv == '-')) {        XFATAL("missing delay value");    }    z = atoi(*xargv);                   /* Convert to number */    if (z > -1)                         /* If in range */      ckdelay = z;                      /* set it */    else {        XFATAL("bad delay value");    }    break;#endif /* NOXFER */case 'E':                               /* Exit on close */#ifdef NETCONN    tn_exit = 1;#endif /* NETCONN */    exitonclose = 1;    break;#ifndef NOICPcase 'S':                               /* "Stay" - enter interactive */    stayflg = 1;                        /* command parser after executing */    xfinish = 0;    break;                              /* command-line actions. */#endif /* NOICP */case 'T':                               /* File transfer mode = text */    binary = XYFT_T;    xfermode = XMODE_M;			/* Transfer mode manual */#ifdef PATTERNS    patterns = 0;#endif /* PATTERNS */    break;case '7':    break;case 'A': {				/* Internet server */    /* Already done in prescan() */    /* but implies 'x' &&  'Q'   */#ifdef NT    char * p;    if (*(xp+1)) {        XFATAL("invalid argument bundling");    }    /* Support for Pragma Systems Telnet/Terminal Servers */    p = getenv("PRAGMASYS_INETD_SOCK");    if (!(p && atoi(p) != 0)) {        xargv++, xargc--;        if (xargc < 1 || **xargv == '-') {            XFATAL("missing socket handle");	}    }#endif /* NT */#ifdef NOICP                            /* If no Interactive Command Parser */    action = 'x';                       /* -A implies -x. */#endif /* NOICP */#ifndef NOXFER    dofast();#endif /* NOXFER */    break;}#ifndef NOXFERcase 'Q':                               /* Quick (i.e. FAST) */    dofast();    break;#endif /* NOXFER */case 'R':                               /* Remote-Only */    break;                              /* This is handled in prescan(). */#ifndef NOSERVERcase 'x':                               /* server */case 'O':                               /* (for One command only) */    if (action) {        XFATAL("conflicting actions");    }    if (x == 'O') justone = 1;    xfinish = 1;    action = 'x';    break;#endif /* NOSERVER */#ifndef NOXFERcase 'f':                               /* finish */    if (action) {        XFATAL("conflicting actions");    }    action = setgen('F',"","","");    break;#endif /* NOXFER */case 'r': {                             /* receive */    if (action) {        XFATAL("conflicting actions");    }    action = 'v';    break;  }#ifndef NOXFERcase 'k':                               /* receive to stdout */    if (action) {        XFATAL("conflicting actions");    }    stdouf = 1;    action = 'v';    break;case 's':                               /* send */    if (action) {        XFATAL("conflicting actions");    }    if (*(xp+1)) {        XFATAL("invalid argument bundling after -s");    }    nfils = 0;                          /* Initialize file counter */    z = 0;                              /* Flag for stdin */    cmlist = xargv + 1;                 /* Remember this pointer */    while (--xargc > 0) {               /* Traverse the list */        xargv++;#ifdef PIPESEND        if (usepipes && protocol == PROTO_K && **xargv == '!') {            cmarg = *xargv;            cmarg++;            debug(F110,"doarg pipesend",cmarg,0);            nfils = -1;            z = 1;            pipesend = 1;        } else#endif /* PIPESEND */        if (**xargv == '-') {           /* Check for sending stdin */            if (strcmp(*xargv,"-") != 0) /* Watch out for next option. */              break;            z++;                        /* "-" alone means send from stdin. */#ifdef RECURSIVE        } else if (!strcmp(*xargv,".")) {            nfils++;            recursive = 1;#endif /* RECURSIVE */        } else if (zchki(*xargv) > -1) { /* Check if file exists */            nfils++;                    /* Bump file counter */        } else if (iswild(*xargv) && nzxpand(*xargv,0) > 0) {            /* or contains wildcard characters matching real files */            nfils++;        }    }    xargc++, xargv--;                   /* Adjust argv/argc */    if (nfils < 1 && z == 0) {#ifdef VMS        XFATAL("%CKERMIT-E-SEARCHFAIL, no files for -s");#else        XFATAL("No files for -s");#endif /* VMS */    }    if (z > 1) {        XFATAL("-s: too many -'s");    }    if (z == 1 && nfils > 0) {        XFATAL("invalid mixture of filenames and '-' in -s");    }    debug(F101,"doarg s nfils","",nfils);    debug(F101,"doarg s z","",z);    if (nfils == 0) {        if (is_a_tty(0)) {              /* (used to be is_a_tty(1) - why?) */            XFATAL("sending from terminal not allowed");        } else stdinf = 1;    }    debug(F101,"doarg s stdinf","",stdinf);    debug(F111,"doarg",*xargv,nfils);    action = 's';    break;case 'g':                               /* get */case 'G':                               /* get to stdout */    if (action) {        XFATAL("conflicting actions");    }    if (*(xp+1)) {        XFATAL("invalid argument bundling after -g");    }    xargv++, xargc--;    if ((xargc == 0) || (**xargv == '-')) {        XFATAL("missing filename for -g");    }    if (x == 'G') stdouf = 1;    cmarg = *xargv;    action = 'r';    break;#endif /* NOXFER */#ifndef NOLOCALcase 'c':                               /* connect before */    cflg = 1;    break;case 'n':                               /* connect after */    cnflg = 1;    break;#endif /* NOLOCAL */case 'h':                               /* help */    usage();#ifndef NOICP    if (stayflg || what == W_COMMAND)      break;    else#endif /* NOICP */      doexit(GOOD_EXIT,-1);#ifndef NOXFERcase 'a':                               /* "as" */    if (*(xp+1)) {        XFATAL("invalid argument bundling after -a");    }    xargv++, xargc--;    if ((xargc < 1) || (**xargv == '-')) {        XFATAL("missing name in -a");    }    cmarg2 = *xargv;    debug(F111,"doarg a",cmarg2,xargc);    break;#endif /* NOXFER */#ifndef NOICPcase 'Y':                               /* No initialization file */    noinit = 1;    break;case 'y':                               /* Alternate init-file name */    if (*(xp+1)) {        XFATAL("invalid argument bundling after -y");    }    xargv++, xargc--;    if (xargc < 1) {        XFATAL("missing filename in -y");    }    /* strcpy(kermrc,*xargv); ...this was already done in prescan()... */    break;#endif /* NOICP */#ifndef NOXFERcase 'I':                               /* Assume we have an "Internet" */    reliable = 1;                       /* or other reliable connection */    xreliable = 1;    setreliable = 1;    /* I'm not so sure about this -- what about VMS? (next comment) */    clearrq = 1;                        /* therefore the channel is clear */#ifndef VMS/*  Since this can trigger full control-character unprefixing, we need to  ensure that our terminal or pty driver is not doing Xon/Xoff; otherwise  we can become deadlocked the first time we receive a file that contains  Xoff.*/    flow = FLO_NONE;#endif /* VMS */    break;#endif /* NOXFER */#ifndef NOLOCALcase 'l':                               /* SET LINE */#ifdef NETCONN#ifdef ANYX25case 'X':                               /* SET HOST to X.25 address */#ifdef SUNX25case 'Z':                               /* SET HOST to X.25 file descriptor */#endif /* SUNX25 */#endif /* ANYX25 */#ifdef TCPSOCKETcase 'J':case 'j':                               /* SET HOST (TCP/IP socket) */#endif /* TCPSOCKET */#endif /* NETCONN */#ifndef NOXFER    if (x == 'j' || x == 'J' || x == 'X' || x == 'Z') {        reliable = 1;                   /* or other reliable connection */        xreliable = 1;        setreliable = 1;    }#endif /* NOXFER */    network = 0;    if (*(xp+1)) {        XFATAL("invalid argument bundling after -l or -j");    }    xargv++, xargc--;    if ((xargc < 1) || (**xargv == '-')) {        XFATAL("communication line device name missing");    }#ifdef NETCONN    if (x == 'J') {        cflg    = 1;                    /* Connect */        stayflg = 1;                    /* Stay */        tn_exit = 1;                    /* Telnet-like exit condition */        exitonclose = 1;    }#endif /* NETCONN */    ckstrncpy(ttname,*xargv,TTNAMLEN+1);    local = (strcmp(ttname,CTTNAM) != 0);    if (local && strcmp(ttname,"0") == 0)      local = 0;/*  NOTE: We really do not need to call ttopen here, since it should be called  again later, automatically, when we first try to condition the device via  ttpkt or ttvt.  Calling ttopen here has the bad side effect of making the  order of the -b and -l options significant, but order of command-line options  should not matter.  However, the network cases immediately below complicate  matters a bit, so we'll settle this in a future edit.

⌨️ 快捷键说明

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