14 static Socket s = NULL;
16 static void raw_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 raw_receive (Socket s, int urgent, char *data, int len) {
29 /* A socket error has occurred. */
30 connection_fatal(data);
34 /* Connection has closed. */
44 * Called to set up the raw connection.
46 * Returns an error message, or NULL on success.
48 * Also places the canonical host name into `realhost'.
50 static char *raw_init (char *host, int port, char **realhost) {
57 addr = sk_namelookup(host, realhost);
58 if ( (err = sk_addr_error(addr)) )
62 port = 23; /* default telnet port */
67 s = sk_new(addr, port, 0, raw_receive);
68 if ( (err = sk_socket_error(s)) )
77 * Called to send data down the raw connection.
79 static void raw_send (char *buf, int len) {
84 sk_write(s, buf, len);
88 * Called to set the size of the window
90 static void raw_size(void) {
96 * Send raw special codes.
98 static void raw_special (Telnet_Special code) {
103 static Socket raw_socket(void) { return s; }
105 static int raw_sendok(void) { return 1; }
107 static int raw_ldisc(int option) {
108 if (option == LD_EDIT || option == LD_ECHO)
113 Backend raw_backend = {