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

📄 ckutio.c

📁 KERMIT工具 这在办公室下载不了,很多人都没有载不到.
💻 C
📖 第 1 页 / 共 5 页
字号:
};struct timezone {    int tz_minuteswest;    int tz_dsttime;};#endif /* UNIXWAREPOSIX */#endif /* SVORPOSIX */#ifdef __GNUC__#ifdef XENIX/*  Because Xenix <time.h> doesn't declare time() if we're using gcc.*/time_t time();#endif /* XENIX */#endif /* __GNUC__ *//* Special stuff for V7 input buffer peeking */#ifdef  V7int kmem[2] = { -1, -1};char *initrawq(), *qaddr[2]={0,0};#define CON 0#define TTY 1#endif /* V7 *//* dftty is the device name of the default device for file transfer *//* dfloc is 0 if dftty is the user's console terminal, 1 if an external line */#ifdef BEOS    char * dftty = NULL;    char * dfmdm = "none";    int dfloc = 0;                  /* that goes in local mode by default */#else#ifndef DFTTY#ifdef PROVX1    char *dftty = "/dev/com1.dout"; /* Only example so far of a system */    char *dfmdm = "none";    int dfloc = 1;                  /* that goes in local mode by default */#else    char *dftty = CTTNAM;               /* Remote by default, use normal */    char *dfmdm = "none";    int dfloc = 0;                      /* controlling terminal name. */#endif /* PROVX1 */#else    char *dftty = DFTTY;		/* Default location specified on */    char *dfmdm = "none";		/* command line. */    int dfloc = 1;                      /* controlling terminal name. */#endif /* DFTTY */#endif /* BEOS */#define CON_RES 0			/* Console state is "reset" */#define CON_CB  1			/* Console state is CBREAK */#define CON_BIN 2			/* Console state is binary */    static int constate = CON_RES;#define CONI_RES 0			/* Console interrupts are "reset" */#define CONI_INT 1			/* Console intterupts are set */#define CONI_NOI 2			/* Console intterupts are disabled */    static int conistate = CONI_RES;#ifdef CK_SMALL#define CONBUFSIZ 15#else#define CONBUFSIZ 255#endif /* CK_SMALL */    static char conbuf[CONBUFSIZ];	/* Console readahead buffer */    static int  conbufn = 0;		/* Chars in readahead buffer */    static char *conbufp = conbuf;	/* Next char in readahead buffer */    char cttnam[DEVNAMLEN+1] = { '\0', '\0' }; /* Determined at runtime */#ifdef RTU    int rtu_bug = 0;		    /* set to 1 when returning from SIGTSTP */#endif /* RTU */    int dfprty = DEFPAR;                /* Default parity (0 = none) */    int ttprty = 0;                     /* The parity that is in use. */    static int ttpmsk = 0xff;		/* Parity stripping mask. */    int ttmdm = 0;                      /* Modem in use. */    int ttcarr = CAR_AUT;		/* Carrier handling mode. */    int dfflow = FLO_NONE;		/* Default flow control is NONE */    int backgrd = 0;                    /* Assume in foreground (no '&' ) */#ifdef F_SETFL    int iniflags = -1;			/* fcntl flags for ttyfd */#endif /* F_SETFL */    int fdflag = 0;			/* Flag for redirected stdio */    int ttfdflg = 0;			/* Open File descriptor was given */    int tvtflg = 0;			/* Flag that ttvt has been called */    long ttspeed = -1L;			/* For saving speed */    int ttflow = -9;			/* For saving flow */    int ttld = -1;			/* Line discipline */#ifdef sony_news    static int km_con = -1;		/* Kanji mode for console tty */    static int km_ext = -1;		/* Kanji mode for external device */#endif /* sony_news */#ifdef PARSENSE    static int needpchk = 1;		/* Need parity check */#else    static int needpchk = 0;#endif /* PARSENSE */    extern int stopbits;		/* Stop bits */#ifdef HWPARITY/*  Unfortunately we must do this with global variables rather than through the  tt...() APIs to avoid changing the APIs and the many modules that use them.  If hwparity != 0, this indicates 8 data bits + parity, rather than 7 data  bits + parity or 8 data bits and no parity, and overrides the regular parity  variable, which is communicated to this module thru ttpkt(), and represented  locally by the ttprty variable.*/    extern int hwparity;		/* Hardware parity */#endif /* HWPARITY */#ifdef TCPSOCKET#ifdef TCP_NODELAYstatic int nodelay_sav = -1;#endif /* TCP_NODELAY */#endif /* TCPSOCKET */static int sigint_ign = 0;		/* SIGINT is ignored *//*  Having this module rely on external globals is bad, but fixing this  requires overhaul of the ck*tio.c modules for all the different operating  systems supported by C-Kermit.  Left for a future release.*/extern int ttnproto;			/* Defined in ckcnet.c */extern int ttnet;			/* Defined in ckcnet.c */extern int nopush, xfrcan, xfrchr, xfrnum; /* Defined in ckcmai.c */extern int xsuspend, wasclosed;extern int inserver, local;int ckxech = 0; /* 0 if system normally echoes console characters, else 1 */int ckmaxfiles = 0;			/* Max number of open files */#ifdef CK_ENCRYPTION			/* Kerberos */#include "ckuath.h"extern int me_encrypt, u_encrypt;#endif /* CK_ENCRYPTION *//* Declarations of variables global within this module */#ifdef TTLEBUF				/* See ckcnet.h */int ttpush = -1;#define LEBUFSIZ 4096static CHAR le_buf[LEBUFSIZ];static int le_start = 0, le_end = 0, le_data = 0;#endif /* TTLEBUF */static int gotsigs = 0;static time_t tcount = (time_t)0;	/* Elapsed time counter */static SIGTYP (*saval)()     = NULL;	/* For saving alarm() handler */static SIGTYP (*savquit)()   = NULL;	/* and other signal handlers */#ifdef SIGUSR1static SIGTYP (*savusr1)()   = NULL;#endif /* SIGUSR1 */#ifdef SIGUSR2static SIGTYP (*savusr2)()   = NULL;#endif /* SIGUSR2 */#ifdef SIGPIPEstatic SIGTYP (*savpipe)()   = NULL;#endif /* SIGPIPE */#ifdef SIGDANGERstatic SIGTYP (*savdanger)() = NULL;#endif /* SIGDANGER */#ifndef NOJCstatic SIGTYP (*jchdlr)()    = NULL;	/* For checking suspend handler */#endif /* NOJC */static int jcshell = -1;		/* And flag for result *//*  BREAKNULS is defined for systems that simulate sending a BREAK signal  by sending a bunch of NUL characters at low speed.*/#ifdef PROVX1#ifndef BREAKNULS#define BREAKNULS#endif /* BREAKNULS */#endif /* PROVX1 */#ifdef V7#ifndef BREAKNULS#define BREAKNULS#endif /* BREAKNULS */#endif /* V7 */#ifdef BREAKNULSstatic char				/* A string of nulls */*brnuls = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";#endif /* BREAKNULS */#ifdef CK_POSIX_SIG			/* Longjump buffers */static sigjmp_buf sjbuf;		/* POSIX signal handling */#elsestatic jmp_buf sjbuf;#endif /* CK_POSIX_SIG */#ifdef V7static jmp_buf jjbuf;#endif /* V7 *//* static */				/* (Not static any more) */int ttyfd = -1;				/* TTY file descriptor */int ttpipe = 0;				/* NETCMD: Use pipe instead of ttyfd */int ttpty  = 0;                         /* NETPTY: Use pty instead of ttfyd */#ifdef NETCMD#ifdef NETCONNstatic int pipe0[2], pipe1[2];		/* Pipes for net i/o */#endif /* NETCONN */static PID_T ttpid = 0;			/* Process ID for fork */static int fdin, fdout;			/* File descriptors for pipe */static FILE * ttout = NULL;		/* File pointer for output pipe */#ifdef DCLFDOPEN/* fdopen() needs declaring because it's not declared in <stdio.h> */_PROTOTYP( FILE * fdopen, (int, char *) );#endif /* DCLFDOPEN */#endif /* NETCMD */extern int pexitstat, quiet;#ifdef Plan9int ttyctlfd  = -1;   /* TTY control channel - What? UNIX doesn't have one? */int consctlfd = -1;			/* Console control channel */int noisefd = -1;			/* tone channel */static int ttylastspeed = -1;		/* So we can lie about the speed */#endif /* Plan9 */int telnetfd = 0;			/* File descriptor is for telnet */#ifdef NETCONNint x25fd = 0;				/* File descriptor is for X.25 */#endif /* NETCONN */char lockpid[16] = { '\0', '\0' };	/* PID stored in lockfile, as string */static int lkf = 0,                     /* Line lock flag */    cgmf = 0,                           /* Flag that console modes saved */    xlocal = 0,                         /* Flag for tty local or remote */    curcarr = 0;			/* Carrier mode: require/ignore. */static int netconn = 0;			/* 1 if network connection active */static char escchr;                     /* Escape or attn character */#ifdef CK_SCO32V4#include <sys/time.h>#endif /* CK_SCO32V4 */#ifdef HAVE_TV    static struct timeval tv;		/* For getting time, from sys/time.h */#endif /* HAVE_TV */#ifdef HAVE_TZ    static struct timezone tz;#endif /* HAVE_TZ */#ifdef OSF    static struct timeb ftp;            /* And from sys/timeb.h */#endif /* OSF */#ifdef BSD29    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;            /* And from sys/timeb.h */#endif /* BSD29 */#ifdef BSD41    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;            /* And from sys/timeb.h */#endif /* BSD41 */#ifdef BELLV10    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;            /* And from sys/timeb.h */#endif /* BELLV10 */#ifdef FT21    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;            /* And from sys/timeb.h */#endif /* FT21 */#ifdef TOWER1    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;		/* And from sys/timeb.h */#endif /* TOWER1 */#ifdef COHERENT    static long xclock;			/* For getting time from sys/time.h */    static struct timeb ftp;		/* And from sys/timeb.h */#endif /* COHERENT */#ifdef V7    static long xclock;#endif /* V7 *//* sgtty/termio information... */#ifdef BSD44ORPOSIX			/* POSIX or BSD44 */  static struct termios    ttold, ttraw, tttvt, ttcur,    ccold, ccraw, cccbrk;#else					/* BSD, V7, etc */#ifdef COHERENT				/* Hack alert... */#define ATTSV#endif /* COHERENT */#ifdef ATTSV  static struct termio ttold = {0};	/* Init'd for word alignment, */  static struct termio ttraw = {0};	/* which is important for some */  static struct termio tttvt = {0};	/* systems, like Zilog... */  static struct termio ttcur = {0};  static struct termio ccold = {0};  static struct termio ccraw = {0};  static struct termio cccbrk = {0};#else  static struct sgttyb                  /* sgtty info... */    ttold, ttraw, tttvt, ttcur, 	/* for communication line */    ccold, ccraw, cccbrk;		/* and for console */#ifdef BELLV10  static struct ttydevb			/* Device info... */    tdold, tdcur;			/* for communication device */#endif /* BELLV10 */#ifdef TIOCGETC  static struct tchars tchold, tchnoi;  static int tcharf;#endif /* TIOCGETC */#ifdef TIOCGLTC  static struct ltchars ltchold, ltchnoi;  static int ltcharf;#endif /* TIOCGLTC */  int lmodef = 0;			/* Local modes */  int lmode = 0;#endif /* ATTSV */#endif /* BSD44ORPOSIX */#ifdef COMMENT/* It picks up the speeds but they don't work */#ifdef UNIXWARE				/* For higher serial speeds */#ifdef UW7				/* in Unixware 7.0 */#include <sys/asyc.h>			/* This picks up 57600 and 115200 */#endif /* UW7 */#endif /* UNIXWARE */#endif /* COMMENT */#ifdef PROVX1  static struct sgttyb ttbuf;#endif /* PROVX1 */#ifdef ultrix/* do we really need this? */  static struct sgttyb vanilla;#endif /* ultrix */#ifdef ATT7300static int attmodem = 0;                /* ATT7300 internal-modem status */struct updata dialer = {0};		/* Condition dialer for data call */#endif /* ATT7300 */#ifndef NOUUCP#define FLFNAML 128#ifndef USETTYLOCK#ifdef RTAIXchar lkflfn[FLFNAML] = { '\0', '\0' };	/* and possible link to it */#endif /* RTAIX */char lock2[FLFNAML] =  { '\0', '\0' };	/* Name of second lockfile */#endif /* USETTYLOCK */#else#define FLFNAML 7#endif /* NOUUCP */char flfnam[FLFNAML+1] = { '\0', '\0' }; /* UUCP lock file path name */int haslock = 0;			/* =1 if this kermit locked uucp */#ifndef OXOS#ifdef SVORPOSIXstatic int conesc = 0;                  /* set to 1 if esc char (^\) typed */#else#ifdef V7static int conesc = 0;#else#ifdef C70static int conesc = 0;#endif /* C70 */#endif /* V7 */#endif /* SVORPOSIX */#endif /* OXOS *//* Local copy of comm device name or network host */static char ttnmsv[DEVNAMLEN+1] = { '\0', '\0' };#ifdef USETTYLOCKstatic char lockname[DEVNAMLEN+1];	/* Ditto, the part after "/dev/". */#endif /* USETTYLOCK */#ifdef aegisstatic status_$t st;                    /* error status return value */static short concrp = 0;                /* true if console is CRP pad */static uid_$t ttyuid;                   /* tty type uid */static uid_$t conuid;                   /* stdout type uid *//* APOLLO Aegis main() * establish acl usage and cleanup handling *    this makes sure that CRP pads *    get restored to a usable mode */main(argc,argv) int argc; char **argv; {        status_$t status;        pfm_$cleanup_rec dirty;        PID_T pid = getpid();        /* acl usage according to invoking environment */        default_acl(USE_DEFENV);        /* establish a cleanup continuation */        status = pfm_$cleanup(dirty);        if (status.all != pfm_$cleanup_set) {                /* only handle faults for the original process */                if (pid == getpid() && status.all > pgm_$max_severity) {		    /* blew up in main process */		    status_$t quo;		    pfm_$cleanup_rec clean;		    /* restore the console in any case */		    conres();		    /* attempt a clean exit */		    debug(F101, "cleanup fault status", "", status.all);		    /* doexit(), then send status to continuation */		    quo = pfm_$cleanup(clean);		    if (quo.all == pfm_$cleanup_set)		      doexit(pgm_$program_faulted,-1);		    else if (quo.all > pgm_$max_severity)		      pfm_$signal(quo); /* blew up in doexit() */                }                /* send to the original continuation */                pfm_$signal(status);                /*NOTREACHED*/	    }        return(ckcmai(argc, argv));}#endif /* aegis *//* ANSI-style prototypes for internal functions. *//* Functions used outside this module are prototyped in ckcker.h. */#ifdef apollo_PROTOTYP( SIGTYP timerh, () );_PROTOTYP( SIGTYP cctrap, () );_PROTOTYP( SIGTYP esctrp, () );_PROTOTYP( SIGTYP sig_ign, () );#else_PROTOTYP( SIGTYP timerh, (int) );_PROTOTYP( SIGTYP cctrap, (int) );_PROTOTYP( SIGTYP esctrp, (int) );#endif /* apollo */_PROTOTYP( int do_open, (char *) );_PROTOTYP( static int in_chk, (int, int) );_PROTOTYP( static int ttrpid, (char *) );_PROTOTYP( static int ttchkpid, (char *) );_PROTOTYP( static int ttlock, (char *) );_PROTOTYP( static int ttunlck, (void) );_PROTOTYP( int mygetbuf, (void) );_PROTOTYP( int myfillbuf, (void) );_PROTOTYP( VOID conbgt, (int) );#ifdef ACUCNTRL_PROTOTYP( VOID acucntrl, (char *, char *) );#endif /* ACUCNTRL */#ifdef BSD44ORPOSIX_PROTOTYP( int carrctl, (struct termios *, int) );#else#ifdef ATTSV_PROTOTYP( int carrctl, (struct termio *, int) );#else_PROTOTYP( int carrctl, (struct sgttyb *, int) );#endif /* ATTSV */#endif /* BSD44ORPOSIX */#ifdef ATT7300_PROTOTYP( int attdial, (char *, long, char *) );_PROTOTYP( int offgetty, (char *) );_PROTOTYP( int ongetty, (char *) );#endif /* ATT7300 */#ifdef BEOSORBEBOX#ifdef SELECT    /* BeOS is not capable of using SELECT on anything but sockets */#undef SELECT

⌨️ 快捷键说明

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