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

📄 ckuusx.c

📁 linux终端仿真程序
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "ckcsym.h"/*  C K U U S X --  "User Interface" common functions. *//*  Author: Frank da Cruz <fdc@columbia.edu>,  Columbia University Academic Information Systems, New York City.  Copyright (C) 1985, 1996, Trustees of Columbia University in the City of New  York.  The C-Kermit software may not be, in whole or in part, licensed or  sold for profit as a software product itself, nor may it be included in or  distributed with commercial products or otherwise distributed by commercial  concerns to their clients or customers without written permission of the  Office of Kermit Development and Distribution, Columbia University.  This  copyright notice must not be removed, altered, or obscured.*//*  This module contains user interface functions needed by both the interactive  user interface and the command-line-only user interface.*//* Includes */#include "ckcdeb.h"#include "ckcasc.h"#include "ckcker.h"#include "ckuusr.h"#ifdef OS2#include <string.h>#endif /* OS2 */extern xx_strp xxstring;extern struct ck_p ptab[];extern int protocol, xfrbel;#ifndef NETCONN/*  We should just pull in ckcnet.h here, but it causes a conflict with curses.h.*/#ifdef TCPSOCKET#define NETCONN#else#ifdef SUNX25#define NETCONN#else#ifdef STRATUSX25#define NETCONN#else#ifdef DECNET#define NETCONN#else#ifdef NPIPE#define NETCONN#else#ifdef CK_NETBIOS#define NETCONN#ifdef SUPERLAT#define NETCONN#else#endif /* SUPERLAT */#endif /* TCPSOCKET */#endif /* SUNX25 */#endif /* STRATUSX25 */#endif /* DECNET */#endif /* NPIPE */#endif /* CK_NETBIOS */#endif /* NETCONN */#ifndef TCPSOCKET#ifdef MULTINET#define TCPSOCKET#endif /* MULTINET */#ifdef DEC_TCPIP#define TCPSOCKET#endif /* DEC_TCPIP */#ifdef WINTCP#define TCPSOCKET#endif /* WINTCP */#ifdef TCPWARE#define TCPSOCKET#endif /* TCPWARE */#endif /* TCPSOCKET */#ifdef OS2#ifdef NT#include <windows.h>#else /* NT */#define INCL_VIO#include <os2.h>#endif /* NT */#ifdef COMMENT				/* Would you believe */#undef COMMENT				/* <os2.h> defines this ? */#endif /* COMMENT */#ifdef CK_NETBIOS#include "ckonbi.h"extern PNCB pRecvNCB, pSendNCB[MAXWS], pWorkNCB ;extern UCHAR NetBiosAdapter ;extern BOOL NetbeuiAPI ;#endif /* CK_NETBIOS */#include "ckocon.h"extern ascreen commandscreen;#ifdef KUI#include "ikui.h"#endif /* KUI */#endif /* OS2 */#ifdef NT#include "cknwin.h"#endif /* NT */#ifdef OS2#include "ckowin.h"#endif /* OS2 */#ifndef WINTCP#include <signal.h>#endif /* WINTCP */#ifdef VMS#include <descrip.h>#include <ssdef.h>#include <stsdef.h>#ifndef OLD_VMS#include <lib$routines.h>  /* Not for VAX C 2.3 */#else#include <libdef.h>#endif /* OLD_VMS */#ifdef WINTCP#include <signal.h>#endif /* WINTCP */#endif /* VMS *//* Used internally */_PROTOTYP( VOID screenc, (int, char, long, char *) );#ifdef CK_CURSES#ifndef DYNAMICstatic char xtrmbuf[1024];		/* tgetent() buffer */char * trmbuf = xtrmbuf;#elsechar * trmbuf = NULL;#endif /* DYNAMIC */_PROTOTYP( static VOID dpyinit, (void) );_PROTOTYP( static long shocps, (int) );_PROTOTYP( static long shoetl, (long, long, long, long) );#endif /* CK_CURSES */static int ft_win = 0;  /* Fullscreen file transfer display window is active *//* Variables declared here */#ifdef OS2				/* File transfer display type */int fdispla = XYFD_C;			/* Curses (fullscreen) if we have it */#else#ifdef CK_CURSESint fdispla = XYFD_C;#elseint fdispla = XYFD_S;			/* Otherwise CRT */#endif /* CK_CURSES */#endif /* OS2 */int tt_crd = 0;				/* Carriage return display */#ifdef DEBUGchar debfil[CKMAXPATH+1];		/* Debugging log file name */#endif /* DEBUG */#ifdef TLOGchar trafil[CKMAXPATH+1];		/* Transaction log file name */#endif /* TLOG */char pktfil[CKMAXPATH+1];		/* Packet log file name */char sesfil[CKMAXPATH+1];		/* Session log file name */#ifdef DYNAMICstatic char *cmdstr = NULL;		/* Place to build generic command */#else#ifdef pdp11static char cmdstr[256];#elsestatic char cmdstr[4096];#endif /* pdp11 */#endif /* DYNAMIC */char fspec[CKMAXPATH+1];		/* Filename string for \v(filespec) *//*  C C N T A B  --  Names of ASCII control characters 0-31 */char *ccntab[] = { "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1/XON", "DC2", "DC3/XOFF", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US"};int success = 1,			/* Command success/failure flag */#ifndef NOSPL    cmdlvl = 0,				/* Command level */#endif /* NOSPL */    action,				/* Action selected on command line */    sessft = 0,				/* Session log file type, 0 = text */    pflag = 1,				/* Print prompt */    msgflg = 1;				/* Print informational messages */#ifndef NOMSEND				/* Multiple SEND */char *msfiles[MSENDMAX];#endif /* NOMSEND */#ifdef CK_TIMERSextern long rttdelay;extern int  rttflg;#endif /* CK_TIMERS */extern int rcvtimo;#ifdef CK_RESENDextern int sendmode;extern long sendstart, rs_len;#endif /* CK_RESEND */#ifdef CK_APCextern int apcactive;#endif /* CK_APC *//* External variables */#ifdef CK_PCT_BAR			/* File transfer thermometer */int thermometer = 1;			/* ON by default */#endif /* CK_PCT_BAR */extern int local, quiet, binary, bctu, rptflg, ebqflg, network, server,  what, spsiz, urpsiz, wmax, czseen, cxseen, winlo, displa, timint, parity,  npad, ebq, ebqflg, bctr, rptq, atcapu, lpcapu, swcapu, wslotn, wslotr, rtimo,  mypadn, sq, capas, rpsiz, tsecs, dfloc, tralog, pktlog, seslog, lscapu, dest,  xitsta, escape, tlevel, bgset, backgrd, wslots, suspend, srvdis, nettype,  spackets, spktl, rpktl, retrans, wcur, numerrs, fsecs, sendmode, whatru,  crunched, timeouts, rpackets, fncnv, bye_active;#ifdef datageneral			/* 2/12/92 ENH */#include <sysid.h>extern int con_reads_mt, conint_ch, conint_avl;#endif /* datageneral */extern long speed, filcnt, ffc, tfc, rptn, fsize, sendstart, rs_len;long oldcps = 0L, cps = 0L;extern CHAR *rdatap, padch, seol, ctlq, mypadc, eol;extern char ttname[], *dftty, *cmarg, **cmlist, *versio, myhost[], whoareu[];#ifdef TCPSOCKETextern char myipaddr[];#endif /* TCPSOCKET */#ifndef NOICP#ifdef DCMDBUFextern char *cmdbuf;			/* Command buffer */#elseextern char cmdbuf[];			/* Command buffer */#endif /* DCMDBUF */extern int cmd_quoting;#endif /* NOICP */#ifndef NOCCTRAP#ifdef NT#include <setjmpex.h>#else /* NT */#include <setjmp.h>#endif /* NT */#include "ckcsig.h"extern ckjmpbuf cmjbuf;#endif /* NOCCTRAP */#ifndef NOCSETS#include "ckcxla.h"extern int fcharset, tcharset;extern struct csinfo fcsinfo[], tcsinfo[];#endif /* NOCSETS *//*  C K _ E R R S T R  --  Return message from most recent system error */char *ck_errstr() {#ifdef pdp11_PROTOTYP( char * strerror, (int) );    return(strerror(errno));#else /* pdp11 */#ifdef ATTSV#ifdef BSD44#ifdef __386BSD__#ifndef NDSYSERRLIST    extern char *sys_errlist[];#endif /* NDSYSERRLIST */#else#ifndef __bsdi__#ifndef NDSYSERRLIST    extern const char *const sys_errlist[];#endif /* NDSYSERRLIST */#endif /* __bsdi__ */#endif /* __386BSD__ */    return((char *) sys_errlist[errno]);#else /* !BSD44 */#ifndef NDSYSERRLIST    extern char *sys_errlist[];#endif /* NDSYSERRLIST */    return((char *) sys_errlist[errno]);#endif /* BSD44 */#else /* !ATTSV */#ifdef BSD4#ifndef NDSYSERRLIST    extern char *sys_errlist[];#endif /* NDSYSERRLIST */    extern int errno;    return((char *)sys_errlist[errno]);#else#ifdef OS2#ifndef NDSYSERRLIST    extern char *sys_errlist[];#endif /* NDSYSERRLIST */#ifdef NT    extern int_sys_nerr;#endif /* NT */    char *e;    e = (errno > -1#ifdef NT	 && errno <= _sys_nerr#endif /* NT */	 ) ? #ifdef NT         (char *) sys_errlist[errno] #else /* NT */         /* I don't know how to get a CLIB error string in OS/2 */         strerror(errno)#endif /* NT */             : "";    return(e ? e : "");#else /* OS2 */    return("");#endif /* OS2 */#endif /* BSD4 */#endif /* ATTSV */#endif /* pdp11 */}#ifdef TCPSOCKET#ifdef NTextern int WSASafeToCancel;#endif /* NT */#endif /* TCPSOCKET *//*  P A R N A M  --  Return parity name */char *#ifdef CK_ANSICparnam(char c)#elseparnam(c) char c;#endif /* CK_ANSIC *//* parnam */ {    switch (c) {	case 'e': return("even");	case 'o': return("odd");	case 'm': return("mark");	case 's': return("space");	case 0:   return("none");	default:  return("invalid");    }}/*  S H O M D M  --  Show modem signals  */VOIDshomdm() {/*  Note use of "\r\n" to make sure this report prints right, even when  called during CONNECT mode.*/    int y;    y = ttgmdm();    switch (y) {      case -3: printf(	         "Modem signals unavailable in this version of Kermit\r\n");	       break;      case -2: printf("No modem control for this device\r\n"); break;      case -1: printf("Modem signals unavailable\r\n"); break;      default:#ifndef MAC        printf(	  " Carrier Detect      (CD):  %s\r\n",(y & BM_DCD) ? "On": "Off");	printf(          " Dataset Ready       (DSR): %s\r\n",(y & BM_DSR) ? "On": "Off");#endif /* MAC */	printf(          " Clear To Send       (CTS): %s\r\n",(y & BM_CTS) ? "On": "Off");#ifndef STRATUS#ifndef MAC        printf(          " Ring Indicator      (RI):  %s\r\n",(y & BM_RNG) ? "On": "Off");#endif /* MAC */        printf(          " Data Terminal Ready (DTR): %s\r\n",#ifdef NT          "(unknown)"#else /* NT */          (y & BM_DTR) ? "On": "Off"#endif /* NT */          );#ifndef MAC        printf(          " Request To Send     (RTS): %s\r\n",#ifdef NT          "(unknown)"#else /* NT */          (y & BM_RTS) ? "On": "Off"#endif /* NT */          );#endif /* MAC */#endif /* STRATUS */    }}/*  S D E B U  -- Record spar results in debugging log  */VOIDsdebu(len) int len; {    debug(F111,"spar: data",(char *) rdatap,len);    debug(F101," spsiz ","", spsiz);    debug(F101," timint","",timint);    debug(F101," npad  ","",  npad);    debug(F101," padch ","", padch);    debug(F101," seol  ","",  seol);    debug(F101," ctlq  ","",  ctlq);    debug(F101," ebq   ","",   ebq);    debug(F101," ebqflg","",ebqflg);    debug(F101," bctr  ","",  bctr);    debug(F101," rptq  ","",  rptq);    debug(F101," rptflg","",rptflg);    debug(F101," lscapu","",lscapu);    debug(F101," atcapu","",atcapu);    debug(F101," lpcapu","",lpcapu);    debug(F101," swcapu","",swcapu);    debug(F101," wslotn","", wslotn);    debug(F101," whatru","", whatru);}/*  R D E B U -- Debugging display of rpar() values  */VOIDrdebu(d,len) CHAR *d; int len; {    debug(F111,"rpar: data",d,len);    debug(F101," rpsiz ","", xunchar(d[0]));    debug(F101," rtimo ","", rtimo);    debug(F101," mypadn","",mypadn);    debug(F101," mypadc","",mypadc);    debug(F101," eol   ","",   eol);    debug(F101," ctlq  ","",  ctlq);    debug(F101," sq    ","",    sq);    debug(F101," ebq   ","",   ebq);    debug(F101," ebqflg","",ebqflg);    debug(F101," bctr  ","",  bctr);    debug(F101," rptq  ","",  d[8]);    debug(F101," rptflg","",rptflg);    debug(F101," capas ","", capas);    debug(F101," bits  ","",d[capas]);    debug(F101," lscapu","",lscapu);    debug(F101," atcapu","",atcapu);    debug(F101," lpcapu","",lpcapu);    debug(F101," swcapu","",swcapu);    debug(F101," wslotr","", wslotr);    debug(F101," rpsiz(extended)","",rpsiz);}#ifdef COMMENT/*  C H K E R R  --  Decide whether to exit upon a protocol error  */VOIDchkerr() {    if (backgrd && !server) fatal("Protocol error");}#endif /* COMMENT *//*  F A T A L  --  Fatal error message */VOIDfatal(msg) char *msg; {    if (!msg) msg = "";#ifdef VMS    if (strncmp(msg,"%CKERMIT",8))      conol("%CKERMIT-E-FATAL, ");    conoll(msg);#else /* !VMS */    screen(SCR_EM,0,0L,msg);#endif /* VMS */    debug(F110,"fatal",msg,0);    tlog(F110,"Fatal:",msg,0L);#ifdef OS2    if (xfrbel) bleep(BP_FAIL);    sleep(1);    if (xfrbel) bleep(BP_FAIL);#endif /* OS2 */    doexit(BAD_EXIT,xitsta | 1);	/* Exit indicating failure */

⌨️ 快捷键说明

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