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

📄 ckcmai.c

📁 C-Kermit源码。是使用串口/Modem和网络通讯的程序
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifndef NOSERVER/*  Server services:   0 = disabled   1 = enabled in local mode   2 = enabled in remote mode   3 = enabled in both local and remote modes  only as initial (default) values.*/int en_xit = 2;                         /* EXIT */int en_cwd = 3;                         /* CD/CWD */int en_cpy = 3;                         /* COPY   */int en_del = 2;                         /* DELETE */int en_mkd = 3;                         /* MKDIR */int en_rmd = 2;                         /* RMDIR */int en_dir = 3;                         /* DIRECTORY */int en_fin = 3;                         /* FINISH */int en_get = 3;                         /* GET */#ifndef NOPUSHint en_hos = 2;                         /* HOST enabled */#elseint en_hos = 0;                         /* HOST disabled */#endif /* NOPUSH */int en_ren = 3;                         /* RENAME */int en_sen = 3;                         /* SEND */int en_set = 3;                         /* SET */int en_spa = 3;                         /* SPACE */int en_typ = 3;                         /* TYPE */int en_who = 3;                         /* WHO */#ifdef datageneral/* Data General AOS/VS can't do this */int en_bye = 0;                         /* BYE */#elseint en_bye = 2;                         /* PCs in local mode... */#endif /* datageneral */int en_asg = 3;                         /* ASSIGN */int en_que = 3;                         /* QUERY */int en_ret = 2;                         /* RETRIEVE */int en_mai = 3;                         /* MAIL */int en_pri = 3;                         /* PRINT */int en_ena = 3;                         /* ENABLE */#elseint en_xit = 0, en_cwd = 0, en_cpy = 0, en_del = 0, en_mkd = 0, en_rmd = 0,    en_dir = 0, en_fin = 0, en_get = 0, en_hos = 0, en_ren = 0, en_sen = 0,    en_set = 0, en_spa = 0, en_typ = 0, en_who = 0, en_bye = 0, en_asg = 0,    en_que = 0, en_ret = 0, en_mai = 0, en_pri = 0, en_ena = 0;#endif /* NOSERVER */#endif /* NOXFER *//* Miscellaneous */char **xargv;                           /* Global copies of argv */int  xargc;                             /* and argc  */int xargs;                              /* an immutable copy of argc */char *xarg0;                            /* and of argv[0] */char *pipedata;                         /* Pointer to -P (pipe) data */extern char *dftty;                     /* Default tty name from ck?tio.c */extern int dfloc;                       /* Default location: remote/local */extern int dfprty;                      /* Default parity */extern int dfflow;                      /* Default flow control */#ifdef TNCODEextern int tn_deb;#endif /* TNCODE *//*  Buffered file input and output buffers.  See getpkt() in ckcfns.c  and zoutdump() in the system-dependent file i/o module (usually ck?fio.c).*/#ifndef DYNAMIC/* Now we allocate them dynamically, see getiobs() below. */char zinbuffer[INBUFSIZE], zoutbuffer[OBUFSIZE];#endif /* DYNAMIC */char *zinptr, *zoutptr;int zincnt, zoutcnt;int zobufsize = OBUFSIZE;int zofbuffer = 1;int zofblock  = 1;#ifdef SESLIMITint seslimit = 0;#endif /* SESLIMIT */#ifdef CK_AUTHENTICATION#include "ckuath.h"#endif /* CK_AUTHENTICATION */_PROTOTYP( int getiobs, (VOID) );/*  M A I N  --  C-Kermit main program  */#include <signal.h>#ifndef NOCCTRAP#include <setjmp.h>#include "ckcsig.h"ckjmpbuf cmjbuf;#ifdef GEMDOS                           /* Special for Atari ST */cc_clean();                             /* This can't be right? */#endif /* GEMDOS */#endif /* NOCCTRAP */#ifndef NOXFER/* Info associated with a system ID */struct sysdata sysidlist[] = {          /* Add others as needed... */  { "0",  "anonymous",    0, NUL,  0, 0, 0 },  { "A1", "Apple II",     0, NUL,  0, 0, 3 }, /* fix this */  { "A3", "Macintosh",    1, ':',  0, 2, 1 },  { "D7", "VMS",          0, ']',  1, 0, 0 },  { "DA", "RSTS/E",       0, ']',  1, 0, 3 }, /* (i think...) */  { "DB", "RT11",         0, NUL,  1, 0, 3 }, /* (maybe...) */  { "F3", "AOS/VS",       1, ':',  0, 0, 2 },  { "I1", "VM/CMS",       0, NUL,  0, 0, 0 },  { "I2", "MVS/TSO",      0, NUL,  0, 0, 0 },  { "I4", "MUSIC",        0, NUL,  0, 0, 0 },  { "I7", "CICS",         0, NUL,  0, 0, 0 },  { "I9", "MVS/ROSCOE",   0, NUL,  0, 0, 0 },  { "K2", "Atari ST",     1, '\\', 1, 0, 3 },  { "L3", "Amiga",        1, '/',  1, 0, 2 },  { "MV", "Stratus VOS",  1, '>',  0, 1, 0 },  { "N3", "Apollo Aegis", 1, '/',  0, 3, 2 },  { "U1", "UNIX",         1, '/',  0, 3, 2 },  { "U8", "MS-DOS",       1, '\\', 1, 0, 3 },  { "UD", "OS-9",         1, '/',  0, 3, 2 },  { "UN", "Windows-32",   1, '\\', 1, 2, 3 },  { "UO", "OS/2",         1, '\\', 1, 2, 3 }};static int nxxsysids = (sizeof(sysidlist) / sizeof(struct sysdata));/* Given a Kermit system ID code, return the associated name string *//* and some properties of the filenames... */char *getsysid(s) char * s; {                 /* Get system-type name */    int i;    if (!s) return("");    for (i = 0; i < nxxsysids; i++)      if (!strcmp(sysidlist[i].sid_code,s))        return(sysidlist[i].sid_name);    return(s);}intgetsysix(s) char *s; {                  /* Get system-type index */    int i;    if (!s) return(-1);    for (i = 0; i < nxxsysids; i++)      if (!strcmp(sysidlist[i].sid_code,s))        return(i);    return(-1);}#endif /* NOXFER *//* Tell if a pathname is absolute (versus relative) *//* This should be parceled out to each of the ck*fio.c modules... */intisabsolute(path) char * path; {    int rc = 0;    int x;    if (!path)      return(0);    if (!*path)      return(0);    x = (int) strlen(path);    debug(F111,"isabsolute",path,x);#ifdef VMS    rc = 0;    x = ckindex("[",path,0,0,0);        /* 1-based */    if (!x)       x = ckindex("<",path,0,0,0);    debug(F111,"isabsolute left bracket",path,x);    if (!x) {        x = ckindex(":",path,-1,1,1);        if (x)          debug(F111,"isabsolute logical",path,x);    }    if (x > 0)      if (path[x] != '.')               /* 0-based */        rc = 1;#else#ifdef UNIX    if (*path == '/'#ifdef DTILDE        || *path == '~'#endif /* DTILDE */        )      rc = 1;#else#ifdef OS2    if (*path == '/' || *path == '\\')      rc = 1;    else if (isalpha(*path) && x > 1)      if (*(path+1) == ':')        rc = 1;#else#ifdef AMIGA    if (*path == '/'#ifdef DTILDE        || *path == '~'#endif /* DTILDE */        )      rc = 1;#else#ifdef OSK    if (*path == '/'#ifdef DTILDE        || *path == '~'#endif /* DTILDE */        )      rc = 1;#else#ifdef datageneral    if (*path == ':')      rc = 1;#else#ifdef MAC    rc = 0;                             /* Fill in later... */#else#ifdef STRATUS    rc = 0;                             /* Fill in later... */#else#ifdef GEMDOS    if (*path == '/' || *path == '\\')      rc = 1;    else if (isalpha(*path) && x > 1)      if (*(path+1) == ':')        rc = 1;#endif /* GEMDOS */#endif /* STRATUS */#endif /* MAC */#endif /* datageneral */#endif /* OSK */#endif /* AMIGA */#endif /* OS2 */#endif /* UNIX */#endif /* VMS */    debug(F101,"isabsolute rc","",rc);    return(rc);}/*  See if I have direct access to the keyboard  */intis_a_tty(n) int n; {#ifdef KUI   return 1;#else /* KUI */#ifdef NT    if (isWin95())      return(1);    else      return(_isatty(n));#else#ifdef IKSD   if (inserver)     return(1);   else#endif /* IKSD */     return(isatty(n));#endif /* NT */#endif /* KUI */}/* Initialize flow control table */VOIDinitflow() {                            /* Default values for flow control */#ifdef VMS                              /* for each kind of connection. */    /* The VMS telnet terminal driver treats "none" as request to lose chars */    cxflow[CXT_REMOTE]  = FLO_XONX;     /* Remote mode... */#else#ifdef HPUX    /* Ditto for HP-UX */    cxflow[CXT_REMOTE]  = FLO_XONX;     /* Remote mode... */#else    /* The temptation is to make this one FLO_KEEP but don't!!! */    /* It totally wrecks binary-file transfer when coming in via Telnet. */    /* In UNIX at least... */    cxflow[CXT_REMOTE]  = FLO_NONE;#endif /* HPUX */#endif /* VMS */#ifdef VMS    cxflow[CXT_DIRECT]  = FLO_XONX;     /* Direct serial connections... */#else    cxflow[CXT_DIRECT]  = FLO_NONE;#endif /* VMS */#ifdef CK_RTSCTS    cxflow[CXT_MODEM]   = FLO_RTSC;     /* Modem connections... */#else#ifdef VMS    cxflow[CXT_MODEM]   = FLO_XONX;#else    cxflow[CXT_MODEM]   = FLO_NONE;#endif /* VMS */#endif /* CK_RTSCTS */#ifdef VMS    cxflow[CXT_TCPIP]   = FLO_XONX;     /* TCP/IP connections... */#else    cxflow[CXT_TCPIP]   = FLO_NONE;#endif /* VMS */    cxflow[CXT_X25]     = FLO_NONE;     /* Other kinds of networks... */    cxflow[CXT_DECNET]  = FLO_XONX;    cxflow[CXT_LAT]     = FLO_XONX;    cxflow[CXT_NETBIOS] = FLO_NONE;    cxflow[CXT_NPIPE]   = FLO_NONE;    cxflow[CXT_SSH]     = FLO_NONE;    cxflow[CXT_PIPE]    = FLO_NONE;    flow = cxflow[cxtype];              /* Initial flow setting. */    debug(F101,"initflow","",flow);}#ifndef NOXFER/* Initialize file transfer protocols */VOIDinitproto(y, upbstr, uptstr, srvstr, sndbstr, sndtstr, rcvbstr, rcvtstr)    int y;    char * upbstr, * uptstr, * srvstr, * sndbstr, * sndtstr, * rcvbstr,    * rcvtstr;/* initproto */ {    if (upbstr)                         /* Convert null strings */      if (!*upbstr)                     /* to null pointers */        upbstr = NULL;    if (uptstr)                         /* Convert null strings */      if (!*uptstr)                     /* to null pointers */        uptstr = NULL;    if (sndbstr)      if (!*sndbstr)        sndbstr = NULL;    if (sndtstr)      if (!*sndtstr)        sndtstr = NULL;    if (rcvbstr)      if (!*rcvbstr)        rcvbstr = NULL;    if (rcvtstr)      if (!*rcvtstr)        rcvts

⌨️ 快捷键说明

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