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. */
41 * We should flush everything (aka Telnet SYNCH) if we see
42 * 0x02, and we should turn off and on _local_ flow control
43 * on 0x10 and 0x20 respectively. I'm not convinced it's
52 * Called to set up the rlogin connection.
54 * Returns an error message, or NULL on success.
56 * Also places the canonical host name into `realhost'.
58 static char *rlogin_init (char *host, int port, char **realhost) {
65 addr = sk_namelookup(host, realhost);
66 if ( (err = sk_addr_error(addr)) )
70 port = 513; /* default rlogin port */
75 s = sk_new(addr, port, 1, rlogin_receive);
76 if ( (err = sk_socket_error(s)) )
82 * Send local username, remote username, terminal/speed
89 sk_write(s, cfg.localusername, strlen(cfg.localusername));
91 sk_write(s, cfg.username, strlen(cfg.username));
93 sk_write(s, cfg.termtype, strlen(cfg.termtype));
95 for(p = cfg.termspeed; isdigit(*p); p++);
96 sk_write(s, cfg.termspeed, p - cfg.termspeed);
106 * Called to send data down the rlogin connection.
108 static void rlogin_send (char *buf, int len) {
113 sk_write(s, buf, len);
117 * Called to set the size of the window
119 static void rlogin_size(void) {
120 char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
122 b[6] = cols >> 8; b[7] = cols & 0xFF;
123 b[4] = rows >> 8; b[5] = rows & 0xFF;
129 * Send rlogin special codes.
131 static void rlogin_special (Telnet_Special code) {
136 static Socket rlogin_socket(void) { return s; }
138 static int rlogin_sendok(void) { return 1; }
140 Backend rlogin_backend = {