-
Notifications
You must be signed in to change notification settings - Fork 0
/
ckcmai.c
3526 lines (3225 loc) · 119 KB
/
ckcmai.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#define EDITDATE "29 Dec 2005" /* Update these with each edit */
#define EDITNDATE "20051229" /* Keep them in sync */
/* Thu Dec 29 15:49:18 2005 */
/*
ckcsym.h is used for for defining symbols that normally would be defined
using -D or -d on the cc command line, for use with compilers that don't
support this feature. Must be before any tests for preprocessor symbols.
*/
#include "ckcsym.h"
/*
Consolidated program version information (for UNIX also see ckuver.h).
See makever() below for how they are used.
*/
/* #ifdef COMMENT */ /* Uncomment this for test version */
#ifndef OS2
#ifndef BETATEST
#define BETATEST
#endif /* BETATEST */
#endif /* OS2 */
/* #endif */ /* COMMENT */
#ifdef BETATEST
#ifdef OS2
#ifdef __DATE__
#define BETADATE
#endif /* __DATE__ */
#endif /* OS2 */
#endif /* BETATEST */
#ifndef MAC
/*
Note: initialize ck_s_test to "" if this is not a test version.
Use (*ck_s_test != '\0') to decide whether to print test-related messages.
*/
#ifndef BETATEST
#ifndef OS2 /* UNIX, VMS, etc... (i.e. C-Kermit) */
char *ck_s_test = ""; /* "Dev","Alpha","Beta","RC", or "" */
char *ck_s_tver = ""; /* Test version number or "" */
#else /* OS2 */
char *ck_s_test = ""; /* (i.e. K95) */
char *ck_s_tver = "";
#endif /* OS2 */
#else
char *ck_s_test = "Dev"; /* Development */
char *ck_s_tver = "10";
#endif /* BETATEST */
#else /* MAC */
char *ck_s_test = "Pre-Alpha"; /* Mac Kermit is always a test... */
char *ck_s_tver = "";
#endif /* MAC */
#ifdef BETADATE /* Date of this version or edit */
char *ck_s_date = __DATE__; /* Compilation date */
#else
char *ck_s_date = EDITDATE; /* See top */
#endif /* BETADATE */
char *buildid = EDITNDATE; /* See top */
#ifdef UNIX
static char sccsid[] = "@(#)C-Kermit 8.0.212";
#endif /* UNIX */
char *ck_s_ver = "8.0.212"; /* C-Kermit version string */
long ck_l_ver = 800212L; /* C-Kermit version number */
#ifdef OS2
char *ck_s_xver = "2.2.0"; /* Product-specific version string */
long ck_l_xver = 2200L; /* Product-specific version number */
#else
#ifdef MAC
char *ck_s_xver = "0.995"; /* Product-specific version string */
long ck_l_xver = 995L; /* Product-specific version number */
#else
char *ck_s_xver = ""; /* Don't touch these... */
long ck_l_xver = 0L; /* they are computed at runtime */
#endif /* MAC */
#endif /* OS2 */
#ifdef OS2
#ifdef IKSDONLY
#ifdef NT
char *ck_s_name = "IKS-NT";
#else /* NT */
char *ck_s_name = "IKS-OS/2";
#endif /* NT */
#else /* IKSDONLY */
char *ck_s_name = "Kermit 95"; /* Program name */
#endif /* IKSDONLY */
#else
#ifdef MAC
char *ck_s_name = "Mac Kermit";
#else
char *ck_s_name = "C-Kermit";
#endif /* MAC */
#endif /* OS2 */
char *ck_s_who = ""; /* Where customized, "" = not. */
char *ck_patch = ""; /* Patch info, if any. */
#define CKVERLEN 128
char versiox[CKVERLEN]; /* Version string buffer */
char *versio = versiox; /* These are filled in at */
long vernum, xvernum; /* runtime from above. */
#define CKCMAI
#include "ckcasc.h" /* ASCII character symbols */
#include "ckcdeb.h" /* Debug & other symbols */
char * myname = NULL; /* The name I am called by */
#ifndef OS2
char * exedir = NULL; /* Directory I was executed from */
#endif /* OS2 */
char * myhome = NULL; /* Home directory override */
/* C K C M A I -- C-Kermit Main program */
/*
Author: Frank da Cruz ([email protected]),
Columbia University Academic Information Systems, New York City.
Computer Center / Center for Computing Activities / Information Technology.
I am no longer at Columbia U as of 1 July 2011, but the email address
should still work. The Kermit website http://kermit.columbia.edu should
still be available and under my control, as well as the Kermit FTP site,
ftp://kermit.columbia.edu/kermit/.
COPYRIGHT NOTICE:
*/
char *copyright[] = {
#ifdef pdp11
"Copyright (C) 1985, %s, Trustees of Columbia University, NYC.",
"All rights reserved.",
" ",
#else
"Copyright (C) 1985, %s,",
" The Trustees of Columbia University in the City of New York.",
" All rights reserved.",
" ",
"Redistribution and use in source and binary forms, with or without",
"modification, are permitted provided that the following conditions",
"are met:",
" ",
" + Redistributions of source code must retain the above copyright",
" notice, this list of conditions and the following disclaimer.",
" ",
" + Redistributions in binary form must reproduce the above copyright",
" notice, this list of conditions and the following disclaimer in",
" the documentation and/or other materials provided with the",
" distribution.",
" ",
" + Neither the name of Columbia University nor the names of its",
" contributors may be used to endorse or promote products derived",
" from this software without specific prior written permission.",
" ",
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS",
"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT",
"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR",
"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT",
"HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,",
"SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT",
"LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,",
"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY",
"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT",
"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE",
"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
#endif /* pdp11 */
#ifdef OS2
"Portions Copyright (C) 2002-2005, Secure Endpoints Inc, New York NY USA.",
"Portions Copyright (C) 1995, Oy Online Solutions Ltd., Jyvaskyla, Finland.",
#endif /* OS2 */
#ifdef CK_AUTHENTICATION
"Portions Copyright (C) 1990, Massachusetts Institute of Technology.",
#ifdef CK_ENCRYPTION
"Portions Copyright (C) 1991, 1993 Regents of the University of California.",
"Portions Copyright (C) 1991, 1992, 1993, 1994, 1995 by AT&T.",
"Portions Copyright (C) 1995, 1997, Eric Young <[email protected]>.",
#endif /* CK_ENCRYPTION */
#ifdef CK_SRP
"Portions Copyright (C) 1997, Stanford University.",
#endif /* CK_SRP */
#endif /* CK_AUTHENTICATION */
""};
char * wiksdcpr = copyright;
/*
DOCUMENTATION:
"Using C-Kermit" by Frank da Cruz and Christine M. Gianone,
Digital Press / Butterworth-Heinemann, Woburn MA, USA.
Second edition (1997), ISBN 1-55558-164-1.
Order from Digital Press: +1 (800) 366-2665
Or from Columbia University: +1 (212) 854-3703
For Kermit 95, also:
"Kermit 95" by Christine M. Gianone and Frank da Cruz,
Manning Publications, Greenwich CT, USA (1998) - Online.
ACKNOWLEDGMENTS:
The Kermit file transfer protocol was developed at the Columbia University
Center for Computing Activities (CUCCA), which was since renamed to Columbia
University Academic Information Systems (AcIS). Kermit is named after
Kermit the Frog, star of the television series THE MUPPET SHOW; the name is
used by permission of Henson Associates, Inc.
Thanks to at least the following people for their contributions to this
program over the years, and apologies to anyone who was inadvertantly
omitted:
Chris Adie, Edinburgh U, Scotland (OS/2)
Robert Adsett, University of Waterloo, Canada
Larry Afrin, Clemson U
Russ Allbery, Stanford U
Jeffrey Altman, Columbia University
Greg Andrews, Telebit Corp
Barry Archer, U of Missouri
Robert Andersson, International Systems A/S, Oslo, Norway
Chris Armstrong, Brookhaven National Lab (OS/2)
William Bader, Software Consulting Services, Nazareth, PA
Fuat Baran, Columbia U
Stan Barber, Rice U
Jim Barbour, U of Colorado
Donn Baumgartner, Dell
Nelson Beebe, U of Utah
Gerry Belanger, Cognitronics
Karl Berry, UMB
Mark Berryman, SAIC
Dean W Bettinger, SUNY
Gary Bilkus
Peter Binderup, Denmark
David Bolen, Advanced Networks and Services, Inc.
Marc Boucher, U of Montreal
Charles Brooks, EDN
Bob Brown
Mike Brown, Purdue U
Jack Bryans, California State U at Long Beach
Mark Buda, DEC (VMS)
Fernando Cabral, Padrao iX, Brasilia
Bjorn Carlsson, Stockholm University Computer Centre QZ, Sweden
Bill Catchings, (formerly of) Columbia U
Bob Cattani, Columbia U CS Dept
Davide Cervone, Rochester U
Seth Chaiklin, Denmark
John Chandler, Harvard U / Smithsonian Astronomical Observatory
Bernard Chen, UCLA
Andrew A Chernov, RELCOM Team, Moscow
John L Chmielewski, AT&T, Lisle, IL
Howard Chu, U of Michigan
Bill Coalson, McDonnell Douglas
Bertie Coopersmith, London
Chet Creider, U of Western Ontario
Alan Crosswell, Columbia U
Jeff Damens, (formerly of) Columbia U
Mark Davies, Bath U, UK
Sin-itirou Dezawa, Fujifilm, Japan
Joe R. Doupnik, Utah State U
Frank Dreano, Honeywell
John Dunlap, U of Washington
Alex Dupuy, SMART.COM
David Dyck, John Fluke Mfg Co.
Stefaan A. Eeckels, Eurokom, Luxembourg
Nick Efthymiou
Paul Eggert, Twin Sun, Inc., El Segundo, CA
Bernie Eiben, DEC
Peter Eichhorn, Assyst International
Kristoffer Eriksson, Peridot Konsult AB, Oerebro, Sweden
John R. Evans, IRS, Kansas City
Glenn Everhart, RCA Labs
Charlie Finan, Cray Research
Herm Fischer, Encino, CA (extensive contributions to version 4.0)
Carl Fongheiser, CWRU
Mike Freeman, Bonneville Power Authority
Marcello Frutig, Catholic University, Sao Paulo, Brazil (X.25 support)
Hirofumi Fujii, Japan Nat'l Lab for High Energy Physics, Tokyo (Kanji)
Chuck Fuller, Westinghouse Corporate Computer Services
Andy Fyfe, Caltech
Christine M. Gianone, Columbia U
John Gilmore, UC Berkeley
Madhusudan Giyyarpuram, HP
Rainer Glaschick, Siemens AG, Paderborn
William H. Glass
German Goldszmidt, IBM
Chuck Goodhart, NASA
Alistair Gorman, New Zealand
Richard Gration, ADFA, Australia
Chris Green, Essex U, UK
Alan Grieg, Dundee Tech, Scotland
Yekta Gursel, MIT
Jim Guyton, Rand Corp
Michael Haertel
Bruno Haible
Bob Hain, UMN
Marion Hakanson, ORST
Richard Hamilton
John Hamilston, Iowa State U
Simon Hania, Netherlands
Stan Hanks, Rice U.
Ken Harrenstein, SRI
Eugenia Harris, Data General (AOS/VS)
David Harrison, Kingston Warren Corp
Lucas Hart, Oregon State University
James Harvey, Indiana/Purdue U (VMS)
Rob Healey
Chuck Hedrick, Rutgers U
Ron Heiby, Technical Systems Division, Motorola Computer Group
Steve Hemminger, Tektronix
Christian Hemsing, RWTH Aachen, Germany (OS-9)
Randolph Herber, US DOE,
Andrew Herbert, Monash Univ, Australia
Marcus Herbert, Germany
Mike Hickey, ITI
Dan Hildebrand, QNX Software Systems Inc, Kanata, ON (QNX)
R E Hill
Stephan Hoffman-Emden
Sven Holmstrom, ABB Utilities AB, Sweden
Bill Homer, Cray Research
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
Thomas Pinkl, Health Business Systems Inc.
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)
Scott Weikart (Association for Progressive Communications)
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 MINIX
char *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 OSK
char *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;
int quitting = 0; /* I'm in the act of quitting */
#ifdef IKSDCONF
char * 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;
#else
CHAR 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 */
int haveurl = 0; /* URL given on command line */
#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 */
pkttim = URTIME, /* Timeout I want you to use */
rtimo = DMYTIM, /* Normal packet wait timeout */
timef = 0, /* Flag to override what you ask */
#ifdef CK_TIMERS
rttflg = 1, /* Use dynamic round-trip timers */
#else
rttflg = 0, /* Use fixed timer */
#endif /* CK_TIMERS */
mintime = 1, /* Minimum timeout */
maxtime = 0, /* Maximum timeout */
npad = MYPADN, /* How much padding to send */
mypadn = MYPADN, /* How much padding to ask for */
bctr = DFBCT, /* Block check type requested */
bctu = 1, /* Block check type used */
bctl = 1, /* Block check length */
c_save = -1, /* Block check saving and restoring */
ss_save = -1, /* Slow-start saving and restoring */
ebq = MYEBQ, /* 8th bit prefix */
ebqflg = 0, /* 8th-bit quoting flag */
rqf = -1, /* Flag used in 8bq negotiation */
rq = 0, /* Received 8bq bid */
sq = 'Y', /* Sent 8bq bid */
rpt = 0, /* Repeat count */
rptq = MYRPTQ, /* Repeat prefix */
rptflg = 0, /* Repeat processing flag */
rptena = 1, /* Repeat processing enabled */
xfrcan = 1, /* Transfer cancellation enabled */
xfrint = 1, /* Transfer interruption enabled */
xfrchr = 3, /* Transfer cancel char = Ctrl-C */
xfrnum = 3, /* Need three of them by default */
g_xfrxla = -1;
char * xfrmsg = NULL; /* Message for f.t. display screen */
#endif /* NOXFER */
#ifdef NOCSETS
int xfrxla = 0; /* Character-set translation */
#else
int xfrxla = 1; /* enabled or disabled */
#endif /* NOCSETS */
#ifndef NOXFER
int epktflg = 0; /* E-PACKET command active */
int capas = 9, /* Position of Capabilities */
lpcapb = 2, /* Long Packet capability */
lpcapr = 1, /* requested */
lpcapu = 0, /* used */
swcapb = 4, /* Sliding Window capability */
swcapr = 1, /* requested (allowed) */
swcapu = 0, /* used */
atcapb = 8, /* Attribute capability */
atcapr = 1, /* requested */
atcapu = 0, /* used */
rscapb = 16, /* RESEND capability */
rscapr = 1, /* requested by default */
rscapu = 0, /* used */
lscapb = 32, /* Locking Shift capability */
lscapr = 1, /* requested by default */
lscapu = 0; /* used */
/* Flags for whether to use particular attributes */
int atenci = 1, /* Encoding in */
atenco = 1, /* Encoding out */
atdati = 1, /* Date in */
atdato = 1, /* Date out */
atdisi = 1, /* Disposition in/out */
atdiso = 1,
atleni = 1, /* Length in/out (both kinds) */
atleno = 1,
atblki = 1, /* Blocksize in/out */
atblko = 1,
attypi = 1, /* File type in/out */
attypo = 1,
atsidi = 1, /* System ID in/out */
atsido = 1,
atsysi = 1, /* System-dependent parameters in/out */
atsyso = 1;
int dispos = 0; /* Disposition */
#ifdef CK_PERMS
int atlpri = 1,
atlpro = 1,
atgpri = 1,
atgpro = 1;
#endif /* CK_PERMS */
int atfrmi = 1, /* Record Format in/out */
atfrmo = 1;
#ifdef STRATUS
int atcrei = 1, /* Creator ID in/out */
atcreo = 1,
atacti = 1, /* Account in/out */
atacto = 1;
#endif /* STRATUS */
int sprmlen = -1; /* Send/Receive protocol parameter */
int rprmlen = -1; /* string length limits */
int sendipkts = 1; /* Send I packets */
CHAR padch = MYPADC, /* Padding character to send */
mypadc = MYPADC, /* Padding character to ask for */
seol = MYEOL, /* End-Of-Line character to send */
eol = MYEOL, /* End-Of-Line character to look for */
ctlq = CTLQ, /* Control prefix in incoming data */
myctlq = CTLQ, /* Outbound control character prefix */
myrptq = MYRPTQ; /* Repeat prefix I want to use */
int rptmin = 3; /* Repeat-count minimum */
int usepipes = 0, /* Used for xfer to/from pipes */
g_usepipes = -1;
char * filefile = NULL; /* File containing list of filenames */
/* CD message filename list */
char whoareu[16] = { NUL, NUL }; /* System ID of other Kermit */
int sysindex = -1; /* and index to its system ID struct */
int myindex = -1;
int wearealike = 0; /* 2 Kermits have compatible sysids */
char * cksysid = /* My system ID */
#ifdef UNIX
"U1"
#else
#ifdef VMS
"D7"
#else
#ifdef OSK
"UD"
#else
#ifdef AMIGA
"L3"
#else
#ifdef MAC
"A3"
#else
#ifdef OS2
#ifdef NT
"UN"
#else /* NT */
"UO"
#endif /* NT */
#else /* OS2 */
#ifdef datageneral
"F3"
#else
#ifdef GEMDOS
"K2"
#else
#ifdef STRATUS
"MV"
#else
""
#endif /* STRATUS */
#endif /* GEMDOS */
#endif /* datageneral */
#endif /* OS2 */
#endif /* MAC */
#endif /* AMIGA */
#endif /* OSK */
#endif /* VMS */
#endif /* UNIX */
;
int oopts = -1; /* O-Packet Options */
int omode = -1; /* O-Packet Transfer Mode */
int oname = -1; /* O-Packet Filename Options */
int opath = -1; /* O-Packet Pathname Options */
struct zattr iattr; /* Incoming file attributes */
#ifdef VMS
/* VMS labeled file default options - name only. */
int lf_opts = LBL_NAM;
#else
#ifdef OS2
/* OS/2 labeled file default options, all attributes but archived. */
unsigned long int lf_opts = LBL_EXT|LBL_HID|LBL_RO|LBL_SYS;
#else
int lf_opts = 0;
#endif /* OS2 */
#endif /* VMS */
/* Packet-related variables */
int pktnum = 0, /* Current packet number */
sndtyp = 0, /* Type of packet just sent */
rcvtyp = 0, /* Type of packet just received */
rsn, /* Received packet sequence number */
rln, /* Received packet length */
size, /* Current size of output pkt data */
osize, /* Previous output packet data size */
maxsize, /* Max size for building data field */
spktl = 0, /* Length packet being sent */
rpktl = 0, /* Length of packet just received */
pktpaus = 0, /* Interpacket pause interval, msec */
rprintf, /* REMOTE PRINT flag */
rmailf, /* MAIL flag */
xferstat = -1, /* Status of last transaction */
filestatus = 0; /* Status of last file transfer */
CHAR pktmsgbuf[PKTMSGLEN+1];
CHAR *epktmsg = pktmsgbuf;
#ifdef pdp11
int srvcmdlen = MAXRP; /* srvcmd buffer length */
#else
#ifdef DYNAMIC
int srvcmdlen = MAXRP;
#else
int srvcmdlen = 0;
#endif /* DYNAMIC */
#endif /* pdp11 */
CHAR
#ifdef pdp11
srvcmdbuf[MAXRP+4],
*srvcmd = srvcmdbuf,
#else
#ifdef DYNAMIC
*srvcmd = (CHAR *)0, /* Where to decode server command */
#else
srvcmdbuf[MAXRP+4],
*srvcmd = srvcmdbuf,
#endif /* DYNAMIC */
#endif /* pdp11 */
padbuf[96], /* Buffer for send-padding */
*recpkt,
*rdatap, /* Pointer to received packet data */
*data = (CHAR *)0, /* Pointer to send-packet data */
*srvptr, /* Pointer to srvcmd */
mystch = SOH, /* Outbound packet-start character */
stchr = SOH; /* Incoming packet-start character */
/* File-related variables */
#ifndef NOMSEND /* Multiple SEND */
struct filelist * filehead = NULL; /* SEND list */
struct filelist * filetail = NULL;
struct filelist * filenext = NULL;
int addlist = 0;
#endif /* NOMSEND */
char filnam[CKMAXPATH + 1]; /* Name of current file. */
char ofilnam[CKMAXPATH + 1]; /* Original name. */
int pipesend = 0; /* Nonzero if sending from pipe */
#ifdef PIPESEND
char * sndfilter = NULL; /* Send and receive filters */
char * rcvfilter = NULL;
#endif /* PIPESEND */
char ** sndarray = NULL; /* SEND /ARRAY pointer and range */
#ifndef NOSPL
int sndxlo = -1, sndxhi = -1, sndxin = -1;
#endif /* NOSPL */
#endif /* NOXFER */
#ifndef NOSERVER
int ngetpath = 0; /* GET search path */
int fromgetpath = 0;
char * getpath[MAXGETPATH];
char * x_user = NULL; /* Server login information */
char * x_passwd = NULL;
char * x_acct = NULL;
#endif /* NOSERVER */
int x_login = 0; /* Login required */
int x_logged = 0; /* User is logged in */
extern int timelimit;
#ifdef CK_LOGIN
int logintimo = 300; /* Login timeout */
char * userfile = NULL; /* Forbidden user file */
#endif /* CK_LOGIN */
#ifdef IKSD
char * anonfile = NULL; /* Anonymous login init file */
char * anonroot = NULL; /* Anonymous file-system root */
int iks_timo = 300; /* 5 minutes idle timo */
int iks_retry = 3; /* 3 attempts at login */
#endif /* IKSD */
#ifdef CKSYSLOG
extern VOID zsyslog();
extern int ckxlogging, ckxsyslog;
#endif /* CKSYSLOG */
CK_OFF_T fsize = (CK_OFF_T)0, /* Size of current file */
sendstart = (CK_OFF_T)0, /* SEND start position */
calibrate = (CK_OFF_T)0; /* Nonzero if calibration run */
int nzxopts = 0; /* Options for nzxpand() */
int nfils = 0; /* Number of files in file group */
int wildena = 1; /* Wildcard expansion enabled */
#ifdef UNIX
int wildxpand = 0; /* Who expands wildcards, 0=Kermit.. */
#else /* UNIX */
#ifdef STRATUS
int wildxpand = 1; /* 1=Shell. */
#endif /* STRATUS */
#endif /* UNIX */
#ifdef UNIXOROSK
int matchdot = 0; /* Whether to match dot files */
#else
int matchdot = 1;
#endif /* UNIXOROSK */
int matchfifo = 0; /* Whether to match FIFO "files" */
int clfils = 0; /* Flag for command-line files */
int stayflg = 0; /* Flag for "stay", i.e. "-S" */
int xfinish = 0; /* Flag for FINISH = EXIT */
long ztusec = -1L; /* Used with ztime() */
long ztmsec = -1L; /* Ditto */
/* Communication device / connection variables */
char ttname[TTNAMLEN+1]; /* Name of communication device */