forked from KermitProject/ckermit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ckuker.nr
1831 lines (1829 loc) · 61.9 KB
/
ckuker.nr
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
.\" @(#) kermit.1 9.0.302 2011/08/20 Columbia University
.TH KERMIT 1 "JULY 2011" "User Manuals"
.na
.SH NAME
kermit \-
.B C\(hyKermit 9.0:
transport\(hy and platform\(hyindependent
interactive and scriptable communications software.
.IP
This document is intended to give the beginner sufficient information to
make basic (if not advanced) use of C\(hyKermit 9.0. Although it might be
rather long for a Unix manual page, it's still far shorter than the
C\(hyKermit manual, which should be consulted for advanced topics such as
customization, character\(hysets, scripting, etc. We also attempt to provide
a clear structural overview of C\(hyKermit's many capabilities, functional
areas, states, and modes and their interrelation, that should be helpful to
beginners and veterans alike, as well as to those upgrading to version 9.0
from earlier releases.
.PP
This document is also available as a Web page at:
.IP
http://www.columbia.edu/kermit/ckututor.html
.SH DESCRIPTION
C\(hyKermit is an all\(hypurpose communications software package from the Kermit
Project at Columbia University that:
.PP
.nf
\(bu Is portable to many platforms, Unix and non\(hyUnix alike.
.br
\(bu Can make both serial and network connections.
.br
\(bu Can conduct interactive terminal sessions over its connection.
.br
\(bu Can transfer text or binary files over the same connection.
.br
\(bu Can convert character sets in the terminal session.
.br
\(bu Can convert character sets during text\(hyfile file transfer.
.br
\(bu Is customizable in every aspect of its operation.
.fi
.PP
C\(hyKermit is a modem program, a Telnet client, an Rlogin client, an FTP
client, an HTTP client, and on selected platforms, also an X.25 client. It
can make its own secure Internet connections using IETF\(hyapproved security
methods including Kerberos IV, Kerberos V, SSL/TLS, and SRP and it can also
make SSH connections through your external SSH client application. It can
be the far\(hyend file\(hytransfer or client/server partner of your desktop
Kermit client. It can also accept incoming dialed and network connections.
It can even be installed as an Internet service on its own standard TCP
socket, 1649 [RFC2839, RFC2840].
.PP
And perhaps most important, everything you can do "by hand" (interactively)
with C\(hyKermit, can be "scripted" (automated) using its built\(hyin
cross\(hyplatform transport\(hyindependent script programming language, which
happens to be identical to its interactive command language.
.PP
This manual page offers an overview of C\(hyKermit 9.0 for Unix ("Unix" is an
operating system family that includes AIX, DG/UX, FreeBSD, HP\(hyUX, IRIX,
Linux, Mac OS X, NetBSD, OpenBSD, Open Server, Open Unix, QNX, Solaris,
SunOS, System V R3, System V R4, Tru64 Unix, Unixware, Xenix, and many
others). For thorough coverage, please consult the published C\(hyKermit
manual and supplements (see DOCUMENTATION below). For further information
about C\(hyKermit, Kermit software for other platforms, and Kermit manuals,
visit the Kermit Project website:
.PP
http://www.columbia.edu/kermit/
.PP
This is a longer\(hythan\(hyaverage manual page, and yet it barely scratches the
surface. Don't be daunted. C\(hyKermit is a large and complex package,
evolving over decades of practice and experience, but that doesn't mean
it's hard to learn or use. Its most commonly used functions are explained
here with pointers to additional information elsewhere.
.SH SYNOPSIS
.B kermit [
.I filename
.B ] [
.I options
.B ] [ {=,\-\-,+}
.I text
.B ] ]
.PP
or:
.PP
.B kermit
.I URL
.PP
If the first command\(hyline argument is the name of a file, interactive\(hymode
commands are executed from the file. The '=' (or "\-\-") argument tells
Kermit not to parse the remainder of the command line, but to make the
words following '=' available as \e%1, \e%2, ... \e%9. The "+" argument is
like "=" but for use in "kerbang scripts" (explained below). A second
command\(hyline format allows the one and only argument to be a Telnet, FTP,
HTTP, or IKSD URL.
.PP
Order of execution:
.TP
1.
The command file (if any).
.TP
.nf
2.
The initialization file, if any, unless suppressed with \-Y.
.fi
.TP
3.
The customization file (if it is executed by the initialization file).
.TP
4.
The command\(hyline URL (if any, and if so, execution stops here).
.TP
5.
Command\(hyline options (if any).
.TP
6.
Interactive commands.
.PP
Some command\(hyline options can cause actions (such as \-s to send a file);
others just set parameters. If any action options are included on the
command line, Kermit exits when finished unless also given the \-S ("stay")
option. If no action options are given, no initialization or command files
contained an EXIT or QUIT command, and no fatal errors occurred, Kermit
issues its prompt and waits for you to type commands.
.IP
Bear in mind that C\(hyKermit can be built with selected features
disabled, and also that certain features are not available on all
platforms. For example, C\(hyKermit can't be built with TCP/IP
support on a platform that does not have TCP/IP header files and
libraries (and even if Kermit does include TCP/IP support, it
can't be used to make TCP/IP connections on a computer that does
not have a TCP/IP stack installed). If your version of
C\(hyKermit lacks a feature mentioned here, use its SHOW FEATURES command to
see what might have been excluded.
.PP
C\(hyKermit has three kinds of commands: regular single\(hyletter command\(hyline
options, extended\(hyformat command\(hyline options, and interactive commands.
.PP
Like most Unix commands, C\(hyKermit can be be given options on the command
line. But C\(hyKermit also can be used interactively by giving it commands
composed of words, which are more intuitive than cryptic command\(hyline
options, and more flexible too. In other words, you don't have to use
C\(hyKermit's command\(hyline options, but they are available if you want to. (By
the same token, you don't have to use its interactive commands either \(hy\(hy
you can use either or both in any combination.)
.PP
C\(hyKermit is generally installed in the PATH as "kermit", and therefore is
invoked by typing the word "kermit" (lowercase) at the shell prompt, and
then pressing the Return or Enter key. If you wish to include command\(hyline
options, put them after the word "kermit" but before pressing Return or
Enter, separated by spaces, for example:
.PP
$ kermit \-s ckermit.tar.gz
.PP
('$' is the shell prompt; "kermit \-s ckermit.tar.gz" is what you type,
followed by Return or Enter.)
.SH OPTIONS
Here is a list of C\(hyKermit's single\(hyletter command\(hyline options, which
start with a single dash (\-), in ASCII ("alphabetical") order. Alphabetic
case is significant (\-A is not the same as \-a). Action options are
tagged "ACTION".
.TP
\-0
(digit zero) 100% transparent Connect state for
"in\(hythe\(hymiddle" operation: 8 bits, no parity, no
escape character, everything passes through.
.TP
\-8
(digit eight) Connection is 8\(hybit clean (this is the
default in C\(hyKermit 8.0 and later). Equivalent to the EIGHTBIT
command, which in turn is a shortcut for SET TERMINAL
BYTESIZE 8, SET COMMAND BYTESIZE 8, SET PARITY NONE.
.TP
\-9 arg
(digit nine) Make a connection to an FTP server.
Equivalent to the FTP OPEN command.
Argument: IP\(hyaddress\(hyor\(hyhostname[:optional\(hyTCP\(hyport].
NOTE: C\(hyKermit also has a separate FTP command\(hyline
personality, with regular FTP\(hylike command\(hyline
syntax. More about this below.
.TP
\-A
Kermit is to be started as an Internet service (IKSD)
(only from inetd.conf).
.TP
\-B
Kermit is running in Batch or Background (no
controlling terminal). To be used in case Kermit
doesn't automatically sense its background status.
Equivalent to the SET BACKGROUND ON command.
.TP
\-C arg
Interactive\(hymode Commands to be executed.
Argument: Commands separated by commas, list in
doublequotes.
.TP
\-D arg
Delay before starting to send in Remote mode.
Equivalent to the SET DELAY command.
Argument: Number of seconds.
.TP
\-E
Exit automatically when connection closes. Equivalent
to SET EXIT ON\-DISCONNECT ON.
.TP
\-F arg
Use an open TCP connection.
Argument: Numeric file descriptor of open TCP
connection.
Also see: \-j, \-J.
.TP
\-G arg
(ACTION) Get file(s) from server, send contents to standard
output, which normally would be piped to another
process.
Argument: Remote file specification, in quotes if it
contains metacharacters.
Also see: \-g, \-k.
.TP
\-H
Suppress program startup Herald and greeting.
.TP
\-I
Tell Kermit it has a reliable connection, to force streaming to be used where
it normally would not be. Equivalent to the SET RELIABLE ON command.
.TP
\-J arg
(ACTION) "Be like Telnet." Like \-j but implies \-E. Argument: IP
hostname/address optionally followed by service. NOTE: C\(hyKermit also has a
separate Telnet command\(hyline personality, with regular Telnet\(hylike
command\(hyline syntax. More about this below.
.TP
\-L
Recursive directory descent for files in \-s option.
.TP
\-M arg
My user name (for use with Telnet, Rlogin, FTP, etc).
Equivalent to the SET LOGIN USER command.
Argument: Username string.
.TP
\-O
(ACTION) (Uppercase letter O) Be a server for One command only.
Also see: \-x.
.TP
\-P
Don't convert file (Path) names of transferred files.
Equivalent to SET FILE NAMES LITERAL.
.TP
\-Q
Quick Kermit protocol settings. Equivalent to the FAST
command. This is the default in C\(hyKermit 7.0 and later.
.TP
\-R
Remote\(hyonly (this just makes IF REMOTE true).
.TP
\-S
Stay (enter command parser after action options).
.TP
\-T
Force Text mode for file transfer; implies \-V.
Equivalent to SET TRANSFER MODE MANUAL, SET FILE TYPE TEXT.
.TP
\-V
Disable automatic per\(hyfile text/binary switching.
Equivalent to SET TRANSFER MODE MANUAL.
.TP
\-Y
Skip (don't execute) the initialization file.
.TP
\-a arg
As\(hyname for file(s) in \-s, \-r, or \-g.
Argument: As\(hyname string (alternative filename). When
receiving files, this can be a directory name.
.TP
\-b arg
Speed for serial device. Equivalent to SET SPEED.
Argument: Numeric Bits per second for serial
connections.
.TP
\-c
(ACTION) Enter Connect state before transferring files.
.TP
\-d
Create a debug.log file with detailed debugging
information (a second \-d adds timestamps). Equivalent
to LOG DEBUG but takes effect sooner.
.TP
\-e arg
Maximum length for incoming Kermit file\(hytransfer
packets. Equivalent to SET RECEIVE PACKET\-LENGTH.
Argument: Length in bytes.
.TP
\-f
(ACTION) Send a FINISH command to a Kermit server.
.TP
\-g arg
Get file(s) from a Kermit server.
Argument: File specification on other computer, in
quotes if it contains metacharacters. Equivalent to
GET. Also see: \-a, \-G, \-r.
.TP
\-h
(ACTION) Print Help text for single\(hyletter command\(hyline options
(pipe thru 'more' to prevent scrolling).
.TP
\-i
Force binary (Image) mode for file transfer; implies
\-V. Equivalent to SET TRANSFER MODE MANUAL, SET FILE
TYPE BINARY.
.TP
\-j arg
Make a TCP/IP connection.
Argument: IP host name/address and optional service
name or number. Equivalent to the TELNET command.
Also see: \-J, \-F.
.TP
\-k
(ACTION) Receive file(s) to standard output, which normally
would be piped to another process.
Also see: \-r, \-G.
.TP
\-l arg
(Lowercase letter L) Make a connection on the given
serial communications device. Equivalent to the SET
LINE (SET PORT) command.
Argument: Serial device name, e.g. /dev/ttyS0.
.TP
\-m arg
Modem type for use with the \-l device. Equivalent to
the SET MODEM TYPE command.
Argument: Modem name as in SET MODEM TYPE command,
e.g. "usrobotics".
.TP
\-n
(ACTION) Enter Connect state after transferring files (historical).
.TP
\-p arg
Parity. Equivalent to the SET PARITY command.
Argument: One of the following: e(ven), o(dd), m(ark),
n(one), s(pace).
.TP
\-q
Quiet (suppress most messages). Equivalent to SET QUIET ON.
.TP
\-r
(ACTION) Receive file(s). Equivalent to the RECEIVE command.
Argument: (none, but see \-a)
.TP
\-s arg
Send file(s).
Argument: One or more local file specifications.
Equivalent to the SEND command.
Also see: \-a.
.TP
\-t
(Historical) Xon (Ctrl\-Q) Turnaround character for
half\(hyduplex connections (used on serial linemode
connections to old mainframes). Equivalent to SET
DUPLEX HALF, SET HANDSHAKE XON.
.TP
\-v arg
Window size for Kermit protocol (ignored when
streaming). Equivalanet to SET WINDOW\-SIZE.
Argument: Number, 1 to 32.
.TP
\-w
Incoming files Write over existing files. Equivalent
to SET FILE COLLISION OVERWRITE.
.TP
\-x
(ACTION) Enter server mode. Equivalent to the SERVER command.
Also see: \-O.
.TP
\-y arg
Alternative initialization file.
Argument: Filename.
.TP
\-z
Force foreground behavior. To be used in case Kermit
doesn't automatically sense its foreground status.
Equivalent to the SET BACKGROUND OFF command.
.PP
Extended command\(hyline options (necessary because single\(hyletter ones are
about used up) start with two dashes (\-\-), with words rather than single
letters as option names. If an extended option takes an argument, it is
separated from the option word by a colon (:). Extended options include:
.TP
\-\-bannerfile:filename
File to display upon startup or IKSD login.
.TP
\-\-cdfile:filename
File to be sent for display to the client when
server changes directory (filename is relative to
the changed\(hyto directory).
.TP
\-\-cdmessage:{on,off}
Enable/disable the server CD message feature.
.TP
\-\-help
Prints usage message for extended options.
.TP
\-\-helpfile:filename
Designates a file containing custom text to
replace the top\(hylevel HELP command.
.TP
\-\-nointerrupts
Disables keyboard interrupts.
.TP
\-\-noperms
Disables the Kermit protocol file Permissions
attribute, to prevent transmission of file
permissions (protection) from sender to receiver.
.TP
\-\-version
(ACTION) C\(hyKermit prints its version number.
.PP
Plus several other IKSD\(hyOnly options described at:
.PP
http://www.columbia.edu/kermit/iksd.html
.PP
See the file\(hytransfer section for examples of command\(hyline invocation.
.SH COMMAND LANGUAGE
C\(hyKermit's interactive command language is the subject of a 622\(hypage book
and another several hundred pages of updates, far too much for a manual
page. But it's not hard to get started. At the shell prompt, just type
"kermit" to get C\(hyKermit's interactive command prompt:
.PP
.nf
$ kermit
(/current/directory) C\-Kermit>
.fi
.PP
Begin by typing "help" (and then press the Return or Enter key) for a
top\(hylevel overview, read it, and go from there. Your second command should
probably be "intro" (introduction). Note the prompt shows your current
directory (unless you tell Kermit to prompt you with something else).
.PP
Interactive commands are composed mainly of regular English words, usually
in the form of imperative sentences, such as:
.PP
send oofa.txt
.PP
which tells Kermit to send (transfer) the file whose name is oofa.txt, or:
.PP
set transfer mode automatic
.PP
which sets Kermit's "transfer mode" to "automatic" (whatever that means).
.PP
While typing commands, you can abbreviate, ask for help (by pressing the
"?" key anywhere in a command), complete keywords or filenames (with the
Tab or Esc key), and edit your typing with Backspace or Delete, Ctrl\-W,
Ctrl\-U, etc. You can also recall previous commands, save your command
history, and who knows what else. Give the INTRO command for details.
.PP
C\(hyKermit has hundreds of commands, and they can be issued in infinite
variety and combinations, including commands for:
.nf
.PP
\(bu Making connections (SET LINE, DIAL, TELNET, SSH, FTP, ...)
.br
\(bu Breaking connections (HANGUP, CLOSE)
.br
\(bu Transferring files (SEND, GET, RECEIVE, MOVE, RESEND, ...)
.br
\(bu Establishing preferences (SET)
.br
\(bu Displaying preferences (SHOW)
.br
\(bu Managing local files (CD, DELETE, MKDIR, DIR, RENAME, TYPE, ...)
.br
\(bu Managing remote files (RCD, RDEL, RMKDIR, RDIR, ...)
.br
\(bu Using local files (FOPEN, FCLOSE, FREAD, FWRITE)
.br
\(bu Programming (TAKE, DEFINE, IF, FOR, WHILE, SWITCH, DECLARE, ...)
.br
\(bu Interacting with the user (ECHO, ASK, ...)
.br
\(bu Interacting with a remote computer (INPUT, OUTPUT, ...)
.br
\(bu Interacting with local programs (RUN, EXEC, PTY, ...)
.br
\(bu Logging things (LOG SESSION, LOG PACKETS, LOG DEBUG, ...)
.PP
.fi
And of course QUIT or EXIT to get out and HELP to get help, and for
programmers: loops, decision making, variables, arrays, associative arrays,
integer and floating point arithmetic, macros, built\(hyin and user\(hydefined
functions, string manipulation, pattern matching, block structure, scoping,
recursion, and all the rest. To get a list of all C\(hyKermit's commands, type
a question mark (?) at the prompt. To get a description of any command,
type HELP followed by the name of the command, for example:
.PP
help send
.PP
The command interruption character is Ctrl\-C (hold down the Ctrl key and
press the C key).
.PP
The command language "escape character", used to introduce variable names,
function invocations, and so on, is backslash (\). If you need to include a
literal backslash in a command, type two of them, e.g.:
.PP
get c:\ek95\ek95custom.ini
.SS Command Files, Macros, and Scripts
A file containing Kermit commands is called a Kermit command file or Kermit
script. It can be executed with Kermit's TAKE command:
.PP
(/current/dir) C\-Kermit> take commandfile
.PP
(where "commandfile" is the name of the command file). Please don't pipe a
command file into Kermit's standard input (which might or might not work);
if you have Kermit commands in a file, tell Kermit to TAKE the file.
.PP
In Unix only, a Kermit command file can also be executed directly by
including a "kerbang" line as the first line of the file:
.PP
#!/usr/local/bin/kermit +
.PP
That is, a top line that starts with "#!", followed immediately by the full
path of the Kermit executable, and then, if the Kermit script is to be
given arguments on the command line, a space and a plus sign. The script
file must also have execute permission:
.PP
chmod +x commandfile
.PP
Except for the " +" part, this is exactly the same as you would do for a
shell script, a Perl script, etc. Here's a simple but useless example
script that regurgitates its arguments (up to three of them):
.PP
#!/usr/local/bin/kermit +
if defined \e%1 echo "Argument 1: \e%1"
if defined \e%2 echo "Argument 2: \e%2"
if defined \e%3 echo "Argument 3: \e%3"
if defined \e%4 echo "etc..."
exit
.PP
If this file is stored in your current directory as "commandfile", then:
.PP
./commandfile one two three four five
.PP
prints:
.PP
Argument 1: one
Argument 2: two
Argument 3: three
etc...
.PP
This illustrates the basic structure of a standalone Kermit script: the
"kerbang line", then some commands. It should end with "exit" unless you
want the Kermit prompt to appear when it is finished. \e%1 is the first
argument, \e%2 the second, and so on.
.PP
You can also create your own commands by defining named macros composed of
other Kermit commands (or macros). For example:
.PP
.nf
define mydelete {
local trash
assign trash \ev(home)trashcan/
if not defined \e%1 end 1 "Delete what?"
if wild \e%1 {
end 1 "Deleting multiple files is too scary"
}
if not exist \e%1 end 1 "I can't find \e%1"
if not directory \em(trash) {
mkdir \em(trash)
if fail end 1 "No trash can"
}
rename /list \e%1 \em(trash)
}
define myundelete {
local trash
assign trash \ev(home)trashcan/
if not defined \e%1 end 1 "Undelete what?"
if wild \e%1 {
end 1 "Undeleting multiple files is too hard"
}
if not directory \em(trash) end 1 "No trash can"
if not exist \em(trash)\e%1 {
end 1 "I can't find \e%1 in trash can"
}
rename /list \em(trash)\e%1 .
}
.PP
.fi
These sample macros are not exactly production quality (they don't handle
filenames that include path segments, they don't handle multiple files,
etc), but you get the idea: you can pass arguments to macros, and they can
check them and make other kinds of decisions. If you put the above lines
into your initialization or customization file (explained below), you'll
have MYDELETE and MYUNDELETE commands available every time you start
Kermit, at least as long as you don't suppress execution of the
initialization file. (Exercise for the reader: Make these macros generally
useful: remove limitations, add trashcan display, browsing, emptying, etc.)
.PP
Kerbang scripts execute without the initialization file. This to keep them
portable and also to make them start faster. If you want to write Kerbang
scripts that depend on the initialization file, include the command
.PP
take \ev(home).kermrc
.PP
at the desired spot in the script. By the way, \ev(xxx) is a built\(hyin
variable (xxx is the variable name, "home" in this case). To see what
built\(hyin variables are available, type "show variables" at the C\(hyKermit
prompt. To see what else you can show, type "show ?". \em(xxx) is a user
defined variable (strictly speaking, it is a macro used as a variable).
.SS Command List
C\(hyKermit has more than 200 top\(hylevel commands, and some of these, such as
SET, branch off into hundreds of subcommands of their own, so it's not
practical to describe them all here. Instead, here's a concise list of the
most commonly used top\(hylevel commands, grouped by category. To learn about
each command, type "help" followed by the command name, e.g. "help set".
Terms such as Command state and Connect state are explained in subsequent
sections.
.PP
Optional fields are shown in [ brackets ]. "filename" means the
name of a single file. filespec means a file specification that is allowed
to contain wildcard characters like '*' to match groups of files. options
are (optional) switches like /PAGE, /NOPAGE, /QUIET, etc, listed in the
HELP text for each command. Example:
.PP
.nf
send /recursive /larger:10000 /after:\-1week /except:*.txt *
.fi
.PP
which can be read as "send all the files in this directory and all the ones
underneath it that are larger than 10000 bytes, no more than one week old,
and whose names don't end with ".txt".
.SS
Basic Commands
.RS
.TP
HELP
Requests top\(hylevel help.
.TP
HELP command
Requests help about the given command.
.TP
INTRODUCTION
Requests a brief introduction to C\(hyKermit.
.TP
LICENSE
Displays the C\(hyKermit software copyright and license.
.TP
VERSION
Displays C\(hyKermit's version number.
.TP
EXIT [ number ]
Exits from Kermit with the given
status code. Synonyms: QUIT, E, Q.
.TP
TAKE filename [ parameters... ]
Executes commands from the given
.TP
LOG item [ filename ]
Keeps a log of the given item in the given file.
.TP
[ DO ] macro [ parameters... ]
Executes commands from the given macro.
.TP
SET parameter value
Sets the given parameter to the given value.
.TP
SHOW category
Shows settings in a given category.
.TP
STATUS
Tells whether previous command succeeded or failed.
.TP
DATE [ date\(hyand/or\(hytime ]
Shows current date\(hytime or interprets given date\(hytime.
.TP
RUN [ extern\(hycommand [ parameters... ]
Runs the given external command. Synonym: !.
.TP
EXEC [ extern\(hycommand [ params... ]
Kermit overlays itself with the given command.
.TP
SUSPEND
Stops Kermit and puts it in the background. Synonym: Z.
.RE
.SS
Local File Management
.RS
.TP
TYPE [ options ] filename
Displays the contents of the given file.
.TP
MORE [ options ] filename
Equivalent to TYPE /PAGE (pause after each screenful).
.TP
CAT [ options ] filename
Equivalent to TYPE /NOPAGE.
.TP
HEAD [ options ] filename
Displays the first few lines of a given file.
.TP
TAIL [ options ] filename
Displays the last few lines of a given file.
.TP
GREP [ options ] pattern filespec
Displays lines from files that match
the pattern. Synonym: FIND.
.TP
DIRECTORY [ options ] [filespec ]
Lists files (built\(hyin, many options).
.TP
LS [ options ] [ filespec ]
Lists files (runs external "ls" command).
.TP
DELETE [ options ] [ filespec ]
Deletes files. Synonym: RM.
.TP
PURGE [ options ] [ filespec ]
Removes backup (*.~n~) files.
.TP
COPY [ options ] [ filespecs... ]
Copies files. Synonym: CP.
.TP
RENAME [ options ] [ filespecs... ]
Renames files. Synonym: MV.
.TP
CHMOD [ options ] [ filespecs... ]
Changes permissions of files.
.TP
TRANSLATE filename charsets [ filename ]
Converts file's character set. Synonym: XLATE.
.TP
CD
Changes your working directory to your home directory.
.TP
CD directory
Changes your working directory to the one given.
.TP
CDUP
Changes your working directory one level up.
.TP
PWD
Displays your working directory.
.TP
BACK
Returns to your previous working directory.
.TP
MKDIR [ directory ]
Creates a directory.
.TP
RMDIR [ directory ]
Removes a directory.
.RE
.SS
Making Connections
.RS
.TP
SET LINE [ options ] devicename
Opens the named serial port. Synonym: SET PORT.
.TP
OPEN LINE [ options ] devicename
Same as SET LINE. Synonym: OPEN PORT.
.TP
SET MODEM TYPE [ name ]
Tells Kermit what kind of modem is on the port.
.TP
DIAL [ number ]
Tells Kermit to dial the given phone number with the modem.
.TP
REDIAL
Redials the most recently dialed phone number.
.TP
ANSWER
Waits for and answers an incoming call on the modem.
.TP
AUTHENTICATE [ parameters... ]
Performs secure authentication on a TCP/IP connection.
.TP
SET NETWORK TYPE { TCP/IP, X.25, ... }
Selects network type for subsequent SET HOST commands.
.TP
SET HOST [ options ] host [ port ]
Opens a network connection to the given host and port.
.TP
SET HOST * port
Waits for an incoming TCP/IP connection on the given port.
.TP
TELNET [ options ] host
Opens a Telnet connection to the host and enters Connect state.
.TP
RLOGIN [ options ] host
Opens an Rlogin connection to the host and enters Connect state.
.TP
IKSD [ options ] host
Opens a connection to an Internet Kermit Service.
.TP
SSH [ options ] host
Opens an SSH connection to the host and enters Connect state.
.TP
FTP OPEN host [ options ]
Opens an FTP connection to the host.
.TP
HTTP [ options ] OPEN host
Opens an HTTP connection to the host.
.TP
PTY external\(hycommand
Runs the command on a pseudoterminal as if it were a connection.
.TP
PIPE external\(hycommand
Runs the command through a pipe as if it were a connection.
.RE
.SS
Using Connections
.RS
.TP
CONNECT [ options ]
Enters Connect (terminal) state. Synonym: C.
.TP
REDIRECT command
Redirects the given external command over the connection.
.TP
TELOPT command
Sends a Telnet protocol command (Telnet connections only).
.TP
Ctrl\-\eC
"Escapes back" from Connect state to Command state.
.TP
Ctrl\-\eB
(In Connect state) Sends a BREAK signal (serial or Telnet).
.TP
Ctrl\-\e!
(In Connect state) Enters inferior shell; "exit" to return.
.TP
Ctrl\-\e?
(In Connect state) Shows a menu of other escape\(hylevel options.
.TP
Ctrl\-\eCtrl\-\e
(In Connect state) Type two
Ctrl\-Backslashes to send one of them.
.TP
SET ESCAPE [ character ]
Changes Kermit's Connect\(hystate escape character.
.RE
.SS
Closing Connections
.RS
.TP
HANGUP
Hangs up the currently open
serial\(hyport or network connection.
.TP
CLOSE
Closes the currently open
serial\(hyport or network connection.
.TP
SET LINE (with no devicename)
Closes the currently open
serial\(hyport or network connection.
.TP
SET HOST (with no hostname)
Closes the currently open serial\(hyport or network connection.
.TP
FTP CLOSE
Closes the currently open FTP connection.
.TP
HTTP CLOSE
Closes the currently open HTTP connection.
.TP
EXIT
Also closes all connections. Synonym: QUIT.
.TP
SET EXIT WARNING OFF
Suppresses warning about open connections on exit or close.
.RE
.SS
File Transfer
.RS
.TP
SEND [ options ] filename [ as\(hyname ]
Sends the given file. Synonym: S.
.TP
SEND [ options ] filespec
Sends all files that match.
.TP
RESEND [ options ] filespec
Resumes an interrupted SEND from the point of failure.
.TP
RECEIVE [ options ] [ as\(hyname ]
Waits passively for files to arrive. Synonym: R.
.TP
LOG TRANSACTIONS [ filename ]
Keeps a record of file transfers.
.TP
FAST
Use fast file\(hytransfer settings (default).
.TP
CAUTIOUS
Use cautious and less fast file\(hytransfer settings.
.TP
ROBUST
Use ultra\(hyconservative and slow file\(hytransfer settings.
.TP
STATISTICS [ options ]
Gives statistics about the most recent file transfer.
.TP
WHERE
After transfer: "Where did my files go?".
.TP
TRANSMIT [ options ] [ofilename ]
Sends file without protocol. Synonym: XMIT.
.TP
LOG SESSION [ filename ]
Captures remote text or files without protocol.
.TP
SET PROTOCOL [ name... ]
Tells Kermit to use an external file\(hytransfer protocol.
.TP
FTP { PUT, MPUT, GET, MGET, ... }
FTP client commands.
.TP
HTTP { PUT, GET, HEAD, POST, ... }
HTTP client commands.
.RE
.SS
Kermit Server
.RS
.TP
ENABLE, DISABLE
Controls which server features can be used by clients.
.TP
SET SERVER
Sets parameters prior to entering Server state.
.TP
SERVER
Enters Server state.
.RE
.SS
Client of Kermit or FTP Server
.RS
.TP
[ REMOTE ] LOGIN [ user password ]
Logs in to a Kermit server or IKSD that requires it.
.TP
[ REMOTE ] LOGOUT
Logs out from a Kermit server or IKSD.
.TP
SEND [ options ] filename [ as\(hyname ]
Sends the given file to the server. Synonyms: S, PUT.
.TP
SEND [ options ] filespec
Sends all files that match.
.TP
RESEND [ options ] filespec
Resumes an interrupted SEND from the point of failure.
.TP
GET [ options ] remote\(hyfilespec
Asks the server to send the given files. Synonym: G.
.TP
REGET [ options ] remote\(hyfilespec
Resumes an interrupted GET from the point of failure.
.TP
REMOTE CD [ directory ]
Asks server to change its working
directory. Synonym: RCD.
.TP
REMOTE PWD [ directory ]
Asks server to display its working directory. Synonym: RPWD.
.TP
REMOTE DIRECTORY [ filespec... ]
Asks server to send a directory listing. Synonym: RDIR.
.TP
REMOTE DELETE [ filespec... ]
Asks server to delete files. Synonym: RDEL.
.TP
REMOTE [ command... ]
(Many other commands: "remote ?" for a list).
.TP
MAIL [ options ] filespec
Sends file(s) to be delivered as e\(hymail (Kermit only).
.TP
FINISH
Asks the server to exit server state (Kermit only).
.TP
BYE
Asks the server to log out and close the connection.
.RE
.SS
Script Programming
.PP
.RS
DEFINE, DECLARE, UNDEFINE, UNDECLARE, ASSIGN, EVALUATE, SEXPRESSION,
ARRAY, SORT, INPUT, OUTPUT, IF, FOR, WHILE, SWITCH, GOTO, ECHO, ASK,
GETC, GETOK, ASSERT, WAIT, SLEEP, FOPEN, FREAD, FWRITE, FCLOSE, STOP,
END, RETURN, LEARN, SHIFT, TRACE, VOID, INCREMENT, DECREMENT, ... For
these and many more you'll need to consult the manual and supplements,
and/or visit the Kermit Script Library, which also includes a brief
tutorial. Hint: HELP LEARN to find out how to get Kermit to write
simple scripts for you.
.RE
.PP
Many of Kermit's commands have synonyms, variants, relatives, and so on.
For example, MSEND is a version of SEND that accepts a list of file
specifications to be sent, rather than just one file specification, and