BSD 4_3_Reno release
[unix-history] / usr / src / libexec / telnetd / state.c
index 5daabbb..c15cbb5 100644 (file)
@@ -2,11 +2,23 @@
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1989 Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms are permitted provided
+ * that: (1) source distributions retain this entire copyright notice and
+ * comment, and (2) distributions including binaries display the following
+ * acknowledgement:  ``This product includes software developed by the
+ * University of California, Berkeley and its contributors'' in the
+ * documentation or other materials provided with the distribution and in
+ * all advertising materials mentioning features or use of this software.
+ * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)state.c    5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)state.c    5.7 (Berkeley) 6/28/90";
 #endif /* not lint */
 
 #include "telnetd.h"
 #endif /* not lint */
 
 #include "telnetd.h"
@@ -132,7 +144,8 @@ gotiac:                     switch (c) {
                                if (diagnostic & TD_OPTIONS)
                                        printoption("td: recv IAC", c);
 #endif /* DIAGNOSTICS */
                                if (diagnostic & TD_OPTIONS)
                                        printoption("td: recv IAC", c);
 #endif /* DIAGNOSTICS */
-                               recv_ayt();
+                               (void) strcpy(nfrontp, "\r\n[Yes]\r\n");
+                               nfrontp += 9;
                                break;
 
                        /*
                                break;
 
                        /*
@@ -148,7 +161,7 @@ gotiac:                     switch (c) {
                                init_termbuf();
 
                                if (slctab[SLC_AO].sptr &&
                                init_termbuf();
 
                                if (slctab[SLC_AO].sptr &&
-                                   *slctab[SLC_AO].sptr != (cc_t)(_POSIX_VDISABLE)) {
+                                   *slctab[SLC_AO].sptr != (cc_t)-1) {
                                    *pfrontp++ =
                                        (unsigned char)*slctab[SLC_AO].sptr;
                                }
                                    *pfrontp++ =
                                        (unsigned char)*slctab[SLC_AO].sptr;
                                }
@@ -183,7 +196,7 @@ gotiac:                     switch (c) {
                                        ch = *slctab[SLC_EC].sptr;
                                else
                                        ch = *slctab[SLC_EL].sptr;
                                        ch = *slctab[SLC_EC].sptr;
                                else
                                        ch = *slctab[SLC_EL].sptr;
-                               if (ch != (cc_t)(_POSIX_VDISABLE))
+                               if (ch != (cc_t)-1)
                                        *pfrontp++ = (unsigned char)ch;
                                break;
                            }
                                        *pfrontp++ = (unsigned char)ch;
                                break;
                            }
@@ -729,7 +742,7 @@ wontoption(option)
                                lmodetype = NO_LINEMODE;
                                clientstat(TELOPT_LINEMODE, WONT, 0);
                                send_will(TELOPT_SGA, 1);
                                lmodetype = NO_LINEMODE;
                                clientstat(TELOPT_LINEMODE, WONT, 0);
                                send_will(TELOPT_SGA, 1);
-                               send_will(TELOPT_ECHO, 1);
+/*@*/                          send_will(TELOPT_ECHO, 1);
                        }
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
                default:
                        }
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
                default:
@@ -763,17 +776,6 @@ send_will(option, init)
 #endif /* DIAGNOSTICS */
 }
 
 #endif /* DIAGNOSTICS */
 }
 
-#if    !defined(LINEMODE) || !defined(KLUDGELINEMODE)
-/*
- * When we get a DONT SGA, we will try once to turn it
- * back on.  If the other side responds DONT SGA, we
- * leave it at that.  This is so that when we talk to
- * clients that understand KLUDGELINEMODE but not LINEMODE,
- * we'll keep them in char-at-a-time mode.
- */
-int turn_on_sga = 0;
-#endif
-
 dooption(option)
        int option;
 {
 dooption(option)
        int option;
 {
@@ -801,17 +803,14 @@ dooption(option)
                switch (option) {
                case TELOPT_ECHO:
 #ifdef LINEMODE
                switch (option) {
                case TELOPT_ECHO:
 #ifdef LINEMODE
-# ifdef        KLUDGELINEMODE
-                       if (lmodetype == NO_LINEMODE)
-# else
-                       if (his_state_is_wont(TELOPT_LINEMODE))
-# endif
+                       if (lmodetype == NO_LINEMODE) {
 #endif
 #endif
-                       {
                                init_termbuf();
                                tty_setecho(1);
                                set_termbuf();
                                init_termbuf();
                                tty_setecho(1);
                                set_termbuf();
+#ifdef LINEMODE
                        }
                        }
+#endif
                        changeok++;
                        break;
 
                        changeok++;
                        break;
 
@@ -846,8 +845,6 @@ dooption(option)
                                if (linemode)
                                        break;
                        }
                                if (linemode)
                                        break;
                        }
-#else
-                       turn_on_sga = 0;
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
                        changeok++;
                        break;
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
                        changeok++;
                        break;
@@ -940,17 +937,14 @@ dontoption(option)
 
                case TELOPT_ECHO:       /* we should stop echoing */
 #ifdef LINEMODE
 
                case TELOPT_ECHO:       /* we should stop echoing */
 #ifdef LINEMODE
-# ifdef        KLUDGELINEMODE
-                       if (lmodetype == NO_LINEMODE)
-# else
-                       if (his_state_is_wont(TELOPT_LINEMODE))
-# endif
+                       if (lmodetype == NO_LINEMODE) {
 #endif
 #endif
-                       {
                                init_termbuf();
                                tty_setecho(0);
                                set_termbuf();
                                init_termbuf();
                                tty_setecho(0);
                                set_termbuf();
+#ifdef LINEMODE
                        }
                        }
+#endif
                        break;
 
                case TELOPT_SGA:
                        break;
 
                case TELOPT_SGA:
@@ -973,15 +967,6 @@ dontoption(option)
                                 * Gross.  Very Gross.
                                 */
                        }
                                 * Gross.  Very Gross.
                                 */
                        }
-                       break;
-#else
-                       set_my_want_state_wont(option);
-                       if (my_state_is_will(option))
-                               send_wont(option, 0);
-                       set_my_state_wont(option);
-                       if (turn_on_sga ^= 1)
-                               send_will(option);
-                       return;
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
 
                default:
 #endif /* defined(LINEMODE) && defined(KLUDGELINEMODE) */
 
                default: