Make work with new split telnet.
[unix-history] / usr / src / usr.bin / tn3270 / sys_curses / termout.c
index 75c7804..c6e7ec0 100644 (file)
@@ -1,28 +1,18 @@
 /*
 /*
- *     Copyright (c) 1984, 1985, 1986 by the Regents of the
- *     University of California and by Gregory Glenn Minshall.
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
  *
  *
- *     Permission to use, copy, modify, and distribute these
- *     programs and their documentation for any purpose and
- *     without fee is hereby granted, provided that this
- *     copyright and permission appear on all copies and
- *     supporting documentation, the name of the Regents of
- *     the University of California not be used in advertising
- *     or publicity pertaining to distribution of the programs
- *     without specific prior permission, and notice be given in
- *     supporting documentation that copying and distribution is
- *     by permission of the Regents of the University of California
- *     and by Gregory Glenn Minshall.  Neither the Regents of the
- *     University of California nor Gregory Glenn Minshall make
- *     representations about the suitability of this software
- *     for any purpose.  It is provided "as is" without
- *     express or implied warranty.
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char    sccsid[] = "@(#)outbound.c      3.1  10/29/86";
-#endif /* lint */
-
+static char sccsid[] = "@(#)termout.c  3.4 (Berkeley) %G%";
+#endif /* not lint */
 
 #if defined(unix)
 #include <signal.h>
 
 #if defined(unix)
 #include <signal.h>
@@ -37,7 +27,7 @@ static        char    sccsid[] = "@(#)outbound.c      3.1  10/29/86";
 
 #include "../telnet.ext"
 
 
 #include "../telnet.ext"
 
-#include "../ascii/disp_asc.h"
+#include "../api/disp_asc.h"
 
 #include "../ctlr/hostctlr.h"
 #include "../ctlr/inbound.ext"
 
 #include "../ctlr/hostctlr.h"
 #include "../ctlr/inbound.ext"
@@ -53,7 +43,7 @@ static        char    sccsid[] = "@(#)outbound.c      3.1  10/29/86";
 extern void EmptyTerminal();
 
 #define CorrectTerminalCursor() ((TransparentClock == OutputClock)? \
 extern void EmptyTerminal();
 
 #define CorrectTerminalCursor() ((TransparentClock == OutputClock)? \
-               terminalCursorAddress:UnLocked? CursorAddress: HighestScreen())
+               CursorAddress:UnLocked? CursorAddress: HighestScreen())
 
 
 static int terminalCursorAddress;      /* where the cursor is on term */
 
 
 static int terminalCursorAddress;      /* where the cursor is on term */
@@ -256,7 +246,7 @@ SlowScreen()
      * decide when the output has caught up.
      */
 
      * decide when the output has caught up.
      */
 
-    if (Highest == HighestScreen()) {
+    if (Highest >= HighestScreen()) {  /* Could be > if screen shrunk... */
        Highest = ScreenDec(Highest);   /* else, while loop will never end */
     }
     if (Lowest < LowestScreen()) {
        Highest = ScreenDec(Highest);   /* else, while loop will never end */
     }
     if (Lowest < LowestScreen()) {
@@ -614,6 +604,12 @@ InitTerminal()
        extern char *tgetstr();
 #endif /* defined(unix) */
 
        extern char *tgetstr();
 #endif /* defined(unix) */
 
+       if (initscr() == ERR) { /* Initialize curses to get line size */
+           ExitString("InitTerminal:  Error initializing curses", 1);
+           /*NOTREACHED*/
+       }
+       MaxNumberLines = LINES;
+       MaxNumberColumns = COLS;
        ClearArray(Terminal);
        terminalCursorAddress = SetBufferAddress(0,0);
 #if defined(unix)
        ClearArray(Terminal);
        terminalCursorAddress = SetBufferAddress(0,0);
 #if defined(unix)
@@ -744,9 +740,6 @@ BellOff()
        delwin(bellwin);
        bellwin = 0;
        bellwinup = 0;
        delwin(bellwin);
        bellwin = 0;
        bellwinup = 0;
-       Lowest = MIN(Lowest, LINES/2);
-       Highest = MAX(Highest, (LINES/2)+3);
-       memset((char *)(Terminal+LINES/2), 0, (sizeof Terminal[0])*(3*COLS));
        touchwin(stdscr);
        DoARefresh();
     }
        touchwin(stdscr);
        DoARefresh();
     }
@@ -836,9 +829,11 @@ TransStop()
 }
 
 void
 }
 
 void
-TransOut(buffer, count)
+TransOut(buffer, count, kind, control)
 unsigned char  *buffer;
 int            count;
 unsigned char  *buffer;
 int            count;
+int            kind;           /* 0 or 5 */
+int            control;        /* To see if we are done */
 {
 #if    defined(unix)
     extern char *transcom;
 {
 #if    defined(unix)
     extern char *transcom;
@@ -895,6 +890,11 @@ int                count;
     }
 #endif /* defined(unix) */
     (void) DataToTerminal(buffer, count);
     }
 #endif /* defined(unix) */
     (void) DataToTerminal(buffer, count);
+    if (control && (kind == 0)) {              /* Send in AID byte */
+       SendToIBM();
+    } else {
+       TransInput(1, kind);                    /* Go get some data */
+    }
 }
 
 
 }