Fixes for (Backend)->size() changes -- internal declarations didn't include
[u/mdw/putty] / rlogin.c
index 2ef2d71..74e8268 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
 
 static Socket s = NULL;
 static int rlogin_bufsize;
+static int rlogin_term_width, rlogin_term_height;
+static void *frontend;
 
-static void rlogin_size(void);
+static void rlogin_size(int width, int height);
 
 static void c_write(char *buf, int len)
 {
-    int backlog = from_backend(0, buf, len);
+    int backlog = from_backend(frontend, 0, buf, len);
     sk_set_frozen(s, backlog > RLOGIN_MAX_BACKLOG);
 }
 
@@ -48,7 +50,7 @@ static int rlogin_receive(Plug plug, int urgent, char *data, int len)
        c = *data++;
        len--;
        if (c == '\x80')
-           rlogin_size();
+           rlogin_size(rlogin_term_width, rlogin_term_height);
        /*
         * We should flush everything (aka Telnet SYNCH) if we see
         * 0x02, and we should turn off and on _local_ flow control
@@ -88,7 +90,8 @@ static void rlogin_sent(Plug plug, int bufsize)
  * Also places the canonical host name into `realhost'. It must be
  * freed by the caller.
  */
-static char *rlogin_init(char *host, int port, char **realhost, int nodelay)
+static char *rlogin_init(void *frontend_handle,
+                        char *host, int port, char **realhost, int nodelay)
 {
     static struct plug_function_table fn_table = {
        rlogin_closing,
@@ -99,6 +102,10 @@ static char *rlogin_init(char *host, int port, char **realhost, int nodelay)
     SockAddr addr;
     char *err;
 
+    frontend = frontend_handle;
+    rlogin_term_width = cfg.width;
+    rlogin_term_height = cfg.height;
+
     /*
      * Try to find host.
      */
@@ -175,17 +182,20 @@ static int rlogin_sendbuffer(void)
 /*
  * Called to set the size of the window
  */
-static void rlogin_size(void)
+static void rlogin_size(int width, int height)
 {
     char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
 
+    rlogin_term_width = width;
+    rlogin_term_height = height;
+
     if (s == NULL)
        return;
-    
-    b[6] = cols >> 8;
-    b[7] = cols & 0xFF;
-    b[4] = rows >> 8;
-    b[5] = rows & 0xFF;
+
+    b[6] = rlogin_term_width >> 8;
+    b[7] = rlogin_term_width & 0xFF;
+    b[4] = rlogin_term_height >> 8;
+    b[5] = rlogin_term_height & 0xFF;
     rlogin_bufsize = sk_write(s, b, 12);
     return;
 }