-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathckuusx.c
9718 lines (8997 loc) · 278 KB
/
ckuusx.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 X -- "User Interface" common functions. */
/*
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 module contains user interface functions needed by both the interactive
user interface and the command-line-only user interface, as well as the
screen-control routines (curses and equivalent).
*/
/* Includes */
#include "ckcdeb.h"
#include "ckcasc.h"
#include "ckcker.h"
#include "ckuusr.h"
#include "ckcxla.h"
#ifndef NOHTERMCAP
#ifdef NOTERMCAP
#define NOHTERMCAP
#else
#ifndef BSD44
#define NOHTERMCAP
#else
#ifdef __bsdi__
#define NOHTERMCAP
#else
#ifdef OPENBSD
#define NOHTERMCAP
#else
#ifdef MACOSX
#define NOHTERMCAP
#endif /* MACOSX */
#endif /* OPENBSD */
#endif /* __bsdi__ */
#endif /* BSD44 */
#endif /* NOTERMCAP */
#endif /* NOHTERMCAP */
#ifndef NOTERMCAP
#ifdef BSD44
#ifndef NOHTERMCAP
#include <termcap.h>
#endif /* NOHTERMCAP */
#endif /* BSD44 */
#else /* !BSD44 */
#ifdef linux
#include <term.h>
#endif /* linux */
#endif /* NOTERMCAP */
#ifdef OS2
#include <string.h>
_PROTOTYP(char * os2_gethostname, (void));
#define getpid _getpid
#endif /* OS2 */
#ifdef BSD44
#include <errno.h>
#endif /* BSD44 */
extern xx_strp xxstring;
#ifdef OS2
#include "ckcnet.h"
#else /* OS2 */
_PROTOTYP( char * ckgetpeer, (VOID));
_PROTOTYP(int getlocalipaddr, (void));
_PROTOTYP(int istncomport, (void));
#ifndef NOCKGETFQHOST
_PROTOTYP( char * ckgetfqhostname,(char *));
#endif /* NOCKGETFQHOST */
#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 IBMX25
#define NETCONN
#else
#ifdef HPX25
#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 /* IBMX25 */
#endif /* HPX25 */
#endif /* DECNET */
#endif /* NPIPE */
#endif /* CK_NETBIOS */
#endif /* NETCONN */
#endif /* OS2 */
#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>
#include <tapi.h>
#include "ckntap.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"
#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"
#include "ckosyn.h"
#endif /* OS2 */
#ifdef CK_TAPI
extern int tttapi;
extern int tapipass;
#endif /* CK_TAPI */
#ifdef CK_KERBEROS
#include "ckuath.h"
#endif /* CK_KERBEROS */
#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 */
#ifdef DCLFDOPEN
/* fdopen() needs declaring because it's not declared in <stdio.h> */
_PROTOTYP( FILE * fdopen, (int, char *) );
#endif /* DCLFDOPEN */
#ifdef DCLPOPEN
/* popen() needs declaring because it's not declared in <stdio.h> */
_PROTOTYP( FILE * popen, (char *, char *) );
#endif /* DCLPOPEN */
int tt_crd = 0; /* Carriage return display */
int tt_lfd = 0; /* Linefeed display */
int interrupted = 0; /* Interrupted from keyboard flag */
int fxd_inited = 0; /* Fullscreen stuff initialized */
#ifdef DEBUG
char debfil[CKMAXPATH+1]; /* Debugging log file name */
#endif /* DEBUG */
#ifdef TLOG
char trafil[CKMAXPATH+1]; /* Transaction log file name */
#endif /* TLOG */
char sesfil[CKMAXPATH+1]; /* Session log file name */
#ifdef CKLOGDIAL
char diafil[CKMAXPATH+1]; /* Connection log file name */
char cxlogbuf[CXLOGBUFL+1]; /* Connection log record buffer */
int cx_active = 0; /* Connection is active */
extern int dialog;
#endif /* CKLOGDIAL */
#ifdef DYNAMIC
static char *cmdstr = NULL; /* Place to build generic command */
#else
#ifdef pdp11
static char cmdstr[256];
#else
static char cmdstr[4096];
#endif /* pdp11 */
#endif /* DYNAMIC */
#ifndef NOMSEND
char fspec[CMDBL+4]; /* Filename string for \v(filespec) */
int fspeclen = CMDBL;
#else
char fspec[CKMAXPATH+4];
int fspeclen = CKMAXPATH;
#endif /* NOMSEND */
char * rfspec = NULL; /* Received filespec: local */
char * prfspec = NULL; /* Preliminary rfspec */
char * sfspec = NULL; /* Sent filespec: local */
char * psfspec = NULL; /* Preliminary sfspec */
char * srfspec = NULL; /* Received filespec: remote */
char * psrfspec = NULL; /* Preliminary srfspec */
char * rrfspec = NULL; /* Sent filespec: remote */
char * prrfspec = NULL; /* Preliminary rrfspec */
int success = 1, /* Command success/failure flag */
cmdlvl = 0, /* Command level */
action = 0, /* Action selected on command line */
slogts = 0, /* Session-log timestamps on/off */
slognul = 0, /* Session-log null-terminated lines */
#ifdef UNIX
sessft = XYFT_T, /* Session log file type */
#else
sessft = XYFT_B, /* (text for UNIX binary for others) */
#endif /* UNIX */
pflag = 1, /* Print prompt */
msgflg = 1; /* Print informational messages */
extern int xaskmore, saveask; /* More-prompting */
#ifdef CK_APC
extern int apcactive;
#endif /* CK_APC */
/* External variables */
extern int local, quiet, binary, network, what, parity, xitsta, escape,
tlevel, bgset, backgrd, xsuspend, cmdint, nettype, seslog, dfloc;
extern int cmd_rows, cmd_cols, xcmdsrc;
extern char cmdfil[];
#ifdef VMS
extern int batch;
#endif /* VMS */
#ifdef datageneral /* 2/12/92 ENH */
#include <sysid.h>
extern int con_reads_mt, conint_ch, conint_avl;
#endif /* datageneral */
extern long speed;
extern char ttname[], *dftty, *cmarg, **cmlist, *versio, myhost[];
#ifndef NOCSETS
extern int fcharset, tcharset, xfrxla;
extern struct csinfo fcsinfo[], tcsinfo[];
#endif /* NOCSETS */
#ifdef OS2
extern unsigned char colorcmd;
#endif /* OS2 */
#ifdef NOXFER
int fdispla = XYFD_N;
#else /* NOXFER is not defined */
#ifdef OS2 /* File transfer display type */
int fdispla = XYFD_C; /* Curses (fullscreen) if we have it */
#else
#ifdef CK_CURSES
int fdispla = XYFD_C;
#else
int fdispla = XYFD_S; /* Otherwise CRT */
#endif /* CK_CURSES */
#endif /* OS2 */
extern struct ck_p ptab[];
extern int protocol, xfrbel, xfrint;
#ifdef STREAMING
extern int streaming, streamok;
#endif /* STREAMING */
/* Used internally */
#ifdef KUI
_PROTOTYP( VOID screeng, (int, char, long, char *) );
#endif /* KUI */
_PROTOTYP( VOID screenc, (int, char, CK_OFF_T, char *) );
#ifdef CK_CURSES
#ifndef DYNAMIC
static char xtrmbuf[TRMBUFL]; /* tgetent() buffer */
char * trmbuf = xtrmbuf;
#else
char * trmbuf = NULL;
#endif /* DYNAMIC */
_PROTOTYP( static VOID dpyinit, (void) );
_PROTOTYP( static long shocps, (int, CK_OFF_T, CK_OFF_T) );
_PROTOTYP( static CK_OFF_T shoetl, (CK_OFF_T, long, CK_OFF_T, CK_OFF_T) );
#endif /* CK_CURSES */
static int ft_win = 0; /* Fullscreen file transfer display window is active */
/* Variables declared here */
static char * skreason[] = {
"", /* 0 */
"Remote file not older", /* SKP_DAT */
"Identical modification times", /* SKP_EQU */
"Type", /* SKP_TYP */
"Size", /* SKP_SIZ */
"Name collision", /* SKP_NAM */
"Exception List", /* SKP_EXL */
"Dot file", /* SKP_DOT */
"Backup file", /* SKP_BKU */
"Recovery not needed", /* SKP_RES */
"Access denied", /* SKP_ACC */
"Not a regular file", /* SKP_NRF */
"Simulated", /* SKP_SIM */
"Simulated - Remote file older", /* SKP_XUP */
"Simulated - No remote file", /* SKP_XNX */
};
static int nskreason = (sizeof(skreason) / sizeof(char *));
char *
gskreason(n) int n; {
return((n > 0 && n < nskreason) ? skreason[n] : "");
}
char pktfil[CKMAXPATH+1]; /* Packet log file name */
#ifndef NOMSEND /* Multiple SEND */
char *msfiles[MSENDMAX];
#endif /* NOMSEND */
#ifdef CK_TIMERS
extern long rttdelay;
extern int rttflg;
#endif /* CK_TIMERS */
extern int rcvtimo;
#ifdef CK_RESEND
extern int sendmode;
extern CK_OFF_T sendstart, rs_len;
#endif /* CK_RESEND */
#ifdef CK_PCT_BAR /* File transfer thermometer */
int thermometer = 1; /* ON by default */
#endif /* CK_PCT_BAR */
#ifdef GFTIMER
CKFLOAT gtv = -1.0, oldgtv = -1.0;
#else
#ifndef OS2
static
#endif /* OS2 */
long gtv = -1L, oldgtv = -1L;
#endif /* GFTIMER */
extern int server, bctu, rptflg, ebqflg, spsiz, urpsiz, wmax, czseen, cxseen,
winlo, displa, timint, npad, ebq, bctr, rptq, atcapu, lpcapu,
swcapu, wslotn, wslotr, rtimo, mypadn, sq, capas, rpsiz, tsecs,
pktlog, lscapu, dest, srvdis, wslots, spackets, spktl, rpktl,
retrans, wcur, numerrs, fsecs, whatru, crunched, timeouts,
rpackets, fncnv, bye_active, discard, inserver, diractive, cdactive;
extern long filcnt, filrej, rptn, filcps, tfcps, cps, peakcps;
extern CK_OFF_T ffc, tfc, fsize;
long oldcps = 0L;
extern CHAR *rdatap, padch, seol, ctlq, mypadc, eol, *epktmsg;
extern char *xfrmsg;
#ifdef IKSDB
FILE * dbfp = NULL; /* File pointer to database file */
int dbenabled = 1; /* Flag for database is enabled */
extern int ikdbopen; /* Flag for database is open */
unsigned long mydbseek = 0L; /* Seek pointer to my record */
int mydbslot = 0; /* My slot number */
unsigned long myflags = 0L; /* My flags */
unsigned long myatype = 0L; /* My authorization type */
unsigned long myamode = 0L; /* My authorization mode */
unsigned long mystate = 0L; /* My state (SEND, RECEIVE, etc) */
unsigned long mypid = 0L; /* My PID */
unsigned long myip = 0L; /* My IP address */
unsigned long peerip = 0L; /* My peer's IP address */
unsigned long dbip = 0L; /* IP address in db record */
unsigned long dbpid = 0L; /* PID in db record */
unsigned long dbflags = 0L; /* Flags field in db record */
unsigned long dblastused = 0L; /* Last in-use record in db */
char dbrec[DB_RECL]; /* Database record buffer */
char * dbdir = NULL; /* Database directory */
char * dbfile = NULL; /* Database file full pathname */
char myhexip[33] = { NUL, NUL }; /* My IP address in hex */
char peerhexip[33] = { NUL, NUL }; /* Client's IP address in hex */
#endif /* IKSDB */
#ifdef GFTIMER
extern CKFLOAT fpfsecs, fptsecs, fpxfsecs;
#else
extern long xfsecs;
#endif /* GFTIMER */
#endif /* NOXFER */
#ifdef TCPSOCKET
#ifdef NEWFTP
extern char * ftp_host, ftp_srvtyp[];
extern int ftp_csx, ftp_csl, ftp_deb;
#endif /* NEWFTP */
extern char myipaddr[];
#endif /* TCPSOCKET */
#ifndef NOICP
#ifndef NOSPL
extern struct mtab *mactab; /* For ON_EXIT macro. */
extern int nmac;
#endif /* NOSPL */
#ifdef DCMDBUF
extern char *cmdbuf; /* Command buffer */
#else
extern 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 */
extern int xfiletype, nscanfile;
int
shoesc(escape) int escape; {
extern char * ccntab[]; /* C0 control character name table */
extern int tt_escape;
if ((escape > 0 && escape < 32) || (escape == 127)) {
printf(" Escape character: Ctrl-%c (ASCII %d, %s): %s\r\n",
ctl(escape),
escape,
(escape == 127 ? "DEL" : ccntab[escape]),
tt_escape ? "enabled" : "disabled"
);
} else {
printf(" Escape character: Code %d",escape);
if (escape > 160 && escape < 256)
printf(" (%c)",escape);
printf(": %s\r\n", tt_escape ? "enabled" : "disabled");
}
return(0);
}
#ifndef NOXFER
/* P R E S E T -- Reset global protocol variables */
extern int recursive;
#ifdef PATTERNS
int patterns = SET_AUTO; /* Whether to use filename patterns */
extern int g_patterns; /* For saving and restoring */
#else
int patterns = SET_OFF;
#endif /* PATTERNS */
#ifndef NOICP
#ifdef CK_LABELED
extern int g_lf_opts, lf_opts;
#endif /* CK_LABELED */
extern int g_matchdot, g_usepipes, usepipes;
extern int g_binary, g_proto, g_displa, g_spath, g_rpath, g_fncnv;
extern int g_recursive;
extern int g_xfermode, xfermode;
extern int g_urpsiz, g_spsizf, g_spsiz;
extern int g_spsizr, g_spmax, g_wslotr, g_prefixing, g_fncact;
extern int g_fnspath, g_fnrpath, g_skipbup;
extern int nolinks;
#ifdef CKSYMLINK
extern int zgfs_link;
#endif /* CKSYMLINK */
#ifndef NOSPL
extern int g_pflg, pwflg, g_pcpt, pwcrypt;
extern char * g_pswd, pwbuf[];
#endif /* NOSPL */
#endif /* NOICP */
extern int spsizf, spsizr, spmax, prefixing, fncact, fnspath, fnrpath;
extern int moving; /* SEND criteria */
extern char sndafter[], sndbefore[], *sndexcept[], *rcvexcept[];
extern CK_OFF_T sndlarger, sndsmaller, calibrate;
extern int rmailf, rprintf, skipbup;
extern char optbuf[];
#ifdef PIPESEND
extern char * g_sfilter, * g_rfilter;
extern char * sndfilter, * rcvfilter;
#endif /* PIPESEND */
extern char ** sndarray;
VOID
ftreset() {
#ifndef NOICP
int i;
extern char * filefile;
extern int reliable, xreliable, c_save, ss_save, slostart, urclear;
extern int oopts, omode, oname, opath, kactive, autopath;
extern char * snd_move; /* Directory to move sent files to */
extern char * snd_rename; /* What to rename sent files to */
extern char * rcv_move;
extern char * rcv_rename;
extern char * g_snd_move;
extern char * g_snd_rename;
extern char * g_rcv_move;
extern char * g_rcv_rename;
#ifdef CK_TMPDIR
extern int f_tmpdir;
extern char savdir[];
#endif /* CK_TMPDIR */
#ifdef CK_SPEED
#ifdef COMMENT
extern int f_ctlp;
extern short s_ctlp[], ctlp[];
#endif /* COMMENT */
#endif /* CK_SPEED */
#ifndef NOCSETS
extern int fcs_save, tcs_save;
extern int g_xfrxla, xfrxla;
#endif /* NOCSETS */
/* Restore / reset per-command file-transfer switches */
makestr(&snd_move,g_snd_move);
makestr(&rcv_move,g_rcv_move);
makestr(&snd_rename,g_snd_rename);
makestr(&rcv_rename,g_rcv_rename);
kactive = 0; /* Kermit protocol no longer active */
oopts = -1; /* O-Packet Options */
omode = -1; /* O-Packet Transfer Mode */
oname = -1; /* O-Packet Filename Options */
opath = -1; /* O-Packet Pathname Options */
#ifdef CK_RESEND
rs_len = 0L; /* REGET position */
#endif /* CK_RESEND */
#ifdef COMMENT
#ifdef CK_SPEED
if (f_ctlp) {
for (i = 0; i < 256; i++)
ctlp[i] = s_ctlp[i];
f_ctlp = 0;
}
#endif /* CK_SPEED */
#endif /* COMMENT */
#ifdef CK_TMPDIR
if (f_tmpdir) { /* If we changed to download dir */
zchdir((char *) savdir); /* Go back where we came from */
f_tmpdir = 0;
}
#endif /* CK_TMPDIR */
calibrate = 0L; /* Calibration run */
if (xreliable > -1) {
reliable = xreliable;
debug(F101,"ftreset reliable","",reliable);
}
urclear = 0;
if (autopath) { /* SET RECEIVE PATHNAMES AUTO */
fnrpath = PATH_AUTO;
autopath = 0;
}
if (filefile) { /* File list */
zclose(ZMFILE);
makestr(&filefile,NULL);
}
if (c_save > -1) { /* Block Check Type */
bctr = c_save;
c_save = -1;
}
if (ss_save > -1) { /* Slow Start */
slostart = ss_save;
ss_save = -1;
}
#ifdef CK_LABELED
if (g_lf_opts > -1) {
lf_opts = g_lf_opts; /* Restore labeled transfer options */
g_lf_opts = -1;
}
#endif /* CK_LABELED */
#ifndef NOCSETS
if (tcs_save > -1) { /* Character sets */
tcharset = tcs_save;
tcs_save = -1;
}
if (fcs_save > -1) {
fcharset = fcs_save;
fcs_save = -1;
}
if (g_xfrxla > -1) {
xfrxla = g_xfrxla;
g_xfrxla = -1;
}
setxlatype(tcharset,fcharset); /* Translation type */
#endif /* NOCSETS */
#ifdef NETCONN
#ifndef NOSPL
if (g_pswd) {
ckstrncpy(pwbuf,g_pswd,PWBUFL);
makestr(&g_pswd,NULL);
}
if (g_pflg > -1) {
pwflg = g_pflg;
g_pflg = -1;
}
if (g_pcpt > -1) {
pwcrypt = g_pcpt;
g_pcpt = -1;
}
#endif /* NOSPL */
#endif /* NETCONN */
if (g_binary > -1) { /* File type */
binary = g_binary;
g_binary = -1;
}
if (g_xfermode > -1) { /* Transfer mode */
xfermode = g_xfermode;
g_xfermode = -1;
}
#ifdef PATTERNS
if (g_patterns > -1) { /* Filename patterns */
patterns = g_patterns;
g_patterns = -1;
}
#endif /* PATTERNS */
if (g_usepipes > -1) {
usepipes = g_usepipes;
g_usepipes = -1;
}
if (g_matchdot > -1) {
matchdot = g_matchdot;
g_matchdot = -1;
}
if (g_proto > -1) { /* Protocol */
protocol = g_proto;
g_proto = -1;
}
if (g_urpsiz > -1) {
urpsiz = g_urpsiz;
debug(F101,"ftreset restoring urpsiz","",urpsiz);
g_urpsiz = -1;
}
if (g_spsizf > -1) {
spsizf = g_spsizf;
debug(F101,"ftreset restoring spsizf","",spsizf);
g_spsizf = -1;
}
if (g_spsiz > -1) {
spsiz = g_spsiz;
debug(F101,"ftreset restoring spsiz","",spsiz);
g_spsiz = -1;
}
if (g_spsizr > -1) {
spsizr = g_spsizr;
debug(F101,"ftreset restoring spsizr","",spsizr);
g_spsizr = -1;
}
if (g_spmax > -1) {
spmax = g_spmax;
g_spmax = -1;
}
if (g_wslotr > -1) {
wslotr = g_wslotr;
g_wslotr = -1;
}
if (g_prefixing > -1) {
prefixing = g_prefixing;
g_prefixing = -1;
}
if (g_fncact > -1) {
fncact = g_fncact;
g_fncact = -1;
}
if (g_fncnv > -1) {
fncnv = g_fncnv;
g_fncnv = -1;
}
if (g_fnspath > -1) {
fnspath = g_fnspath;
g_fnspath = -1;
}
if (g_fnrpath > -1) {
fnrpath = g_fnrpath;
g_fnrpath = -1;
}
if (g_skipbup > -1) {
skipbup = g_skipbup;
g_skipbup = -1;
}
nolinks = 2; /* /FOLLOWLINKS is never global */
recursive = 0; /* /RECURSIVE can never be global */
xfiletype = -1;
if (g_displa > -1) { /* File transfer display */
fdispla = g_displa;
g_displa = -1;
}
if (g_spath > -1) { /* Send pathnames */
fnspath = g_spath;
g_spath = -1;
}
if (g_rpath > -1) { /* Receive pathnames */
fnrpath = g_rpath;
g_rpath = -1;
}
if (g_fncnv > -1) { /* Filename conversion */
fncnv = g_fncnv;
g_fncnv = -1;
}
#ifdef PIPESEND
makestr(&sndfilter,g_sfilter); /* Send filter */
makestr(&rcvfilter,g_rfilter); /* Receive filter */
#endif /* PIPESEND */
#ifndef NOFRILLS
rmailf = rprintf = 0; /* MAIL and PRINT modifiers for SEND */
optbuf[0] = NUL; /* MAIL and PRINT options */
#endif /* NOFRILLS */
moving = 0; /* Reset delete-after-send indicator */
sndafter[0] = NUL; /* Reset SEND selection switches */
sndbefore[0] = NUL;
for (i = 0; i < NSNDEXCEPT; i++) {
if (sndexcept[i])
free(sndexcept[i]);
sndexcept[i] = NULL;
if (rcvexcept[i])
free(rcvexcept[i]);
rcvexcept[i] = NULL;
}
sndlarger = (CK_OFF_T)-1;
sndsmaller = (CK_OFF_T)-1;
debug(F101,"present sndsmaller","",sndsmaller);
#ifdef GFTIMER
gtv = -1.0;
oldgtv = -1.0;
#else
gtv = -1L;
oldgtv = -1L;
#endif /* GFTIMER */
#endif /* NOICP */
}
#endif /* NOXFER */
char *
ttgtpn() { /* Get typical port name */
/*
Ideally this routine would be implemented in each of the cku?io.* modules,
but that requires changing the API definition.
*/
return(
#ifdef OS2
#ifdef OS2ONLY
"COM1"
#else /* OS2ONLY */
"TAPI [ name ] or COM1"
#endif /* OS2ONLY */
#else /* OS2 */
#ifdef VMS
"TXA0:, TTA0:, or LTA0:"
#else /* VMS */
#ifdef SOLARIS
"/dev/cua/a"
#else /* SOLARIS */
#ifdef HPUX10
"/dev/cua0p0"
#else /* HPUX10 */
#ifdef HPUX
"/dev/cua00"
#else /* HPUX */
#ifdef __FreeBSD__
"/dev/cuaa0"
#else /* __FreeBSD__ */
#ifdef __linux__
"/dev/ttyS0"
#else /* __linux__ */
#ifdef BSD44
"/dev/tty00"
#else /* BSD44 */
#ifdef OSK
"/t1"
#else /* OSK */
#ifdef QNX
"/dev/ser1"
#else /* QNX */
#ifdef QNX6
"/dev/ser1"
#else /* QNX6 */
#ifdef UNIXWARE
"/dev/term/00 or /dev/tty00"
#else /* UNIXWARE */
#ifdef CK_SCOV5
"/dev/tty1A"
#else /* CK_SCOV5 */
#ifdef CK_SCO32V4
"/dev/tty1A"
#else /* CK_SCO32V4 */
#ifdef M_XENIX
"/dev/tty1A"
#else /* M_XENIX */
#ifdef AIXRS
"/dev/tty0"
#else /* AIXRS */
#ifdef DGUX
"/dev/tty00"
#else /* DGUX */
#ifdef datageneral
"@con1"
#else /* datageneral */
#ifdef IRIX
"/dev/ttym0"
#else /* IRIX */
#ifdef SUNOS4
"/dev/ttyh0"
#else /* SUNOS4 */
#ifdef SV68R3V6
"/dev/scc0"
#else /* SV68R3V6 */
#ifdef MOTSV88R4
"/dev/contty00"
#else /* MOTSV88R4 */
#ifdef NEXT
"/dev/cufa"
#else
#ifdef OSF
"/dev/ttyd1"
#else
#ifdef SINIX
"/dev/ttyc1"
#else
#ifdef UNIX
"/dev/cua, /dev/acu, /dev/tty0, etc"
#else /* UNIX */
"(sorry no example available)"
#endif /* UNIX */
#endif /* SINIX */
#endif /* OSF */
#endif /* NEXT */
#endif /* MOTSV88R4 */
#endif /* SV68R3V6 */
#endif /* SUNOS4 */
#endif /* IRIX */
#endif /* datageneral */
#endif /* DGUX */
#endif /* AIX */
#endif /* M_XENIX */
#endif /* CK_SCO32V4 */
#endif /* CK_SCOV5 */
#endif /* UNIXWARE */
#endif /* QNX6 */
#endif /* QNX */
#endif /* OSK */
#endif /* BSD44 */
#endif /* __linux__ */
#endif /* __FreeBSD__ */
#endif /* HPUX */
#endif /* HPUX10 */
#endif /* SOLARIS */
#endif /* VMS */
#endif /* OS2 */
);
}
/* C K _ E R R S T R -- Return message from most recent system error */
#ifdef CKROOT
extern int ckrooterr;
#endif /* CKROOT */
char *
ck_errstr() {
#ifdef USE_STRERROR
#ifndef CK_ANSILIBS
/* Should have been declared in <string.h> */
_PROTOTYP( char * strerror, (int) );
#endif /* CK_ANSILIBS */
#ifdef CKROOT
if (ckrooterr)
return("Off limits");
#endif /* CKROOT */
return(strerror(errno));
#else /* !USE_STRERROR */
#ifdef VMS
extern char * ckvmserrstr(unsigned long);
#ifdef CKROOT
if (ckrooterr)
return("Off limits");
#endif /* CKROOT */
return(ckvmserrstr(0L));
#else /* !VMS */
#ifdef BSD44
#ifdef __386BSD__
#ifndef NDSYSERRLIST
extern int sys_nerr;
extern char *sys_errlist[];
#endif /* NDSYSERRLIST */
#else /* !__386BSD__ */
#ifndef __bsdi__
#ifndef NDSYSERRLIST
extern int sys_nerr;
extern const char *const sys_errlist[];
#endif /* NDSYSERRLIST */
#endif /* __bsdi__ */
#endif /* __386BSD__ */
#ifdef CKROOT
if (ckrooterr)
return("Off limits");
else
#endif /* CKROOT */
if (errno >= sys_nerr)
return("Error number out of range");
else
return((char *) sys_errlist[errno]);
#else /* !BSD44 */
#ifdef ATTSV
#ifndef NDSYSERRLIST
extern int sys_nerr;
extern char *sys_errlist[];
#endif /* NDSYSERRLIST */
#ifdef CKROOT
if (ckrooterr)