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 skt, int urgent, char *data, int len) {
29 /* A socket error has occurred. */
32 connection_fatal(data);
35 /* Connection has closed. */
47 * We should flush everything (aka Telnet SYNCH) if we see
48 * 0x02, and we should turn off and on _local_ flow control
49 * on 0x10 and 0x20 respectively. I'm not convinced it's
58 * Called to set up the rlogin connection.
60 * Returns an error message, or NULL on success.
62 * Also places the canonical host name into `realhost'.
64 static char *rlogin_init (char *host, int port, char **realhost) {
71 addr = sk_namelookup(host, realhost);
72 if ( (err = sk_addr_error(addr)) )
76 port = 513; /* default rlogin port */
81 s = sk_new(addr, port, 1, rlogin_receive);
82 if ( (err = sk_socket_error(s)) )
88 * Send local username, remote username, terminal/speed
95 sk_write(s, cfg.localusername, strlen(cfg.localusername));
97 sk_write(s, cfg.username, strlen(cfg.username));
99 sk_write(s, cfg.termtype, strlen(cfg.termtype));
101 for(p = cfg.termspeed; isdigit(*p); p++);
102 sk_write(s, cfg.termspeed, p - cfg.termspeed);
110 * Called to send data down the rlogin connection.
112 static void rlogin_send (char *buf, int len) {
117 sk_write(s, buf, len);
121 * Called to set the size of the window
123 static void rlogin_size(void) {
124 char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
126 b[6] = cols >> 8; b[7] = cols & 0xFF;
127 b[4] = rows >> 8; b[5] = rows & 0xFF;
133 * Send rlogin special codes.
135 static void rlogin_special (Telnet_Special code) {
140 static Socket rlogin_socket(void) { return s; }
142 static int rlogin_sendok(void) { return 1; }
144 static int rlogin_ldisc(int option) {
148 Backend rlogin_backend = {