14 static Socket s
= NULL
;
16 static void rlogin_size(void);
18 static int sb_opt
, sb_len
;
19 static char *sb_buf
= NULL
;
20 static int sb_size
= 0;
23 static void c_write (char *buf
, int len
) {
24 from_backend(0, buf
, len
);
27 static int rlogin_receive (Socket s
, int urgent
, char *data
, int len
) {
29 /* Connection has closed. */
42 * We should flush everything (aka Telnet SYNCH) if we see
43 * 0x02, and we should turn off and on _local_ flow control
44 * on 0x10 and 0x20 respectively. I'm not convinced it's
53 * Called to set up the rlogin connection.
55 * Returns an error message, or NULL on success.
57 * Also places the canonical host name into `realhost'.
59 static char *rlogin_init (char *host
, int port
, char **realhost
) {
66 addr
= sk_namelookup(host
, realhost
);
67 if ( (err
= sk_addr_error(addr
)) )
71 port
= 513; /* default rlogin port */
76 s
= sk_new(addr
, port
, 1, rlogin_receive
);
77 if ( (err
= sk_socket_error(s
)) )
83 * Send local username, remote username, terminal/speed
90 sk_write(s
, cfg
.localusername
, strlen(cfg
.localusername
));
92 sk_write(s
, cfg
.username
, strlen(cfg
.username
));
94 sk_write(s
, cfg
.termtype
, strlen(cfg
.termtype
));
96 for(p
= cfg
.termspeed
; isdigit(*p
); p
++);
97 sk_write(s
, cfg
.termspeed
, p
- cfg
.termspeed
);
107 * Called to send data down the rlogin connection.
109 static void rlogin_send (char *buf
, int len
) {
114 sk_write(s
, buf
, len
);
118 * Called to set the size of the window
120 static void rlogin_size(void) {
121 char b
[12] = { 0xFF, 0xFF, 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
123 b
[6] = cols
>> 8; b
[7] = cols
& 0xFF;
124 b
[4] = rows
>> 8; b
[5] = rows
& 0xFF;
130 * Send rlogin special codes.
132 static void rlogin_special (Telnet_Special code
) {
137 static Socket
rlogin_socket(void) { return s
; }
139 static int rlogin_sendok(void) { return 1; }
141 Backend rlogin_backend
= {