📄 ckcmai.c
字号:
Ray Hunter, The Wollongong Group Randy Huntziger, National Library of Medicine Larry Jacobs, Transarc Steve Jenkins, Lancaster University, UK Dave Johnson, Gradient Technologies Mark B Johnson, Apple Computer Jyke Jokinen, Tampere University of Technology, Finland (QNX) Eric F Jones, AT&T Luke Jones, AT&T Peter Jones, U of Quebec Montreal Phil Julian, SAS Institute Peter Kabal, U of Quebec Mic Kaczmarczik, U of Texas at Austin Sergey Kartashoff, Inst. of Precise Mechanics & Computer Equipment, Moscow Howie Kaye, Columbia U Rob Kedoin, Linotype Co, Hauppauge, NY (OS/2) Phil Keegstra Mark Kennedy, IBM Terry Kennedy, St Peter's College, Jersey City, NJ (VMS and more) "Carlo Kid", Technical University of Delft, Netherlands Tim Kientzle Paul Kimoto, Cornell U Douglas Kingston, morgan.com Lawrence Kirby, Wiltshire, UK Tom Kloos, Sequent Computer Systems Jim Knutson, U of Texas at Austin John T. Kohl (BSDI) Scott Kramer, SRI International, Menlo Park, CA John Kraynack, US Postal Service David Kricker, Encore Computer Thomas Krueger, UWM Bo Kullmar, ABC Klubben, Stockholm, and Central Bank of Sweden, Kista R. Brad Kummer, AT&T Bell Labs, Atlanta, GA John Kunze, UC Berkeley David Lane, BSSI / BellSouth (Stratus VOS, X.25) Bob Larson, USC (OS-9) Bert Laverman, Groningen U, Netherlands Steve Layton David Lawyer, UC Irvine David LeVine, National Semiconductor Corporation Daniel S. Lewart, UIUC S.O. Lidie, Lehigh U Tor Lillqvist, Helsinki U, Finland David-Michael Lincke, U of St Gallen, Switzerland Robert Lipe (for SCO makefile entries & advice) Dean Long Mike Long, Analog Devices, Norwood MA Kevin Lowey, U of Saskatchewan (OS/2) Andy Lowry, Columbia U James Lummel, Caprica Telecomputing Resources (QNX) David MacKenzie, Environmental Defense Fund, U of Maryland John Mackin, University of Sidney, Australia Martin Maclaren, Bath U, UK Chris Maio, Columbia U CS Dept Montserrat Mane, HP, Grenoble, France Fulvio Marino, Olivetti, Ivrea, Italy Arthur Marsh, dircsa.org.au Peter Mauzey, Lucent Technologies Tye McQueen, Utah State U Ted Medin Hellmuth Michaelis, Hanseatischer Computerservice GmbH, Hamburg, Germany Leslie Mikesell, American Farm Bureau Todd Miller, Courtesan Consulting Martin Minow, DEC (VMS) Pawan Misra, Bellcore Ken Mizialko, IBM, Manassas, VA Wolfgang Moeller, DECUS Germany Ray Moody, Purdue U Bruce J Moore, Allen-Bradley Co, Highland Heights, OH (Atari ST) Steve Morley, Convex Peter Mossel, Columbia U Tony Movshon, NYU Lou Muccioli, Swanson Analysis Systems Dan Murphy Neal P. Murphy, Harsof Systems, Wonder Lake IL Gary Mussar John Nall, FSU Jack Nelson, U of Pittsburgh Jim Noble, Planning Research Corporation (Macintosh) Ian O'Brien, Bath U, UK Melissa O'Neill, SFU John Owens Michael Pins, Iowa Computer Aided Engineering Network Andre' Pirard, University of Liege, Belgium Paul Placeway, Ohio State U Piet W. Plomp, ICCE, Groningen University, Netherlands Ken Poulton, HP Labs Manfred Prange, Oakland U Christopher Pratt, APV Baker, UK Frank Prindle, NADC Tony Querubin, U of Hawaii Jean-Pierre Radley Anton Rang Scott Ribe Alan Robiette, Oxford University, UK Michel Robitaille, U of Montreal (Mac) Huw Rogers, Schweizerische Kreditanstalt, Zuerich Nigel Roles, Cambridge, England Kai Uwe Rommel, Technische Universitaet Muenchen (OS/2) Larry Rosenman (Amiga) Jay Rouman, U of Michigan Jack Rouse, SAS Institute (Data General and/or Apollo) Stew Rubenstein, Harvard U (VMS) Gerhard Rueckle, FH Darmstadt, Fb. E/Automatisierungstechnik John Santos, EG&H Bill Schilit, Columbia U Ulli Schlueter, RWTH Aachen, Germany (OS-9, etc) Michael Schmidt, U of Paderborn, Germany Eric Schnoebelen, Convex Benn Schreiber, DEC Dan Schullman, DEC (modems, DIAL command, etc) John Schultz, 3M Steven Schultz, Contel (PDP-11) APPP Scorer, Leeds Polytechnic, UK Gordon Scott, Micro Focus, Newbury UK Gisbert W. Selke, WIdO, Bonn, Germany David Singer, IBM Almaden Research Labs David Sizeland, U of London Medical School Fridrik Skulason, Iceland Rick Sladkey (Linux) Dave Slate Bradley Smith, UCLA Fred Smith, Merk / Computrition Richard S Smith, Cal State Ryan Stanisfer, UNT Bertil Stenstroem, Stockholm University Computer Centre (QZ), Sweden James Sturdevant, CAP GEMENI AMERICA, Minneapolis Peter Svanberg, Royal Techn. HS, Sweden James R. Swenson, Accu-Weather, Inc. Ted T'so, MIT (Linux) Andy Tanenbaum, Vrije U, Amsterdam, Netherlands Glen Thobe Markku Toijala, Helsinki U of Technology Teemu Torma, Helsinki U of Technology Linus Torvalds, Helsinki Rick Troxel, NIH Warren Tucker, Tridom Corp, Mountain Park, GA Dave Tweten, AMES-NAS G Uddeborg, Sweden Walter Underwood, Ford Aerospace Pieter Van Der Linden, Centre Mondial, Paris Ge van Geldorp, Netherlands Fred van Kempen, MINIX User Group, Voorhout, Netherlands Wayne Van Pelt, GE/CRD Mark Vasoll, Oklahoma State U (V7 UNIX) Konstantin Vinogradov, ICSTI, Moscow Paul Vixie, DEC Bernie Volz, Process Software Eduard Vopicka, Prague University of Economics, Czech Republic Dimitri Vulis, CUNY Roger Wallace, Raytheon Stephen Walton, Calif State U, Northridge (Amiga) Jamie Watson, Adasoft, Switzerland (AIX) Rick Watson, U of Texas (Macintosh) Robert Weiner, Programming Plus, New York City Lauren Weinstein, Vortex Technlogy David Wexelblat, AT&T Clark Wierda, Illuminati Online Joachim Wiesel, U of Karlsruhe Lon Willett, U of Utah Michael Williams, UCLA Nate Williams, U of Montana David Wilson Joellen Windsor, U of Arizona Patrick Wolfe, Kuck & Associates, Inc. Gregg Wonderly, Oklahoma State U (V7 UNIX) Farrell Woods, Concurrent (formerly Masscomp) Dave Woolley, CAP Communication Systems, London Jack Woolley, SCT Corp Frank Wortner Ken Yap, formerly of U of Rochester John Zeeff, Ann Arbor, MI*/#include "ckcker.h" /* Kermit symbols */#include "ckcnet.h" /* Network symbols */#ifdef CK_SSL#include "ck_ssl.h"#endif /* CK_SSL */#ifndef NOSPL#include "ckuusr.h"#endif /* NOSPL */#ifdef OS2ONLY#define INCL_VIO /* Needed for ckocon.h */#include <os2.h>#undef COMMENT#endif /* OS2ONLY */#ifdef NT#include <windows.h>#include <tapi.h>#include "ckntap.h"#endif /* NT */#ifndef NOSERVER/* Text message definitions.. each should be 256 chars long, or less. */#ifdef MINIXchar *srvtxt = "\r\n\Entering server mode.\r\n\0";#else#ifdef OLDMSG/* It seems there was a large installation that was using C-Kermit 5A(165) or thereabouts, which had deployed thousands of MS-DOS Kermit scripts in scattered locations that looked for strings in the old server message, which changed in 5A(183), August 1992.*/char *srvtxt = "\r\n\C-Kermit server starting. Return to your local machine by typing\r\n\its escape sequence for closing the connection, and issue further\r\n\commands from there. To shut down the C-Kermit server, issue the\r\n\FINISH or BYE command and then reconnect.\n\\r\n\0";#else#ifdef OSKchar *srvtxt = "\r\012\Entering server mode. If your local Kermit software is menu driven, use\r\012\the menus to send commands to the server. Otherwise, enter the escape\r\012\sequence to return to your local Kermit prompt and issue commands from\r\012\there. Use SEND and GET for file transfer. Use REMOTE HELP for a list of\r\012\other available services. Use BYE or FINISH to end server mode.\r\012\0";#else /* UNIX, VMS, AOS/VS, and all others */char *srvtxt = "\r\n\Entering server mode. If your local Kermit software is menu driven, use\r\n\the menus to send commands to the server. Otherwise, enter the escape\r\n\sequence to return to your local Kermit prompt and issue commands from\r\n\there. Use SEND and GET for file transfer. Use REMOTE HELP for a list of\r\n\other available services. Use BYE or FINISH to end server mode.\r\n\0";#endif /* OSK */#endif /* OLDMSG */#endif /* MINIX */#else /* server mode disabled */char *srvtxt = "";#endif /* NOSERVER */int initflg = 0; /* sysinit() has executed... */int howcalled = I_AM_KERMIT; /* How I was called */int hmtopline = 0;#ifdef IKSDCONFchar * iksdconf = IKSDCONF; /* IKSD configuration file */int iksdcf = 0; /* Has IKSD c.f. been processed? */#endif /* IKSDCONF */int srvcdmsg = 0; /* [Server] CD message */char * cdmsgfile[8] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };char * cdmsgstr = NULL;char * ckcdpath = NULL;#ifdef NLCHAR /* Text-file line terminator */CHAR feol = NLCHAR;#elseCHAR feol = 0;#endif /* NLCHAR */int fblksiz = DBLKSIZ; /* File blocksize */int frecl = DLRECL; /* File record length */int frecfm = XYFF_S; /* File record format (default = stream) */int forg = XYFO_S; /* File organization (sequential) */int fcctrl = XYFP_N; /* File carriage control (ctrl chars) */int filecase = FILECASE; /* Case matters in filenames */int stathack = 1; /* Fast directory lookups by default */char uidbuf[UIDBUFLEN] = { NUL, NUL }; /* User ID buffer */int cfilef = 0; /* Application ("kerbang") file flag */char cmdfil[CKMAXPATH + 1] = { NUL, NUL }; /* Application file name */#ifndef NOXFER/* Multi-protocol support */struct ck_p ptab[NPROTOS] = { /* Initialize the Kermit part ... */ { "Kermit", DRPSIZ, /* Receive packet size */ DSPSIZ, /* Send packet size */ 0, /* Send-packet-size-set flag */ DFWSIZ, /* Window size */#ifdef NEWDEFAULTS PX_CAU, /* Control char unprefixing... */#else PX_ALL,#endif /* NEWDEFAULTS */#ifdef VMS /* Default filename collision action */ XYFX_X, /* REPLACE for VAX/VMS */#else XYFX_B, /* BACKUP for everybody else */#endif /* VMS */#ifdef OS2 /* Flag for file name conversion */ XYFN_L, /* Literal for OS2 */#else XYFN_C, /* Converted for others */#endif /* OS2 */ PATH_OFF, /* Send pathnames OFF */ PATH_AUTO, /* Receive pathnames AUTO */ NULL, /* Host receive initiation string (binary) */ NULL, /* Host receive initiation string (text) */ NULL, /* Host server string */ NULL, /* External protocol send command (binary) */ NULL, /* External protocol send command (text) */ NULL, /* External protocol receive command (bin) */ NULL } /* External protocol receive command (txt) */#ifdef CK_XYZ,{"XMODEM", 128,128,-1,-1, 1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL},{"XMODEM-CRC",128,128,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL},{"YMODEM", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL},{"YMODEM-g", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL},{"ZMODEM", -1, -1,-1,-1,PX_WIL,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL},{"Other", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}#endif /* CK_XYZ */};/* Declarations for Send-Init Parameters */int spsiz = DSPSIZ, /* Current packet size to send */ spmax = DSPSIZ, /* Biggest packet size we can send */ lastspmax = DSPSIZ, /* Send-packet size last used */ spsizr = DSPSIZ, /* Send-packet size requested */ spsizf = 0, /* Flag to override size negotiation */ rpsiz = DRPSIZ, /* Biggest we want to receive */ urpsiz = DRPSIZ, /* User-requested receive pkt size */ maxrps = MAXRP, /* Maximum incoming long packet size */ maxsps = MAXSP, /* Maximum outbound l.p. size */ maxtry = MAXTRY, /* Maximum retries per packet */ wslots = 1, /* Window size currently in use */ wslotr = DFWSIZ, /* Window size from SET WINDOW */ wslotn = 1, /* Window size negotiated in S-pkt */ timeouts = 0, /* For statistics reporting */ spackets = 0, /* ... */ rpackets = 0, /* ... */ retrans = 0, /* ... */ crunched = 0, /* ... */ wmax = 0, /* ... */ wcur = 0, /* ... */ srvidl = 0, /* Server idle timeout */ srvdis = 1, /* Server file xfer display */ srvtim = DSRVTIM, /* Server command wait timeout */ srvping = 1, /* Server keepalive *//* timint is the timeout interval I use when waiting for a packet. pkttim is the SET RECEIVE TIMEOUT value, sent to the other Kermit. rtimo is the SET SEND TIMEOUT value. rtimo is the initial value of timint. timint is changed by the value in the incoming negotiation packet unless a SET SEND TIMEOUT command was given.*/ timint = DMYTIM, /* Timeout interval I use */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -