-
Notifications
You must be signed in to change notification settings - Fork 4
/
ckuus2.c
1775 lines (1547 loc) · 37.4 KB
/
ckuus2.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
/* C K U U S 2 -- "User Interface" STRINGS module */
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright (c) 2021, 2022, 2023 Jeffrey H. Johnson <[email protected]>
*
* Copyright (c) 1981-2011,
* 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.
*/
#include "ckcdeb.h"
#include "ckcker.h"
#include "ckucmd.h"
#include "ckuusr.h"
#include <ctype.h>
#include <stdio.h>
#ifdef __linux__
#include <string.h>
#endif /* ifdef __linux__ */
#ifndef XENIX
#ifndef unos
#include <sys/file.h> /* File information */
#endif /* ifndef unos */
#endif /* ifndef XENIX */
#ifdef BSD4
#include <fcntl.h>
#include <sys/file.h>
#endif /* ifdef BSD4 */
#ifdef UXIII
#ifdef CK_TERMIOS
#include <termios.h>
#else
#include <termio.h>
#endif /* ifdef CK_TERMIOS */
#include <sys/ioctl.h>
#include <errno.h> /* error numbers for system returns */
#include <fcntl.h> /* directory reading for locking */
#endif /* ifdef UXIII */
#ifdef HPUX
#include <sys/modem.h>
#endif /* ifdef HPUX */
#ifndef UXIII
#include <sgtty.h> /* Set/Get tty modes */
#ifndef V7
#ifndef BSD41
#include <sys/time.h> /* Clock info (for break generation) */
#endif /* ifndef BSD41 */
#endif /* ifndef V7 */
#endif /* ifndef UXIII */
#ifdef BSD41
#include <sys/timeb.h> /* BSD 4.1 */
#endif /* ifdef BSD41 */
#ifdef BSD29
#include <sys/timeb.h> /* BSD 2.9 */
#endif /* ifdef BSD29 */
#ifdef ultrix
#include <sys/ioctl.h>
#endif /* ifdef ultrix */
extern CHAR mystch, stchr, eol, seol, padch, mypadc, ctlq;
extern CHAR data[], *rdatap, ttname[];
extern char cmdbuf[], line[], debfil[], pktfil[], sesfil[], trafil[];
extern int nrmt, nprm, dfloc, deblog, seslog, speed, local, parity, duplex;
extern int turn, turnch, pktlog, tralog, mdmtyp, flow, cmask, timef, spsizf;
extern int rtimo, timint, srvtim, npad, mypadn, bctr, delay;
extern int maxtry, spsiz, urpsiz, maxsps, maxrps, ebqflg, ebq;
extern int rptflg, rptq, fncnv, binary, pktlog, warn, quiet, fmask, keep;
extern int tsecs, bctu, len, lpcapu, swcapu, wslots, sq, rpsiz;
extern int capas;
#ifndef NOATTR
extern int atcapr;
extern int atcapu;
#endif /* ifndef NOATTR */
extern long filcnt, tfc, tlci, tlco, ffc, flci, flco;
extern char *dftty, *versio, *ckxsys;
extern struct keytab prmtab[];
extern struct keytab remcmd[];
#ifndef NODOHLP
int bcharc;
#endif /* ifndef NODOHLP */
static char *hlp1[] = {
"\rUsage: [ -x arg [ -x arg ] [ -yy ] ] ]\n",
#ifndef NODOHLP
" ACTION -- (* options require setting '-l' and '-b')\n",
" -s file(s) send (use '-s -' for stdin)\n",
" -r receive\n",
" -k receive to console\n",
" * -g file(s) get remote file(s) from server (quote wildcards)\n",
" -a name alternate name (for '-s', '-r', and '-g')\n",
#ifndef NOSERVER
" -x start server mode\n",
#endif /* ifndef NOSERVER */
" * -f send finish command to remote\n",
#ifndef NOCONN
" * -c connect pre-transaction\n",
" * -n connect post-transaction\n",
#endif /* ifndef NOCONN */
" SETTING --\n",
" -l line line device (e.g. '/dev/ttyS1')\n",
" -b baud baud (e.g. '9600')\n",
" -i disable binary mode (do text conversion)\n",
" -p x parity ('e', 'o', 'm', 's', or 'n')\n",
" -t set line turnaround to XON (half duplex)\n",
" -w overwrite existing files\n",
" -q quiet mode (no status display)\n",
#ifndef NOLOGS
#ifdef DEBUG
" -d debug mode (write debug.log)\n",
#endif /* ifdef DEBUG */
#endif /* ifndef NOLOGS */
" -e length set extended receive packet length\n",
#ifndef NOICP
"If no ACTION is specified, uCKermit enters interactive mode.\n",
#endif /* ifndef NOICP */
#endif /* ifndef NODOHLP */
""
};
/* U S A G E */
int
usage()
{
conola(hlp1);
return ( 0 );
}
/*
* Help string
* definitions
*/
#ifndef NODOHLP
static char *tophlp[] = {
"\n\
Type '?' for a list of commands; Type 'help X' for any command 'X'.\n\
In interactive mode, the following characters have special meaning:\n\n\
CTRL-H: (or BACKSPACE, DELETE): Delete the most recent character.\n\
CTRL-W: Delete the most recent full word.\n",
"\
CTRL-U: Delete the current full line.\n\
CTRL-R: Redisplay the current full line.\n\
CTRL-L: Clear the display and then execute the current full line.\n\
?: (QUESTION) Display help for the current command or field.\n\
ESCAPE: (or TAB) Attempt completing the current command or field.\n",
"\
\\: (BACKSLASH) Include, literally, the next input character.\n\n",
""
};
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxbye = "\
Shut down and log out a remote Kermit server";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxclo =
"\
Close one of the following logs:\n\
session, transaction, packet, debugging -- 'help log' for further info.";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxcon =
"\
Connect to a remote system via the tty device given in the\n\
most recent 'set line' command";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxget =
"\
Format: 'get filespec'. Tell the remote Kermit server to send the named\n\
files. If filespec is omitted, then you are prompted for the remote and\n\
local filenames separately.";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxlg[] = {
"\
Record information in a log file:\n\n\
debugging Debugging information, to help track down\n\
(default debug.log) bugs in the uCKermit program.\n\n\
packets Kermit packets, to help track down protocol problems.\n\
(packet.log)\n\n",
" session Terminal session, during CONNECT command.\n\
(session.log)\n\n\
transactions Names and statistics about files transferred.\n\
(transact.log)\n",
""
};
#endif /* ifndef NODOHLP */
#ifndef NOCKUSCR
#ifndef NODOHLP
static char *hmxxlogi[] = {
"\
Syntax: script text\n\n",
"Login to a remote system using the text provided. The login script\n",
"is intended to operate similarly to uucp \"L.sys\" entries.\n",
"A login script is a sequence of the form:\n\n",
" expect send [expect send] . . .\n\n",
"where 'expect' is a prompt or message to be issued by the remote site, "
"and\n",
"'send' is the names, numbers, etc, to return. The send may also be the\n",
"keyword EOT, to send control-d, or BREAK, to send a break. Letters in\n",
"send may be prefixed by ~ to send special characters. These are:\n",
"~b backspace, ~s space, ~q '?', ~n linefeed, ~r return, ~c don\'t\n",
"append a return, and ~o[o[o]] for octal of a character. As with some \n",
"uucp systems, sent strings are followed by ~r unless they end with "
"~c.\n\n",
"Only the last 7 characters in each expect are matched. A null expect,\n",
"e.g. ~0 or two adjacent dashes, causes a short delay. If you expect\n",
"that a sequence might not arrive, as with uucp, conditional sequences\n",
"may be expressed in the form:\n\n",
" -send-expect[-send-expect[...]]\n\n",
"where dashed sequences are followed as long as previous expects fail.\n",
""
};
#endif /* ifndef NODOHLP */
#endif /* ifndef NOCKUSCR */
#ifndef NODOHLP
static char *hmxxrc[] = {
"\
Format: 'receive [filespec]'. Wait for a file to arrive from the other\n\
Kermit, which must be given a 'send' command. If the optional filespec is\n",
"given, the (first) incoming file will be stored under that name, otherwise\n\
it will be stored under the name it arrives with.",
""
};
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxsen =
"\
Format: 'send file1 [file2]'. File1 may contain wildcard characters '*' or\n\
'?'. If no wildcards, then file2 may be used to specify the name file1 is\n\
sent under; if file2 is omitted, file1 is sent under its own name.";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxxser =
"\
Enter server mode on the currently selected line. All further commands\n\
will be taken in packet form from the other Kermit program.";
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmhset[] = {
"\
The 'set' command is used to establish various communication or file\n",
"parameters. The 'show' command can be used to display the values of\n",
"'set' parameters. Help is available for each individual parameter;\n",
"type 'help set ?' to see what's available.\n", ""
};
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxychkt[] = {
"\
Type of packet block check to be used for error detection, 1, 2, or 3.\n",
"Type 1 is standard, and catches most errors. "
"Types 2 and 3 specify more\n",
"rigorous checking at the cost of higher overhead. "
"Not all Kermit programs\n",
"support types 2 and 3.\n", ""
};
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmxyf[] = {
"\
set file: names, type, overwrite, display.\n\n",
"'names' are normally 'converted', which means file names are converted\n",
"to 'common form' during transmission; 'literal' means use filenames\n",
"literally (useful between like system types).\n\n",
"'type' defaults to 'binary' with no conversion of local and remote\n",
"newlines and CR-LF line delimiters; 'text' enables this conversion.\n",
"Use 'binary' for executable programs or data, and 'text' otherwise.\n\n",
"'overwrite' is 'on' or 'off', normally off. When on, incoming files\n",
"overwrite existing files of the same name. When off, new names will be\n",
"given to incoming files whose names are the same as existing files.\n",
"\n\
'display' is normally 'on', causing file transfer progress to be displayed\n",
"on your screen when in local mode. 'set display off' is useful for\n",
"allowing file transfers to proceed in the background.\n\n",
""
};
#endif /* ifndef NODOHLP */
#ifndef NODOHLP
static char *hmhrmt[] = {
"\
The 'remote' command is used to send file management instructions to a\n",
"remote Kermit server. There should already be a Kermit running in "
"server\n",
"mode on the other end of the currently selected line. Type 'remote ?' "
"to\n",
"see a list of available remote commands. Type 'help remote x' to get\n",
"further information about a particular remote command 'x'.\n",
""
};
#endif /* ifndef NODOHLP */
/* D O H L P -- Give a help message */
#ifndef NODOHLP
int
dohlp(xx)
int xx;
{
int x;
int y;
if (xx < 0)
{
return ( xx );
}
switch (xx)
{
case XXBYE:
return ( hmsg(hmxxbye) );
case XXCLO:
return ( hmsg(hmxxclo) );
#ifndef NOCONN
case XXCON:
return ( hmsg(hmxxcon) );
#endif /* ifndef NOCONN */
case XXCWD:
return ( hmsg(
"Change Working Directory") );
case XXDEL:
return ( hmsg("Delete a local file or files") );
#ifndef NOCKUDIA
case XXDIAL:
return ( hmsg("Dial a number using modem autodialer") );
#endif /* ifndef NOCKUDIA */
case XXDIR:
return ( hmsg("Display a directory of local files") );
case XXECH:
return ( hmsg(
"Display the rest of the command on the terminal,\n\
useful in command files."));
case XXEXI:
case XXQUI:
return ( hmsg("Exit the program, clesing any open logs.") );
case XXFIN:
return ( hmsg(
"\
Tell the remote Kermit server to shut down without logging out.") );
case XXGET:
return ( hmsg(hmxxget) );
#ifndef NOCKUDIA
case XXHAN:
return ( hmsg("Hang up the phone.") );
#endif /* ifndef NOCKUDIA */
case XXHLP:
return ( hmsga(tophlp) );
#ifndef NOLOGS
case XXLOG:
return ( hmsga(hmxxlg) );
#endif /* ifndef NOLOGS */
#ifndef NOCKUSCR
case XXLOGI:
return ( hmsga(hmxxlogi) );
#endif /* ifndef NOCKUSCR */
case XXREC:
return ( hmsga(hmxxrc) );
case XXREM:
if (( y = cmkey(remcmd, nrmt, "Remote command", "")) == -2)
{
return ( y );
}
if (y == -1)
{
return ( y );
}
if (( x = cmcfm()) < 0)
{
return ( x );
}
return ( dohrmt(y) );
case XXSEN:
return ( hmsg(hmxxsen) );
case XXSER:
return ( hmsg(hmxxser) );
case XXSET:
if (( y = cmkey(prmtab, nprm, "Parameter", "")) == -2)
{
return ( y );
}
if (y == -2)
{
return ( y );
}
if (( x = cmcfm()) < 0)
{
return ( x );
}
return ( dohset(y) );
#ifndef NOPUSH
case XXSHE:
return ( hmsg(
"\
Issue a command to the UNIX shell (space required after '!')") );
#endif /* ifndef NOPUSH */
case XXSHO:
return ( hmsg(
"\
Display current values of 'set' parameters; 'show version' will display\n\
program version information for each of the uCKermit modules.") );
case XXSPA:
return ( hmsg("Display disk usage in current device, directory") );
#ifndef NOSTATS
case XXSTA:
return ( hmsg("Display statistics about most recent file transfer") );
#endif /* ifndef NOSTATS */
case XXTAK:
return ( hmsg(
"\
Take Kermit commands from the named file. Kermit command files may\n\
themselves contain 'take' commands, up to a reasonable depth of nesting."));
case XXTRA:
return ( hmsg(
"\
Raw upload. Send a file, a line at a time (text) or a character at a time.\n\
For text, wait for turnaround character (default 10 = LF) after each line.\n\
Specify 0 for no waiting."));
default:
if (( x = cmcfm()) < 0)
{
return ( x );
}
printf("Not available yet - %s\n", cmdbuf);
break;
}
return ( 0 );
}
#endif /* ifndef NODOHLP */
/* H M S G -- Get confirmation, then print the given message */
#ifndef NODOHLP
int
hmsg(s)
char *s;
{
int x;
if (( x = cmcfm()) < 0)
{
return ( x );
}
puts(s);
return ( 0 );
}
int
hmsga(s)
char *s[];
{ /* Same function, but for arrays */
int x, i;
if (( x = cmcfm()) < 0)
{
return ( x );
}
for (i = 0; *s[i]; i++)
{
fputs(s[i], stdout);
}
putc('\n', stdout);
return ( 0 );
}
#endif /* ifndef NODOHLP */
/* B C A R C B -- Format helper for baud rates */
#ifndef NODOHLP
#ifndef NOICP
int
bcarcb(calsp)
long calsp;
{
#ifndef MAXBRATE
#ifdef B4000000
#define MAXBRATE 4000000
#endif /* ifdef B4000000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B3500000
#define MAXBRATE 3500000
#endif /* ifdef B3500000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B2500000
#define MAXBRATE 2500000
#endif /* ifdef B2500000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B2000000
#define MAXBRATE 2000000
#endif /* ifdef B2000000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B1152000
#define MAXBRATE 1152000
#endif /* ifdef B1152000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B1000000
#define MAXBRATE 1000000
#endif /* ifdef B1000000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B921600
#define MAXBRATE 921600
#endif /* ifdef B921600 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B576000
#define MAXBRATE 576000
#endif /* ifdef B576000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B500000
#define MAXBRATE 500000
#endif /* ifdef B500000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B460000
#define MAXBRATE 460000
#endif /* ifdef B460000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B230000
#define MAXBRATE 230000
#endif /* ifdef B230000 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B115200
#define MAXBRATE 115200
#endif /* ifdef B115200 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B76800
#define MAXBRATE 76800
#endif /* ifdef B76800 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B57600
#define MAXBRATE 57500
#endif /* ifdef B57600 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B38400
#define MAXBRATE 38400
#endif /* ifdef B38400 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B19200
#define MAXBRATE 19200
#endif /* ifdef B19200 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B9600
#define MAXBRATE 9600
#endif /* ifdef B9600 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B4800
#define MAXBRATE 4800
#endif /* ifdef B4800 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B2400
#define MAXBRATE 2400
#endif /* ifdef B2400 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B1800
#define MAXBRATE 1800
#endif /* ifdef B1800 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B1200
#define MAXBRATE 1200
#endif /* ifdef B1200 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B600
#define MAXBRATE 600
#endif /* ifdef B600 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B300
#define MAXBRATE 300
#endif /* ifdef B300 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B200
#define MAXBRATE 200
#endif /* ifdef B200 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B150
#define MAXBRATE 150
#endif /* ifdef B150 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B134
#define MAXBRATE 134
#endif /* ifdef B134 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B110
#define MAXBRATE 110
#endif /* ifdef B110 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B75
#define MAXBRATE 75
#endif /* ifdef B75 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B50
#define MAXBRATE 50
#endif /* ifdef B50 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef B0
#define MAXBRATE 0
#endif /* ifdef B0 */
#endif /* ifndef MAXBRATE */
#ifndef MAXBRATE
#ifdef __linux__ /* ifdef __linux__ */
#define MAXBRATE 38400
#else /* ifdef __linux__ */
#define MAXBRATE 19200
#endif /* ifdef __linux__ */
#endif /* ifndef MAXBRATE */
int brpln = 0;
if (calsp < 0)
{
brpln = 4;
}
if (calsp > 10)
{
brpln = 5;
}
if (calsp > 100)
{
brpln = 6;
}
if (calsp > 1000)
{
brpln = 7;
}
if (calsp > 10000)
{
brpln = 8;
}
if (calsp > 100000)
{
brpln = 9;
}
if (calsp > 1000000)
{
brpln = 10;
}
if (calsp > 10000000)
{
brpln = 11;
}
printf(" %ld", calsp);
if (calsp >= MAXBRATE)
{
printf(".\n");
}
else
{
printf(",");
}
bcharc = bcharc + brpln;
if (bcharc >= 66)
{
printf("\n");
bcharc = 0;
}
return ( 0 );
}
#endif /* ifndef NOICP */
#endif /* ifndef NODOHLP */
/* D O H S E T -- Give help for SET command */
#ifndef NODOHLP
int
dohset(xx)
int xx;
{
if (xx == -3)
{
return ( hmsga(hmhset) );
}
if (xx < 0)
{
return ( xx );
}
switch (xx)
{
#ifndef NOATTRIB
case XYATTR:
puts("Turn Attribute packet exchange off or on");
return ( 0 );
#endif /* ifndef NOATTRIB */
case XYIFD:
puts("Discard or Keep incompletely received files, default is discard");
return ( 0 );
case XYCHKT:
return ( hmsga(hmxychkt) );
case XYDELA:
puts(
"\
Number of seconds to wait before sending first packet after 'send' command.");
return ( 0 );
case XYTERM:
puts(
"\
'set terminal bytesize 7 or 8' to use 7- or 8-bit terminal characters.");
return ( 0 );
case XYDUPL:
puts(
"\
During 'connect': 'full' means remote host echoes, 'half' means this program");
puts("does its own echoing.");
return ( 0 );
case XYESC:
printf(
"%s",
"\
Decimal ASCII value for escape character during 'connect', normally 28\n\
(Control-\\)\n");
return ( 0 );
case XYFILE:
return ( hmsga(hmxyf) );
case XYFLOW:
puts(
"\
Type of flow control to be used. Choices are 'xon/xoff' and 'none'.");
puts("normally xon/xoff.");
return ( 0 );
case XYHAND:
puts(
"\
Decimal ASCII value for character to use for half duplex line turnaround");
puts("handshake. Normally, handshaking is not done.");
return ( 0 );
case XYLINE:
printf(
"\
Device name of communication line to use. Normally %s.\n",
dftty);
if (!dfloc)
{
printf(
"\
If you set the line to other than %s, then Kermit\n",
dftty);
printf(
"\
will be in 'local' mode; 'set line' will reset Kermit to remote mode.\n");
#ifndef NOCKUDIA
puts(
"\
If the line has a modem, and if the modem-dialer is set to direct, this");
puts(
"\
command causes waiting for a carrier detect (e.g. on a hayes type modem).");
puts("\
This can be used to wait for incoming calls.");
puts(
"\
To use the modem to dial out, first set modem-dialer (e.g., to hayes), then");
puts("set line, next issue the dial command, and finally connect.");
#endif /* ifndef NOCKUDIA */
}
return ( 0 );
#ifndef NOCKUDIA
case XYMODM:
puts(
"\
Type of modem for dialing remote connections. Needed to indicate modem can");
puts(
"\
be commanded to dial without 'carrier detect' from modem. Many recently");
puts(
"\
manufactured modems use 'hayes' protocol. Type 'set modem ?' to see what");
puts("\
types of modems are supported by this program.");
return ( 0 );
#endif /* ifndef NOCKUDIA */
case XYPARI:
puts("Parity to use during terminal connection and file transfer:");
puts("even, odd, mark, space, or none. Normally none.");
return ( 0 );
case XYPROM:
puts("Prompt string for this program, normally 'uCKermit>'.");
return ( 0 );
case XYRETR:
puts(
"How many times to retransmit a packet before giving up");
return ( 0 );
case XYSPEE:
puts(
"Set speed of line specified by last 'set line' command to:");
#ifdef B0
bcarcb(0);
#endif /* ifdef B0 */
#ifdef B50
bcarcb(50);
#endif /* ifdef B50 */
#ifdef B75
bcarcb(75);
#endif /* ifdef B75 */
#ifdef B110
bcarcb(110);
#endif /* ifdef B110 */
#ifdef B134
bcarcb(134);
#endif /* ifdef B134 */
#ifdef B150
bcarcb(150);
#endif /* ifdef B150 */
#ifdef B200
bcarcb(200);
#endif /* ifdef B200 */
#ifdef B300
bcarcb(300);
#endif /* ifdef B300 */
#ifdef B600
bcarcb(600);
#endif /* ifdef B600 */
#ifdef B1200
bcarcb(1200);
#endif /* ifdef B1200 */
#ifdef B1800
bcarcb(1800);
#endif /* ifdef B1800 */
#ifdef B2400
bcarcb(2400);
#endif /* ifdef B2400 */
#ifdef B4800
bcarcb(4800);
#endif /* ifdef B4800 */
#ifdef B9600
bcarcb(9600);