chiark / gitweb /
dot/mykermrc.in: Add a macro for talking to an Arduino-ish USB monitor port.
[profile] / dot / mykermrc.in
CommitLineData
8508a859
MW
1;;; ---kermit---
2;;;
3;;; Configuration and definitions for Kermit.
4
5assign _profile @profile@/
6assign _dot \v(home).kermit/
7
8;; General stuff.
cd45f1fc 9set command recall-buffer-size 100
8508a859
MW
10set escape-character ^]
11set flow-control /direct-serial rts/cts
12set flow-control /modem rts/cts
13set locus local
14set options directory /brief
15set terminal trigger KERMIT READY TO SERVE...
16set transfer pipes on
17
cd45f1fc
MW
18;; Set the prompt string.
19def _host \fword(\v(host),1,.)
20def _pwd \freplace(\freplace(//\v(dir)/,//\v(home),~/),//,)
21local _hack
22asg _hack set prompt {C-Kermit \v(user)@\m(_host) \m(_pwd)>}
23do _hack
24
8508a859
MW
25;; Dialling parameters.
26set dial country-code 44
27set dial area-code 1223
28set dial display on
29set dial toll-free-area-code 800
30set dial ld-prefix 0
31set dial intl-prefix 00
32
33;; Directories.
2351081f
MW
34def _set_dir {
35 local what list awful
36 assign what \%1
37 undef list
38 shift
39
40 for \%i 1 \v(argc)-1 1 {
41 if exist \%1 {
42 if def list assign list \m(list) \%1
43 else assign list \%1
8508a859 44 }
2351081f 45 shift
8508a859 46 }
2351081f
MW
47 assign awful { set \m(what) directory \m(list) }
48 do awful
8508a859 49}
2351081f 50_set_dir network -
8508a859
MW
51 \m(_profile)kermit/net.shared -
52 \m(_dot)net.local
2351081f 53_set_dir dial -
8508a859
MW
54 \m(_profile)kermit/dial.shared -
55 \m(_dot)dial.local
8508a859
MW
56
57;; If my terminal is UTF8 then try to use that consistently. This may not
58;; work, but in my world as it is it's quite likely to.
cd45f1fc 59set file character-set utf8
8508a859
MW
60local _lc_ctype
61if not def _lc_ctype if def \$(LC_ALL) assign _lc_ctype \$(LC_ALL)
62if not def _lc_ctype if def \$(LC_CTYPE) assign _lc_ctype \$(LC_CTYPE)
63if not def _lc_ctype if def \$(LANG) assign _lc_ctype \$(LANG)
cd45f1fc 64if match \m(_lc_ctype) *.utf8 set terminal character-set utf8
8508a859
MW
65
66;; Set the HTTP proxy from the environment.
67if def \$(http_proxy) {
68 assign \%n \fsplit(\$(http_proxy),&v,/)
69 set tcp http-proxy \&v[2]
70}
71
72;; Guest virtual consoles are frequently presented as Unix-domain sockets.
73def UNIX {
74 if <= \v(argc) 1 -
75 end 1 Usage: UNIX socket
76 pipe nc -U \%1
77}
78
79;; Connect to a kermit SSH subsystem.
80def KERMSSH {
81 if <= \v(argc) 1 -
82 end 1 Usage: KERMSSH [options] [user@]host
83 set clear-channel on
84 pty ssh -enone -st \%* kermit
85}
86
87;; Console over null-modem cable.
88def CONSOLE {
89 if > \v(argc) 1 set speed \%1
90 if > \v(argc) 2 set serial \%2
91 else set serial 8n1
92 set modem type none
93 set carrier-watch off
94 set clear-channel on
95 connect
96}
97
98;; Synchronize remote terminal size with local window.
d4e04126 99def SYNCWINSZ output stty rows \v(rows) columns \v(cols)\13
8508a859 100
ba898e25
MW
101;; Special cases for particular target hosts.
102def GUVNOR {
103 set key 127 \8
104 telnet guvnor.distorted.org.uk
105}
0855593f
MW
106def JUMPTS {
107 local pass
108 set host /network-type:pty ssh -enone -t \%1
109 while true {
110 input 15 \fpattern({{{password:,exit}}})
111 if fail end 1 failed to connect
112 if equal \v(inmatch) exit break
113 if equal \v(inmatch) password: {
114 if ! def pass askq pass {password: }
115 output \m(pass)\13
116 }
117 }
118}
119def FENDERCON {
120 set input echo off
121 jumpts mdw@ts-tfm8.jump.net.uk
122 output 1\13
123 set control prefixed 30
124 connect
125}
4ab08834
MW
126def ARDUINO {
127 set terminal lf-display crlf
128 set line \%1
129 set speed 9600
130 set serial 8n1
131 set modem type none
132 set carrier-watch off
133 set clear-channel on
134 connect
135 set line
136}
ba898e25 137
8508a859
MW
138;; Local configuration.
139if exist \m(_dot)config take \m(_dot)config