BSD 4_4_Lite2 release
[unix-history] / Foreign / src / telnetd / state.c
index c957734..e3cbb73 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)state.c    8.2 (Berkeley) 12/15/93";
+static char sccsid[] = "@(#)state.c    8.5 (Berkeley) 5/30/95";
 #endif /* not lint */
 
 #include "telnetd.h"
 #endif /* not lint */
 
 #include "telnetd.h"
@@ -354,7 +354,7 @@ gotiac:                     switch (c) {
                char    xbuf2[BUFSIZ];
                register char *cp;
                int n = pfrontp - opfrontp, oc;
                char    xbuf2[BUFSIZ];
                register char *cp;
                int n = pfrontp - opfrontp, oc;
-               bcopy(opfrontp, xptyobuf, n);
+               memmove(xptyobuf, opfrontp, n);
                pfrontp = opfrontp;
                pfrontp += term_input(xptyobuf, pfrontp, n, BUFSIZ+NETSLOP,
                                        xbuf2, &oc, BUFSIZ);
                pfrontp = opfrontp;
                pfrontp += term_input(xptyobuf, pfrontp, n, BUFSIZ+NETSLOP,
                                        xbuf2, &oc, BUFSIZ);
@@ -376,7 +376,7 @@ gotiac:                     switch (c) {
  * All state defaults are negative, and resp defaults to 0.
  *
  * When initiating a request to change state to new_state:
  * All state defaults are negative, and resp defaults to 0.
  *
  * When initiating a request to change state to new_state:
- * 
+ *
  * if ((want_resp == 0 && new_state == my_state) || want_state == new_state) {
  *     do nothing;
  * } else {
  * if ((want_resp == 0 && new_state == my_state) || want_state == new_state) {
  *     do nothing;
  * } else {
@@ -690,7 +690,6 @@ wontoption(option)
                         */
                        if (lmodetype != REAL_LINEMODE)
                                break;
                         */
                        if (lmodetype != REAL_LINEMODE)
                                break;
-                       lmodetype = KLUDGE_LINEMODE;
 # endif        /* KLUDGELINEMODE */
                        clientstat(TELOPT_LINEMODE, WONT, 0);
                        break;
 # endif        /* KLUDGELINEMODE */
                        clientstat(TELOPT_LINEMODE, WONT, 0);
                        break;
@@ -1446,8 +1445,8 @@ doclientstat()
        clientstat(TELOPT_LINEMODE, WILL, 0);
 }
 
        clientstat(TELOPT_LINEMODE, WILL, 0);
 }
 
-#define        ADD(c)   *ncp++ = c;
-#define        ADD_DATA(c) { *ncp++ = c; if (c == SE) *ncp++ = c; }
+#define        ADD(c)   *ncp++ = c
+#define        ADD_DATA(c) { *ncp++ = c; if (c == SE || c == IAC) *ncp++ = c; }
        void
 send_status()
 {
        void
 send_status()
 {
@@ -1476,14 +1475,10 @@ send_status()
                if (my_want_state_is_will(i)) {
                        ADD(WILL);
                        ADD_DATA(i);
                if (my_want_state_is_will(i)) {
                        ADD(WILL);
                        ADD_DATA(i);
-                       if (i == IAC)
-                               ADD(IAC);
                }
                if (his_want_state_is_will(i)) {
                        ADD(DO);
                        ADD_DATA(i);
                }
                if (his_want_state_is_will(i)) {
                        ADD(DO);
                        ADD_DATA(i);
-                       if (i == IAC)
-                               ADD(IAC);
                }
        }
 
                }
        }
 
@@ -1498,15 +1493,14 @@ send_status()
                ADD(SE);
 
                if (restartany >= 0) {
                ADD(SE);
 
                if (restartany >= 0) {
-                       ADD(SB)
+                       ADD(SB);
                        ADD(TELOPT_LFLOW);
                        if (restartany) {
                                ADD(LFLOW_RESTART_ANY);
                        } else {
                                ADD(LFLOW_RESTART_XON);
                        }
                        ADD(TELOPT_LFLOW);
                        if (restartany) {
                                ADD(LFLOW_RESTART_ANY);
                        } else {
                                ADD(LFLOW_RESTART_XON);
                        }
-                       ADD(SE)
-                       ADD(SB);
+                       ADD(SE);
                }
        }
 
                }
        }
 
@@ -1519,8 +1513,6 @@ send_status()
                ADD(TELOPT_LINEMODE);
                ADD(LM_MODE);
                ADD_DATA(editmode);
                ADD(TELOPT_LINEMODE);
                ADD(LM_MODE);
                ADD_DATA(editmode);
-               if (editmode == IAC)
-                       ADD(IAC);
                ADD(SE);
 
                ADD(SB);
                ADD(SE);
 
                ADD(SB);