Rethink the whole line discipline architecture. Instead of having
[u/mdw/putty] / rlogin.c
index bf1db8d..20296a0 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -25,6 +25,11 @@ static void c_write (char *buf, int len) {
 }
 
 static int rlogin_receive (Socket s, int urgent, char *data, int len) {
+    if (urgent==3) {
+        /* A socket error has occurred. */
+        connection_fatal(data);
+        len = 0;
+    }
     if (!len) {
        /* Connection has closed. */
        sk_close(s);
@@ -33,7 +38,6 @@ static int rlogin_receive (Socket s, int urgent, char *data, int len) {
     }
     if (urgent == 2) {
         char c;
-        int i;
         
         c = *data++; len--;
         if (c == 0x80)
@@ -98,8 +102,6 @@ static char *rlogin_init (char *host, int port, char **realhost) {
         sk_write(s, &z, 1);
     }
 
-    begin_session();
-
     return NULL;
 }
 
@@ -118,7 +120,7 @@ static void rlogin_send (char *buf, int len) {
  * Called to set the size of the window
  */
 static void rlogin_size(void) {
-    char b[12] = { 0xFF, 0xFF, 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
+    char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
 
     b[6] = cols >> 8; b[7] = cols & 0xFF;
     b[4] = rows >> 8; b[5] = rows & 0xFF;
@@ -138,6 +140,10 @@ static Socket rlogin_socket(void) { return s; }
 
 static int rlogin_sendok(void) { return 1; }
 
+static int rlogin_ldisc(int option) {
+    return 0;
+}
+
 Backend rlogin_backend = {
     rlogin_init,
     rlogin_send,
@@ -145,5 +151,6 @@ Backend rlogin_backend = {
     rlogin_special,
     rlogin_socket,
     rlogin_sendok,
+    rlogin_ldisc,
     1
 };