git/gitignore: Ignore `.nailing-cargo.lock' files.
[profile] / dot / mykermrc.in
1 ;;; ---kermit---
2 ;;;
3 ;;; Configuration and definitions for Kermit.
4
5 assign _profile @profile@/
6 assign _dot \v(home).kermit/
7
8 ;; General stuff.
9 set command recall-buffer-size 100
10 set escape-character ^]
11 set flow-control /direct-serial rts/cts
12 set flow-control /modem rts/cts
13 set locus local
14 set options directory /brief
15 set terminal trigger KERMIT READY TO SERVE...
16 set transfer pipes on
17
18 ;; Set the prompt string.
19 def _host \fword(\v(host),1,.)
20 def _pwd \freplace(\freplace(//\v(dir)/,//\v(home),~/),//,)
21 local _hack
22 asg _hack set prompt {C-Kermit \v(user)@\m(_host) \m(_pwd)>}
23 do _hack
24
25 ;; Dialling parameters.
26 set dial country-code 44
27 set dial area-code 1223
28 set dial display on
29 set dial toll-free-area-code 800
30 set dial ld-prefix 0
31 set dial intl-prefix 00
32
33 ;; Directories.
34 def _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
44 }
45 shift
46 }
47 assign awful { set \m(what) directory \m(list) }
48 do awful
49 }
50 _set_dir network -
51 \m(_profile)kermit/net.shared -
52 \m(_dot)net.local
53 _set_dir dial -
54 \m(_profile)kermit/dial.shared -
55 \m(_dot)dial.local
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.
59 set file character-set utf8
60 local _lc_ctype
61 if not def _lc_ctype if def \$(LC_ALL) assign _lc_ctype \$(LC_ALL)
62 if not def _lc_ctype if def \$(LC_CTYPE) assign _lc_ctype \$(LC_CTYPE)
63 if not def _lc_ctype if def \$(LANG) assign _lc_ctype \$(LANG)
64 if match \m(_lc_ctype) *.utf8 set terminal character-set utf8
65
66 ;; Set the HTTP proxy from the environment.
67 if 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.
73 def 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.
80 def 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.
88 def 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.
99 def SYNCWINSZ output stty rows \v(rows) columns \v(cols)\13
100
101 ;; Special cases for particular target hosts.
102 def GUVNOR {
103 set key 127 \8
104 telnet guvnor.distorted.org.uk
105 }
106 def 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 }
119 def 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 }
126 def 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 }
137
138 ;; Local configuration.
139 if exist \m(_dot)config take \m(_dot)config