-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathckuus7.c
15323 lines (14428 loc) · 507 KB
/
ckuus7.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
#include "ckcsym.h"
/* C K U U S 7 -- "User Interface" for C-Kermit, part 7 */
/*
Authors:
Frank da Cruz <[email protected]>,
The Kermit Project, Columbia University, New York City
Jeffrey E Altman <[email protected]>
Secure Endpoints Inc., New York City
Copyright (C) 1985, 2011,
Trustees of Columbia University in the City of New York.
All rights reserved. See the C-Kermit COPYING.TXT file or the
copyright text in the ckcmai.c module for disclaimer and permissions.
*/
/*
This file created from parts of ckuus3.c, which became too big for
Mark Williams Coherent compiler to handle.
*/
/*
Definitions here supersede those from system include files.
*/
#include "ckcdeb.h" /* Debugging & compiler things */
#include "ckcasc.h" /* ASCII character symbols */
#include "ckcker.h" /* Kermit application definitions */
#include "ckcxla.h" /* Character set translation */
#include "ckcnet.h" /* Network symbols */
#include "ckuusr.h" /* User interface symbols */
#include "ckucmd.h"
#include "ckclib.h"
#ifdef VMS
#ifndef TCPSOCKET
#include <errno.h>
#endif /* TCPSOCKET */
#endif /* VMS */
#ifdef OS2
#ifndef NT
#define INCL_NOPM
#define INCL_VIO /* Needed for ckocon.h */
#define INCL_DOSMODULEMGR
#include <os2.h>
#undef COMMENT
#else /* NT */
#define APIRET ULONG
#include <windows.h>
#include <tapi.h>
#include "cknwin.h"
#include "ckntap.h"
#endif /* NT */
#include "ckowin.h"
#include "ckocon.h"
#include "ckodir.h"
#ifdef OS2MOUSE
#include "ckokey.h"
#endif /* OS2MOUSE */
#ifdef KUI
#include "ikui.h"
#endif /* KUI */
#ifdef putchar
#undef putchar
#endif /* putchar */
#define putchar(x) conoc(x)
extern int mskkeys;
extern int mskrename;
#endif /* OS2 */
#ifdef CK_AUTHENTICATION
#include "ckuath.h"
#endif /* CK_AUTHENTICATION */
#ifdef CK_SSL
#include "ck_ssl.h"
#endif /* CK_SSL */
#ifdef SSHBUILTIN
#include "ckossh.h"
#endif /* SSHBUILTIN */
#ifdef STRATUS /* Stratus Computer, Inc. VOS */
#ifdef putchar
#undef putchar
#endif /* putchar */
#define putchar(x) conoc(x)
#ifdef getchar
#undef getchar
#endif /* getchar */
#define getchar(x) coninc(0)
#endif /* STRATUS */
char * slmsg = NULL;
static int x, y = 0, z;
static char *s;
extern CHAR feol;
extern int g_matchdot, hints, xcmdsrc, rcdactive;
extern char * k_info_dir;
#ifdef CK_LOGIN
#ifdef CK_PAM
int gotemptypasswd = 0; /* distinguish empty passwd from none given */
#endif /* CK_PAM */
#endif /* CK_LOGIN */
#ifndef NOSPL
extern int nmac;
extern struct mtab *mactab;
#endif /* NOSPL */
#ifndef NOXFER
#ifdef CK_SPEED
extern short ctlp[]; /* Control-char prefixing table */
#endif /* CK_SPEED */
#ifdef PIPESEND
extern char * sndfilter, * g_sfilter;
extern char * rcvfilter, * g_rfilter;
#endif /* PIPESEND */
extern char * snd_move;
extern char * snd_rename;
extern char * g_snd_move;
extern char * g_snd_rename;
extern char * rcv_move;
extern char * rcv_rename;
extern char * g_rcv_move;
extern char * g_rcv_rename;
#ifdef PATTERNS
extern char *binpatterns[], *txtpatterns[];
extern int patterns;
#endif /* PATTERNS */
extern char * remdest;
#ifdef CK_TMPDIR
char * dldir = NULL;
#endif /* CK_TMPDIR */
extern struct ck_p ptab[];
extern int protocol, remfile, rempipe, remappd, reliable, xreliable, fmask,
fncnv, frecl, maxrps, wslotr, bigsbsiz, bigrbsiz, urpsiz, rpsiz, spsiz,
bctr, npad, timef, timint, spsizr, spsizf, maxsps, spmax, nfils, displa,
atcapr, pkttim, rtimo, fncact, mypadn, fdispla, f_save, pktpaus, setreliable,
fnrpath, fnspath, atenci, atenco, atdati, atdato, atleni, atleno, atblki,
atblko, attypi, attypo, atsidi, atsido, atsysi, atsyso, atdisi, atdiso;
extern int stathack;
extern int atfrmi, atfrmo;
#ifdef STRATUS
extern int atcrei, atcreo, atacti, atacto;
#endif /* STRATUS */
#ifdef CK_PERMS
extern int atlpri, atlpro, atgpri, atgpro;
#endif /* CK_PERMS */
extern CHAR
sstate, eol, seol, stchr, mystch, mypadc, padch, ctlq, myctlq;
#ifdef IKSD
extern int inserver;
#ifdef IKSDCONF
extern int iksdcf;
#endif /* IKSDCONF */
#endif /* IKSD */
extern char *cmarg, *cmarg2;
#ifndef NOFRILLS
extern char optbuf[]; /* Buffer for MAIL or PRINT options */
extern int rprintf; /* REMOTE PRINT flag */
#endif /* NOFRILLS */
#endif /* NOXFER */
#ifdef CK_TRIGGER
extern char * tt_trigger[];
#endif /* CK_TRIGGER */
extern int tcs_transp;
#ifdef PCTERM
extern int tt_pcterm;
#endif /* PCTERM */
#ifdef NT
extern int tt_vtnt;
#endif /* NT */
#ifdef SSHBUILTIN
int sl_ssh_xfw = 0;
int sl_ssh_xfw_saved = 0;
int sl_ssh_ver = 0;
int sl_ssh_ver_saved = 0;
#endif /* SSHBUILTIN */
#ifdef CK_AUTHENTICATION
extern int auth_type_user[];
int sl_auth_type_user[AUTHTYPLSTSZ] = {AUTHTYPE_NULL, AUTHTYPE_NULL};
int sl_auth_saved = 0;
int sl_topt_a_su = 0;
int sl_topt_a_s_saved = 0;
int sl_topt_a_cm = 0;
int sl_topt_a_c_saved = 0;
#endif /* CK_AUTHENTICATION */
#ifdef CK_ENCRYPTION
extern int cx_type;
int sl_cx_type = 0;
int sl_cx_saved = 0;
int sl_topt_e_su = 0;
int sl_topt_e_sm = 0;
int sl_topt_e_s_saved = 0;
int sl_topt_e_cu = 0;
int sl_topt_e_cm = 0;
int sl_topt_e_c_saved = 0;
#endif /* CK_ENCRYPTION */
extern char uidbuf[];
static int uidflag = 0;
char sl_uidbuf[UIDBUFLEN] = { NUL, NUL };
int sl_uid_saved = 0;
#ifdef TNCODE
int sl_tn_wait = 0;
int sl_tn_saved = 0;
#endif /* TNCODE */
#ifdef TNCODE
extern int tn_wait_flg;
#endif /* TNCODE */
VOID
slrestor() {
#ifdef CK_AUTHENTICATION
int x;
if (sl_auth_saved) {
for (x = 0; x < AUTHTYPLSTSZ; x++)
auth_type_user[x] = sl_auth_type_user[x];
sl_auth_saved = 0;
}
if (sl_topt_a_s_saved) {
TELOPT_DEF_S_U_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_su;
sl_topt_a_s_saved = 0;
}
if (sl_topt_a_c_saved) {
TELOPT_DEF_C_ME_MODE(TELOPT_AUTHENTICATION) = sl_topt_a_cm;
sl_topt_a_c_saved = 0;
}
#endif /* CK_AUTHENTICATION */
#ifdef CK_ENCRYPTION
if (sl_cx_saved) {
cx_type = sl_cx_type;
sl_cx_saved = 0;
}
if (sl_topt_e_s_saved) {
TELOPT_DEF_S_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_su;
TELOPT_DEF_S_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_sm;
sl_topt_e_s_saved = 0;
}
if (sl_topt_e_c_saved) {
TELOPT_DEF_C_U_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cu;
TELOPT_DEF_C_ME_MODE(TELOPT_ENCRYPTION) = sl_topt_e_cm;
sl_topt_e_c_saved = 0;
}
#endif /* CK_ENCRYPTION */
if (sl_uid_saved) {
ckstrncpy(uidbuf,sl_uidbuf,UIDBUFLEN);
sl_uid_saved = 0;
}
#ifdef TNCODE
if (sl_tn_saved) {
tn_wait_flg = sl_tn_wait;
sl_tn_saved = 0;
}
#endif /* TNCODE */
#ifdef SSHBUILTIN
if (sl_ssh_xfw_saved) {
ssh_xfw = sl_ssh_xfw;
sl_ssh_xfw_saved = 0;
}
if (sl_ssh_ver_saved) {
ssh_ver = sl_ssh_ver;
sl_ssh_ver_saved = 0;
}
#endif /* SSHBUILTIN */
}
int oldplex = -1; /* Duplex holder around network */
#ifndef NOICP
#ifdef LOCUS
extern int locus, autolocus;
#endif /* LOCUS */
#ifndef NODIAL
extern int dialsta;
#endif /* NODIAL */
/* Note: gcc -Wall wants braces around each keyword table entry. */
static struct keytab psltab[] = { /* SET LINE/PORT command options */
{ "/connect", SL_CNX, 0 },
#ifdef OS2ORVMS
{ "/noshare", SL_NSH, 0 },
#endif /* OS2ORVMS */
{ "/server", SL_SRV, 0 },
#ifdef OS2ORVMS
{ "/share", SL_SHR, 0 },
#endif /* OS2ORVMS */
{ "", 0, 0 }
};
static int npsltab = sizeof(psltab)/sizeof(struct keytab) - 1;
#ifdef NETCONN
static struct keytab shtab[] = { /* SET HOST command options */
#ifdef NETCMD
/* (COMMAND is also a network type) */
{ "/command", SL_CMD, CM_INV },
#endif /* NETCMD */
{ "/connect", SL_CNX, 0 },
{ "/network-type", SL_NET, CM_ARG },
{ "/nowait", SL_NOWAIT, 0 },
#ifndef NOSPL
#ifdef CK_AUTHENTICATION
{ "/password", SL_PSW, CM_ARG },
#endif /* CK_AUTHENTICATION */
#endif /* NOSPL */
#ifdef NETCMD
{ "/pipe", SL_CMD, 0 },
#endif /* NETCMD */
#ifdef NETPTY
{ "/pty", SL_PTY, 0 },
#endif /* NETPTY */
{ "/server", SL_SRV, 0 },
{ "/timeout", SL_TMO, CM_ARG },
{ "/userid", SL_UID, CM_ARG },
{ "/wait", SL_WAIT, 0 },
{ "", 0, 0 }
};
static int nshtab = sizeof(shtab)/sizeof(struct keytab) - 1;
static struct keytab shteltab[] = { /* TELNET command options */
#ifdef CK_AUTHENTICATION
{ "/auth", SL_AUTH, CM_ARG },
#endif /* CK_AUTHENTICATION */
#ifdef CK_ENCRYPTION
{ "/encrypt", SL_ENC, CM_ARG },
#endif /* CK_ENCRYPTION */
{ "/nowait", SL_NOWAIT, 0 },
#ifndef NOSPL
#ifdef CK_AUTHENTICATION
{ "/password", SL_PSW, CM_ARG },
#endif /* CK_AUTHENTICATION */
#endif /* NOSPL */
{ "/timeout", SL_TMO, CM_ARG },
{ "/userid", SL_UID, CM_ARG },
{ "/wait", SL_WAIT, 0 },
{ "", 0 ,0 }
};
static int nshteltab = sizeof(shteltab)/sizeof(struct keytab) - 1;
#ifdef RLOGCODE
static struct keytab shrlgtab[] = { /* SET HOST RLOGIN command options */
#ifdef CK_KERBEROS
#ifdef CK_ENCRYPTION
{ "/encrypt", SL_ENC, 0 },
#endif /* CK_ENCRYPTION */
{ "/k4", SL_KRB4, CM_INV },
{ "/k5", SL_KRB5, CM_INV },
{ "/kerberos4", SL_KRB4, 0 },
{ "/kerberos5", SL_KRB5, 0 },
{ "/kerberos_iv", SL_KRB4, CM_INV },
{ "/kerberos_v", SL_KRB5, CM_INV },
{ "/krb4", SL_KRB4, CM_INV },
{ "/krb5", SL_KRB5, CM_INV },
#endif /* CK_KERBEROS */
{ "", 0 ,0 }
};
static int nshrlgtab = sizeof(shrlgtab)/sizeof(struct keytab)-1;
#endif /* RLOGCODE */
extern struct keytab netcmd[];
extern int nnets;
#ifndef NODIAL
extern int dirline;
extern int nnetdir; /* Network services directory */
extern char *netdir[];
_PROTOTYP( VOID ndreset, (void) );
char *nh_p[MAXDNUMS + 1]; /* Network directory entry pointers */
char *nh_p2[MAXDNUMS + 1]; /* Network directory entry nettype */
char *nh_px[4][MAXDNUMS + 1]; /* Network-specific stuff... */
#endif /* NODIAL */
int nhcount = 0;
int ndinited = 0;
char * n_name = NULL; /* Network name pointer */
#endif /* NETCONN */
_PROTOTYP(int remtxt, (char **) );
_PROTOTYP(VOID rmsg, (void) );
_PROTOTYP(static int remcfm, (void) );
extern int nopush;
int mdmsav = -1; /* Save modem type around network */
extern int isguest; /* Global flag for anonymous login */
extern xx_strp xxstring;
extern int success, binary, b_save, ckwarn, msgflg, quiet, cmask, pflag, local,
nettype, escape, mdmtyp, duplex, dfloc, network, cdtimo, autoflow, tnlm,
sosi, tlevel, lf_opts, backgrd, flow, debses, parity, ttnproto, ckxech,
x_ifnum, cmflgs, haveline, cxtype, cxflow[], maclvl;
#ifdef DCMDBUF
extern struct cmdptr *cmdstk; /* The command stack itself */
#else
extern struct cmdptr cmdstk[]; /* The command stack itself */
#endif /* DCMDBUF */
extern FILE * tfile[];
extern char * macp[];
extern char psave[]; /* For saving & restoring prompt */
extern int sprmlen, rprmlen;
#ifdef OS2
static struct keytab strmkeytab[] = {
{ "clear", 0, 0 },
{ "default", 1, 0 }
};
static int nstrmkeytab = sizeof(strmkeytab)/sizeof(struct keytab);
static struct keytab strmswitab[] = {
{ "/literal", 0, 0 }
};
static int nstrmswitab = sizeof(strmswitab)/sizeof(struct keytab);
static struct keytab normrev[] = {
{ "dark-display", 0, 0 },
{ "light-display", 1, 0 },
{ "normal", 0, 0 },
{ "reverse", 1, 0 }
};
static struct keytab prnmtab[] = {
{ "auto", 1, 0 },
{ "copy", 2, 0 },
{ "off", 0, 0 },
{ "on", 1, CM_INV }, /* Compatibility with XPRINT version */
{ "user", 3, 0 },
{ "transparent", 3, CM_INV } /* not really transparent */
};
static int nprnmtab = sizeof(prnmtab)/sizeof(struct keytab);
extern int tt_diff_upd;
#ifdef NT
#define stricmp _stricmp
extern int tt_attr_bug;
#endif /* NT */
extern int tt_rows[], tt_cols[];
extern int tt_cols_usr;
extern int tt_szchng[VNUM];
int tt_modechg = TVC_ENA;
extern int tt_url_hilite, tt_url_hilite_attr;
extern struct _vtG G[4];
extern int priority;
extern bool send_c1;
int send_c1_usr = FALSE;
extern int sgrcolors;
extern int marginbell, marginbellcol;
extern int autoscroll, wy_autopage;
extern int tt_sac;
extern int dec_nrc, dec_lang, dec_kbd;
#else /* OS2 */
extern int tt_rows, tt_cols;
#endif /* OS2 */
extern int tt_escape;
extern long speed;
extern char *dftty;
extern char *tp, *lp; /* Temporary buffer & pointers */
extern char ttname[];
#ifdef CK_TAPI
int tttapi = 0; /* is Line TAPI? */
struct keytab * tapilinetab = NULL;
struct keytab * _tapilinetab = NULL;
int ntapiline = 0;
#endif /* CK_TAPI */
#ifdef NETCONN /* Network items */
#ifdef ANYX25
extern int revcall, closgr, cudata, nx25;
extern char udata[];
extern struct keytab x25tab[];
#ifndef IBMX25
extern int npadx3;
extern CHAR padparms[];
extern struct keytab padx3tab[];
#endif /* IBMX25 */
#endif /* ANYX25 */
#ifdef OS2
extern bool ttshare;
#ifndef NT
extern bool ttslip,ttppp;
#endif /* NT */
#endif /* OS2 */
#ifdef NPIPE
extern char pipename[];
#endif /* NPIPE */
#ifdef TCPSOCKET
static struct keytab tcprawtab[] = { /* SET HOST options */
{ "/default", NP_DEFAULT, CM_INV },
#ifdef CK_AUTHENTICATION
#ifdef CK_KERBEROS
#ifdef RLOGCODE
{ "/ek4login", NP_EK4LOGIN, 0 },
{ "/ek5login", NP_EK5LOGIN, 0 },
{ "/k4login", NP_K4LOGIN, 0 },
{ "/k5login", NP_K5LOGIN, 0 },
#endif /* RLOGCODE */
#ifdef KRB5_U2U
{ "/k5user2user", NP_K5U2U, 0 },
#endif /* KRB5_U2U */
#endif /* CK_KERBEROS */
#endif /* CK_AUTHENTICATION */
{ "/no-telnet-init", NP_NONE, 0 },
{ "/none", NP_NONE, CM_INV },
{ "/raw-socket", NP_TCPRAW, 0 },
#ifdef RLOGCODE
{ "/rlogin", NP_RLOGIN, 0 },
#endif /* RLOGCODE */
#ifdef CK_SSL
{ "/ssl", NP_SSL, 0 },
{ "/ssl-raw", NP_SSL_RAW, 0 },
{ "/ssl-telnet", NP_SSL_TELNET, 0 },
#endif /* CK_SSL */
{ "/telnet", NP_TELNET, 0 },
#ifdef CK_SSL
{ "/tls", NP_TLS, 0 },
{ "/tls-raw", NP_TLS_RAW, 0 },
{ "/tls-telnet", NP_TLS_TELNET, 0 },
#endif /* CK_SSL */
{ "", 0, 0 }
};
static int ntcpraw = (sizeof(tcprawtab) / sizeof(struct keytab)) - 1;
#ifdef RLOGCODE
_PROTOTYP( int rlog_naws, (void) );
#endif /* RLOGCODE */
#endif /* TCPSOCKET */
#ifdef SUPERLAT
extern char slat_pwd[18];
#endif /* SUPERLAT */
#endif /* NETCONN */
#ifdef COMMENT
#ifndef NOSETKEY
extern KEY *keymap;
#ifndef OS2
#define mapkey(x) keymap[x]
#endif /* OS2 */
extern MACRO *macrotab;
#ifndef NOKVERBS
extern struct keytab kverbs[];
extern int nkverbs;
#endif /* NOKVERBS */
#endif /* NOSETKEY */
#else
#ifndef NOSETKEY
extern KEY *keymap;
extern MACRO *macrotab;
#ifndef NOKVERBS
extern struct keytab kverbs[];
extern int nkverbs;
#endif /* NOKVERBS */
#endif /* NOSETKEY */
#endif /* COMMENT */
#ifdef OS2 /* AUTODOWNLOAD parameters */
extern int adl_kmode, adl_zmode; /* Match Packet to signal download */
extern char * adl_kstr; /* KERMIT Download String */
extern char * adl_zstr; /* ZMODEM Download String */
extern int adl_kc0, adl_zc0; /* Process ADL C0s in emulation */
#endif /* OS2 */
/* Keyword tables ... */
extern struct keytab onoff[], rltab[];
extern int nrlt;
#ifndef NOCSETS
static struct keytab fdfltab[] = {
{ "7bit-character-set", 7, 0 },
{ "8bit-character-set", 8, 0 }
};
static int nfdflt = (sizeof(fdfltab) / sizeof(struct keytab));
#endif /* NOCSETS */
/* SET FILE parameters */
static struct keytab filtab[] = {
#ifndef NOXFER
#ifdef PATTERNS
{ "binary-patterns", XYFIBP, 0 },
#endif /* PATTERNS */
{ "bytesize", XYFILS, 0 },
#ifndef NOCSETS
{ "character-set", XYFILC, 0 },
#endif /* NOCSETS */
{ "collision", XYFILX, 0 },
{ "default", XYF_DFLT, 0 },
{ "destination", XYFILY, 0 },
{ "display", XYFILD, CM_INV },
#ifdef CK_TMPDIR
{ "download-directory", XYFILG, 0 },
#endif /* CK_TMPDIR */
#endif /* NOXFER */
{ "end-of-line", XYFILA, 0 },
{ "eol", XYFILA, CM_INV },
#ifdef CK_CTRLZ
{ "eof", XYFILV, 0 },
#endif /* CK_CTRLZ */
#ifndef NOXFER
{ "fastlookups", 9997, CM_INV },
{ "incomplete", XYFILI, 0 },
#ifndef datageneral
{ "inspection", XYF_INSP, CM_INV },
#endif /* datageneral */
#ifdef CK_LABELED
{ "label", XYFILL, 0 },
#endif /* CK_LABELED */
#ifdef UNIX
#ifdef DYNAMIC
{ "listsize", XYF_LSIZ, 0 },
#endif /* DYNAMIC */
#endif /* UNIX */
{ "names", XYFILN, 0 },
#ifdef UNIX
{ "output", XYFILH, 0 },
#endif /* UNIX */
#ifdef PATTERNS
{ "patterns", XYFIPA, 0 },
#endif /* PATTERNS */
#ifdef COMMENT /* Not implemented (but see CHMOD) */
{ "permissions", XYF_PRM, CM_INV },
{ "protection", XYF_PRM, 0 },
#endif /* COMMENt */
#ifdef VMS
{ "record-length", XYFILR, 0 },
#endif /* VMS */
#ifndef datageneral
{ "scan", XYF_INSP, 0 },
#endif /* datageneral */
#ifdef UNIX
#ifdef DYNAMIC
{ "stringspace", XYF_SSPA, 0 },
#endif /* DYNAMIC */
#endif /* UNIX */
#ifdef PATTERNS
{ "t", XYFILT, CM_INV|CM_ABR },
{ "text-patterns", XYFITP, 0 },
#endif /* PATTERNS */
#endif /* NOXFER */
{ "type", XYFILT, 0 },
#ifdef UNICODE
{ "ucs", XYFILU, 0 },
#endif /* UNICODE */
#ifndef NOXFER
{ "warning", XYFILW, CM_INV }
#endif /* NOXFER */
};
static int nfilp = (sizeof(filtab) / sizeof(struct keytab));
struct keytab pathtab[] = {
{ "absolute", PATH_ABS, 0 },
{ "none", PATH_OFF, CM_INV },
{ "off", PATH_OFF, 0 },
{ "on", PATH_ABS, CM_INV },
{ "relative", PATH_REL, 0 }
};
int npathtab = (sizeof(pathtab) / sizeof(struct keytab));
struct keytab rpathtab[] = {
{ "absolute", PATH_ABS, 0 },
{ "auto", PATH_AUTO, 0 },
{ "none", PATH_OFF, CM_INV },
{ "off", PATH_OFF, 0 },
{ "on", PATH_ABS, CM_INV },
{ "relative", PATH_REL, 0 }
};
int nrpathtab = (sizeof(rpathtab) / sizeof(struct keytab));
#ifdef CK_CTRLZ
struct keytab eoftab[] = { /* EOF detection method */
{ "ctrl-z", 1, 0 },
{ "length", 0, 0 },
{ "noctrl-z", 0, CM_INV }
};
#endif /* CK_CTRLZ */
struct keytab fttab[] = { /* File types for SET FILE TYPE */
{ "ascii", XYFT_T, CM_INV },
#ifdef VMS
{ "b", XYFT_B, CM_INV|CM_ABR },
#endif /* VMS */
{ "binary", XYFT_B, 0 },
#ifdef VMS
{ "block", XYFT_I, CM_INV },
{ "image", XYFT_I, 0 },
#endif /* VMS */
#ifdef CK_LABELED
{ "labeled", XYFT_L, 0 },
#endif /* CK_LABELED */
#ifdef MAC
{ "macbinary", XYFT_M, 0 },
#endif /* MAC */
{ "text", XYFT_T, 0 }
};
int nfttyp = (sizeof(fttab) / sizeof(struct keytab));
static struct keytab rfttab[] = { /* File types for REMOTE SET FILE */
{ "ascii", XYFT_T, CM_INV },
{ "binary", XYFT_B, 0 },
#ifdef VMS
{ "labeled", XYFT_L, 0 },
#else
#ifdef OS2
{ "labeled", XYFT_L, 0 },
#endif /* OS2 */
#endif /* VMS */
{ "text", XYFT_T, 0 }
};
static int nrfttyp = (sizeof(rfttab) / sizeof(struct keytab));
#ifdef OS2ORUNIX
#define ZOF_BLK 0
#define ZOF_NBLK 1
#define ZOF_BUF 2
#define ZOF_NBUF 3
static struct keytab zoftab[] = {
{ "blocking", ZOF_BLK, 0 },
{ "buffered", ZOF_BUF, 0 },
{ "nonblocking", ZOF_NBLK, 0 },
{ "unbuffered", ZOF_NBUF, 0 }
};
static int nzoftab = (sizeof(zoftab) / sizeof(struct keytab));
#endif /* OS2ORUNIX */
extern int query; /* Global flag for QUERY active */
#ifndef NOSPL
#ifndef NOXFER
static struct keytab vartyp[] = { /* Variable types for REMOTE QUERY */
{ "global", (int) 'G', CM_INV },
{ "kermit", (int) 'K', 0 },
{ "system", (int) 'S', 0 },
{ "user", (int) 'G', 0 }
};
static int nvartyp = (sizeof(vartyp) / sizeof(struct keytab));
#endif /* NOXFER */
#endif /* NOSPL */
#ifdef CK_TIMERS
static struct keytab timotab[] = { /* Timer types */
{ "dynamic", 1, 0 },
{ "fixed", 0, 0 }
};
#endif /* CK_TIMERS */
#ifdef DCMDBUF
extern char *atxbuf, *atmbuf; /* Atom buffer */
extern char *cmdbuf; /* Command buffer */
extern char *line, *tmpbuf; /* Character buffers for anything */
extern int *intime; /* INPUT TIMEOUT */
#else /* Not DCMDBUF ... */
extern char atxbuf[], atmbuf[]; /* Atom buffer */
extern char cmdbuf[]; /* Command buffer */
extern char line[], tmpbuf[]; /* Character buffer for anything */
extern int intime[];
#endif /* DCMDBUF */
#ifndef NOCSETS
extern struct keytab fcstab[]; /* For SET FILE CHARACTER-SET */
extern struct csinfo fcsinfo[]; /* File character set info. */
extern struct keytab ttcstab[];
extern int nfilc, fcharset, tcharset, ntermc, tcsr, tcsl, dcset7, dcset8;
#ifdef CKOUNI
extern int tt_utf8;
#endif /* CKOUNI */
#ifdef OS2
_PROTOTYP( int os2setcp, (int) );
_PROTOTYP( int os2getcp, (void) );
_PROTOTYP( void os2debugoff, (void) );
#endif /* OS2 */
#endif /* NOCSETS */
extern int cmdlvl; /* Overall command level */
#ifndef NOSPL
#ifdef DCMDBUF
extern int *inpcas; /* INPUT CASE setting on cmd stack */
#else
extern int inpcas[];
#endif /* DCMDBUF */
#endif /* NOSPL */
#ifdef CK_CURSES
#ifndef VMS
_PROTOTYP(int tgetent,(char *, char *));
#else
#ifdef __DECC
_PROTOTYP(int tgetent,(char *, char *));
#endif /* __DECC */
#endif /* VMS */
#endif /* CK_CURSES */
#ifndef NOXMIT
#define XMITF 0 /* SET TRANSMIT values */
#define XMITL 1 /* (Local to this module) */
#define XMITP 2
#define XMITE 3
#define XMITX 4
#define XMITS 5
#define XMITW 6
#define XMITT 7
#define XMBUFL 50
extern int xmitf, xmitl, xmitp, xmitx, xmits, xmitw, xmitt;
char xmitbuf[XMBUFL+1] = { NUL }; /* TRANSMIT eof string */
struct keytab xmitab[] = { /* SET TRANSMIT */
{ "echo", XMITX, 0 },
{ "eof", XMITE, 0 },
{ "fill", XMITF, 0 },
{ "linefeed", XMITL, 0 },
{ "locking-shift", XMITS, 0 },
{ "pause", XMITW, 0 },
{ "prompt", XMITP, 0 },
{ "timeout", XMITT, 0 }
};
int nxmit = (sizeof(xmitab) / sizeof(struct keytab));
#endif /* NOXMIT */
/* For SET FILE COLLISION */
/* Some of the following may be possible for some C-Kermit implementations */
/* but not others. Those that are not possible for your implementation */
/* should be ifdef'd out. */
struct keytab colxtab[] = { /* SET FILE COLLISION options */
#ifndef MAC
{ "append", XYFX_A, 0 }, /* append to old file */
#endif /* MAC */
#ifdef COMMENT
{ "ask", XYFX_Q, 0 }, /* ask what to do (not implemented) */
#endif
{ "backup", XYFX_B, 0 }, /* rename old file */
#ifndef MAC
/* This crashes Mac Kermit. */
{ "discard", XYFX_D, CM_INV }, /* don't accept new file */
{ "no-supersede", XYFX_D, CM_INV }, /* ditto (MSK compatibility) */
#endif /* MAC */
{ "overwrite", XYFX_X, 0 }, /* overwrite the old file */
{ "reject", XYFX_D, 0 }, /* (better word than discard) */
{ "rename", XYFX_R, 0 }, /* rename the incoming file */
#ifndef MAC /* This crashes Mac Kermit. */
{ "update", XYFX_U, 0 }, /* replace if newer */
#endif /* MAC */
{ "", 0, 0 }
};
int ncolx = (sizeof(colxtab) / sizeof(struct keytab)) - 1;
static struct keytab rfiltab[] = { /* for REMOTE SET FILE */
#ifndef NOCSETS
{ "character-set", XYFILC, 0 },
#endif /* NOCSETS */
{ "collision", XYFILX, 0 },
{ "incomplete", XYFILI, 0 },
{ "names", XYFILN, 0 },
{ "record-length", XYFILR, 0 },
{ "type", XYFILT, 0 }
};
int nrfilp = (sizeof(rfiltab) / sizeof(struct keytab));
struct keytab eoltab[] = { /* File eof delimiters */
{ "cr", XYFA_C, 0 },
{ "crlf", XYFA_2, 0 },
{ "lf", XYFA_L, 0 }
};
static int neoltab = (sizeof(eoltab) / sizeof(struct keytab));
struct keytab fntab[] = { /* File naming */
{ "converted", XYFN_C, 0 },
{ "literal", XYFN_L, 0 },
{ "standard", XYFN_C, CM_INV }
};
int nfntab = (sizeof(fntab) / sizeof(struct keytab));
#ifndef NOLOCAL
/* Terminal parameters table */
static struct keytab trmtab[] = {
#ifdef OS2
{ "answerback", XYTANS, 0 },
#endif /* OS2 */
#ifdef CK_APC
{ "apc", XYTAPC, 0 },
#endif /* CK_APC */
#ifdef OS2
{ "arrow-keys", XYTARR, 0 },
#endif /* OS2 */
#ifdef NT
{ "at", XYTATTR, CM_INV|CM_ABR },
{ "att", XYTATTR, CM_INV|CM_ABR },
{ "attr", XYTATTR, CM_INV|CM_ABR },
{ "attr-bug", XYTATTBUG, CM_INV },
#endif /* NT */
#ifdef OS2
{ "attribute", XYTATTR, 0 },
#endif /* OS2 */
#ifdef CK_APC
#ifdef CK_AUTODL
{ "autodownload", XYTAUTODL, 0, },
#endif /* CK_AUTODL */
#endif /* CK_APC */
#ifdef OS2
{ "autopage", XYTAPAGE, 0 },
{ "autoscroll", XYTASCRL, 0 },
{ "bell", XYTBEL, CM_INV },
#endif /* OS2 */
{ "bytesize", XYTBYT, 0 },
#ifndef NOCSETS
{ "character-set", XYTCS, 0 },
#endif /* NOCSETS */
#ifdef OS2
{ "code-page", XYTCPG, 0 },
{ "color", XYTCOL, 0 },
{ "controls", XYTCTRL, 0 },
#endif /* OS2 */
{ "cr-display", XYTCRD, 0 },
#ifdef OS2
{ "cursor", XYTCUR, 0 },
#endif /* OS2 */
{ "debug", XYTDEB, 0 },
#ifdef OS2
{ "dg-unix-mode", XYTUNX, 0 },
#endif /* OS2 */
{ "echo", XYTEC, 0 },
{ "escape-character", XYTESC, 0 },
#ifdef OS2
#ifdef PCFONTS
{ "font", XYTFON, 0 },
#else
#ifdef KUI
{ "font", XYTFON, 0 },
#endif /* KUI */
#endif /* PCFONTS */
#endif /* OS2 */
{ "height", XYTHIG, 0 },
#ifdef CKTIDLE
{ "idle-action", XYTIACT, 0 },
{ "idle-limit", XYTITMO, CM_INV },
{ "idle-send", XYTIDLE, CM_INV },
{ "idle-timeout", XYTITMO, 0 },
#endif /* CKTIDLE */
#ifdef OS2
#ifndef NOCSETS
{ "kbd-follows-gl/gr", XYTKBDGL, 0 },
#endif /* NOCSETS */
{ "key", XYTKEY, 0 },
{ "keyboard-mode", XYTKBMOD, 0 },
{ "keypad-mode", XYTKPD, 0 },
#endif /* OS2 */
{ "lf-display", XYTLFD, 0 },
#ifndef NOCSETS
#ifdef OS2
#ifndef KUI
{ "line-spacing", XYTLSP, CM_INV },
{ "local-character-set", XYTLCS, 0 },
#else
{ "line-spacing", XYTLSP, 0 },
{ "local-character-set", XYTLCS, CM_INV },
#endif /* KUI */
#else
{ "local-character-set", XYTLCS, CM_INV },
#endif /* OS2 */
#endif /* NOCSETS */
{ "locking-shift", XYTSO, 0 },
#ifdef OS2
{ "margin-bell", XYTMBEL, 0 },