BSD 4_4_Lite2 release
[unix-history] / usr / src / usr.bin / telnet / tn3270.c
index 7b71696..a75cd1e 100644 (file)
@@ -1,12 +1,38 @@
 /*
 /*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)tn3270.c   5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)tn3270.c   8.2 (Berkeley) 5/30/95";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -24,7 +50,7 @@ static char sccsid[] = "@(#)tn3270.c  5.1 (Berkeley) %G%";
 #include "../ctlr/screen.h"
 #include "../general/globals.h"
 
 #include "../ctlr/screen.h"
 #include "../general/globals.h"
 
-#include "../telextrn.h"
+#include "../sys_curses/telextrn.h"
 #include "../ctlr/externs.h"
 
 #if    defined(unix)
 #include "../ctlr/externs.h"
 
 #if    defined(unix)
@@ -51,7 +77,7 @@ static int
 #endif /* defined(TN3270) */
 
 
 #endif /* defined(TN3270) */
 
 
-void
+    void
 init_3270()
 {
 #if    defined(TN3270)
 init_3270()
 {
 #if    defined(TN3270)
@@ -80,11 +106,11 @@ init_3270()
  * only client needs for us to do that.
  */
 
  * only client needs for us to do that.
  */
 
-int
+    int
 DataToNetwork(buffer, count, done)
 DataToNetwork(buffer, count, done)
-register char  *buffer;        /* where the data is */
-register int   count;          /* how much to send */
-int            done;           /* is this the last of a logical block */
+    register char *buffer;     /* where the data is */
+    register int  count;       /* how much to send */
+    int                  done;         /* is this the last of a logical block */
 {
     register int loop, c;
     int origCount;
 {
     register int loop, c;
     int origCount;
@@ -137,15 +163,16 @@ int               done;           /* is this the last of a logical block */
 
 
 #if    defined(unix)
 
 
 #if    defined(unix)
-void
-inputAvailable()
+    void
+inputAvailable(signo)
+       int signo;
 {
     HaveInput = 1;
     sigiocount++;
 }
 #endif /* defined(unix) */
 
 {
     HaveInput = 1;
     sigiocount++;
 }
 #endif /* defined(unix) */
 
-void
+    void
 outputPurge()
 {
     (void) ttyflush(1);
 outputPurge()
 {
     (void) ttyflush(1);
@@ -164,10 +191,10 @@ outputPurge()
  * *all* the data at one time (thus the select).
  */
 
  * *all* the data at one time (thus the select).
  */
 
-int
+    int
 DataToTerminal(buffer, count)
 DataToTerminal(buffer, count)
-register char  *buffer;                /* where the data is */
-register int   count;                  /* how much to send */
+    register char      *buffer;                /* where the data is */
+    register int       count;                  /* how much to send */
 {
     register int c;
     int origCount;
 {
     register int c;
     int origCount;
@@ -207,7 +234,7 @@ register int        count;                  /* how much to send */
  * Push3270 - Try to send data along the 3270 output (to screen) direction.
  */
 
  * Push3270 - Try to send data along the 3270 output (to screen) direction.
  */
 
-int
+    int
 Push3270()
 {
     int save = ring_full_count(&netiring);
 Push3270()
 {
     int save = ring_full_count(&netiring);
@@ -215,7 +242,7 @@ Push3270()
     if (save) {
        if (Ifrontp+save > Ibuf+sizeof Ibuf) {
            if (Ibackp != Ibuf) {
     if (save) {
        if (Ifrontp+save > Ibuf+sizeof Ibuf) {
            if (Ibackp != Ibuf) {
-               memcpy(Ibuf, Ibackp, Ifrontp-Ibackp);
+               memmove(Ibuf, Ibackp, Ifrontp-Ibackp);
                Ifrontp -= (Ibackp-Ibuf);
                Ibackp = Ibuf;
            }
                Ifrontp -= (Ibackp-Ibuf);
                Ibackp = Ibuf;
            }
@@ -233,7 +260,7 @@ Push3270()
  *             before quitting.
  */
 
  *             before quitting.
  */
 
-void
+    void
 Finish3270()
 {
     while (Push3270() || !DoTerminalOutput()) {
 Finish3270()
 {
     while (Push3270() || !DoTerminalOutput()) {
@@ -247,9 +274,9 @@ Finish3270()
 
 /* StringToTerminal - output a null terminated string to the terminal */
 
 
 /* StringToTerminal - output a null terminated string to the terminal */
 
-void
+    void
 StringToTerminal(s)
 StringToTerminal(s)
-char *s;
+    char *s;
 {
     int count;
 
 {
     int count;
 
@@ -265,9 +292,9 @@ char *s;
  *     curses(3x) can call us to send out data.
  */
 
  *     curses(3x) can call us to send out data.
  */
 
-void
+    void
 _putchar(c)
 _putchar(c)
-char c;
+    char c;
 {
 #if    defined(sun)            /* SunOS 4.0 bug */
     c &= 0x7f;
 {
 #if    defined(sun)            /* SunOS 4.0 bug */
     c &= 0x7f;
@@ -283,7 +310,7 @@ char c;
 }
 #endif /* ((!defined(NOT43)) || defined(PUTCHAR)) */
 
 }
 #endif /* ((!defined(NOT43)) || defined(PUTCHAR)) */
 
-void
+    void
 SetIn3270()
 {
     if (Sent3270TerminalType && my_want_state_is_will(TELOPT_BINARY)
 SetIn3270()
 {
     if (Sent3270TerminalType && my_want_state_is_will(TELOPT_BINARY)
@@ -313,7 +340,7 @@ SetIn3270()
  *     Return '0' if no more responses to send; '1' if a response sent.
  */
 
  *     Return '0' if no more responses to send; '1' if a response sent.
  */
 
-int
+    int
 tn3270_ttype()
 {
     /*
 tn3270_ttype()
 {
     /*
@@ -358,6 +385,7 @@ tn3270_ttype()
 }
 
 #if    defined(unix)
 }
 
 #if    defined(unix)
+       int
 settranscom(argc, argv)
        int argc;
        char *argv[];
 settranscom(argc, argv)
        int argc;
        char *argv[];
@@ -368,7 +396,7 @@ settranscom(argc, argv)
           transcom = 0;
        }
        if (argc == 1) {
           transcom = 0;
        }
        if (argc == 1) {
-          return;
+          return 1;
        }
        transcom = tline;
        (void) strcpy(transcom, argv[1]);
        }
        transcom = tline;
        (void) strcpy(transcom, argv[1]);
@@ -376,6 +404,7 @@ settranscom(argc, argv)
            (void) strcat(transcom, " ");
            (void) strcat(transcom, argv[i]);
        }
            (void) strcat(transcom, " ");
            (void) strcat(transcom, argv[i]);
        }
+       return 1;
 }
 #endif /* defined(unix) */
 
 }
 #endif /* defined(unix) */