Bad news: That terminal you hooked up 30 years ago--okay, okay.

Same thing as yesterday's lpd diff: Remove from getty the f0, f1,
f2 gettytab capabilities that were used to poke magic numbers into
sgtty.  The "modern" replacement for f# is the set i#, o#, c#, l#
to poke magic numbers into termios.  *stabs himself with spork*

Our /etc/gettytab has one affected, highly historical entry, which
I have dutifully converted using the compatflags() function one
last time.

ok?

Index: etc/gettytab
===================================================================
RCS file: /cvs/src/etc/gettytab,v
retrieving revision 1.4
diff -u -p -r1.4 gettytab
--- etc/gettytab        8 Sep 2000 02:27:36 -0000       1.4
+++ etc/gettytab        10 Dec 2013 18:48:41 -0000
@@ -150,4 +150,4 @@ s|DSW|Port Selector:\
 # to one of the NNN-baud entries.
 #
 A|Auto-baud:\
-       :ab:sp#2400:f0#040:
+       :ab:sp#2400:i0#04000:o0#0:c0#045400:l0#0:
Index: libexec/getty/gettytab.5
===================================================================
RCS file: /cvs/src/libexec/getty/gettytab.5,v
retrieving revision 1.21
diff -u -p -r1.21 gettytab.5
--- libexec/getty/gettytab.5    3 Sep 2011 23:40:16 -0000       1.21
+++ libexec/getty/gettytab.5    10 Dec 2013 19:11:45 -0000
@@ -93,9 +93,6 @@ after login prompt.
 .Pq Dv EOF
 character.
 .It ev Ta str Ta Dv NULL Ta "Initial environment."
-.It f0 Ta num Ta unused Ta "TTY mode flags to write messages."
-.It f1 Ta num Ta unused Ta "TTY mode flags to read login name."
-.It f2 Ta num Ta unused Ta "TTY mode flags to leave terminal as."
 .It fl Ta str Ta So Li ^O Sc Ta "Output flush character."
 .It hc Ta bool Ta false Ta "\&Do"
 .Em not
@@ -161,6 +158,9 @@ The following capabilities are no longer
 .It bd Ta num Ta 0 Ta "Backspace delay."
 .It cb Ta bool Ta false Ta "Use CRT backspace mode."
 .It cd Ta num Ta 0 Ta "Carriage-return delay."
+.It f0 Ta num Ta unused Ta "TTY mode flags to write messages."
+.It f1 Ta num Ta unused Ta "TTY mode flags to read login name."
+.It f2 Ta num Ta unused Ta "TTY mode flags to leave terminal as."
 .It fd Ta num Ta 0 Ta "Form-feed (vertical motion) delay."
 .It nd Ta num Ta 0 Ta "Newline (line-feed) delay."
 .It uc Ta bool Ta false Ta "Terminal is known upper case only."
@@ -205,16 +205,6 @@ and
 .Em c_oflag
 fields, respectively.
 Each of these sets must be completely specified to be effective.
-The
-.Em \&f0 ,
-.Em \&f1 ,
-and
-.Em \&f2
-are excepted for backwards compatibility with a previous incarnation of
-the TTY subsystem.
-In these flags the bottom 16 bits of the (32 bits) value contain the sgttyb
-.Em sg_flags
-field, while the top 16 bits represent the local mode word.
 .Pp
 Should
 .Xr getty 8
Index: libexec/getty/gettytab.h
===================================================================
RCS file: /cvs/src/libexec/getty/gettytab.h,v
retrieving revision 1.6
diff -u -p -r1.6 gettytab.h
--- libexec/getty/gettytab.h    2 Jun 2003 19:38:24 -0000       1.6
+++ libexec/getty/gettytab.h    10 Dec 2013 19:08:24 -0000
@@ -96,37 +96,31 @@ struct gettyflags {
 #define        FD      gettynums[6].value
 #define        BD      gettynums[7].value
 #define        TO      gettynums[8].value
-#define        F0      gettynums[9].value
-#define        F0set   gettynums[9].set
-#define        F1      gettynums[10].value
-#define        F1set   gettynums[10].set
-#define        F2      gettynums[11].value
-#define        F2set   gettynums[11].set
-#define        PF      gettynums[12].value
-#define        C0      gettynums[13].value
-#define        C0set   gettynums[13].set
-#define        C1      gettynums[14].value
-#define        C1set   gettynums[14].set
-#define        C2      gettynums[15].value
-#define        C2set   gettynums[15].set
-#define        I0      gettynums[16].value
-#define        I0set   gettynums[16].set
-#define        I1      gettynums[17].value
-#define        I1set   gettynums[17].set
-#define        I2      gettynums[18].value
-#define        I2set   gettynums[18].set
-#define        L0      gettynums[19].value
-#define        L0set   gettynums[19].set
-#define        L1      gettynums[20].value
-#define        L1set   gettynums[20].set
-#define        L2      gettynums[21].value
-#define        L2set   gettynums[21].set
-#define        O0      gettynums[22].value
-#define        O0set   gettynums[22].set
-#define        O1      gettynums[23].value
-#define        O1set   gettynums[23].set
-#define        O2      gettynums[24].value
-#define        O2set   gettynums[24].set
+#define        PF      gettynums[9].value
+#define        C0      gettynums[10].value
+#define        C0set   gettynums[10].set
+#define        C1      gettynums[11].value
+#define        C1set   gettynums[11].set
+#define        C2      gettynums[12].value
+#define        C2set   gettynums[12].set
+#define        I0      gettynums[13].value
+#define        I0set   gettynums[13].set
+#define        I1      gettynums[14].value
+#define        I1set   gettynums[14].set
+#define        I2      gettynums[15].value
+#define        I2set   gettynums[15].set
+#define        L0      gettynums[16].value
+#define        L0set   gettynums[16].set
+#define        L1      gettynums[17].value
+#define        L1set   gettynums[17].set
+#define        L2      gettynums[18].value
+#define        L2set   gettynums[18].set
+#define        O0      gettynums[19].value
+#define        O0set   gettynums[19].set
+#define        O1      gettynums[20].value
+#define        O1set   gettynums[20].set
+#define        O2      gettynums[21].value
+#define        O2set   gettynums[21].set
 
 /*
  * Boolean values.
Index: libexec/getty/init.c
===================================================================
RCS file: /cvs/src/libexec/getty/init.c,v
retrieving revision 1.8
diff -u -p -r1.8 init.c
--- libexec/getty/init.c        7 Jun 2010 02:01:45 -0000       1.8
+++ libexec/getty/init.c        10 Dec 2013 19:06:08 -0000
@@ -80,9 +80,6 @@ struct        gettynums gettynums[] = {
        { "fd" },                       /* form-feed delay */
        { "bd" },                       /* backspace delay */
        { "to" },                       /* timeout */
-       { "f0" },                       /* output flags */
-       { "f1" },                       /* input flags */
-       { "f2" },                       /* user mode flags */
        { "pf" },                       /* delay before flush at 1st prompt */
        { "c0" },                       /* output c_flags */
        { "c1" },                       /* input c_flags */
Index: libexec/getty/subr.c
===================================================================
RCS file: /cvs/src/libexec/getty/subr.c,v
retrieving revision 1.20
diff -u -p -r1.20 subr.c
--- libexec/getty/subr.c        21 Apr 2013 04:25:49 -0000      1.20
+++ libexec/getty/subr.c        10 Dec 2013 16:40:09 -0000
@@ -32,7 +32,6 @@
 /*
  * Melbourne getty.
  */
-#define COMPAT_43
 #include <sys/ioctl.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -174,29 +173,6 @@ setflags(int n)
 {
        tcflag_t iflag, oflag, cflag, lflag;
 
-#ifdef COMPAT_43
-       switch (n) {
-       case 0:
-               if (F0set) {
-                       compatflags(F0);
-                       return;
-               }
-               break;
-       case 1:
-               if (F1set) {
-                       compatflags(F1);
-                       return;
-               }
-               break;
-       default:
-               if (F2set) {
-                       compatflags(F2);
-                       return;
-               }
-               break;
-       }
-#endif
-
        switch (n) {
        case 0:
                if (C0set && I0set && L0set && O0set) {
@@ -346,143 +322,6 @@ out:
        tmode.c_cflag = cflag;
        tmode.c_lflag = lflag;
 }
-
-#ifdef COMPAT_43
-/*
- * Old TTY => termios, snatched from <sys/kern/tty_compat.c>
- */
-void
-compatflags(long flags)
-{
-       tcflag_t iflag, oflag, cflag, lflag;
-
-       iflag = BRKINT|ICRNL|IMAXBEL|IXON|IXANY;
-       oflag = OPOST|ONLCR|OXTABS;
-       cflag = CREAD;
-       lflag = ICANON|ISIG|IEXTEN;
-
-       if (ISSET(flags, TANDEM))
-               SET(iflag, IXOFF);
-       else
-               CLR(iflag, IXOFF);
-       if (ISSET(flags, ECHO))
-               SET(lflag, ECHO);
-       else
-               CLR(lflag, ECHO);
-       if (ISSET(flags, CRMOD)) {
-               SET(iflag, ICRNL);
-               SET(oflag, ONLCR);
-       } else {
-               CLR(iflag, ICRNL);
-               CLR(oflag, ONLCR);
-       }
-       if (ISSET(flags, XTABS))
-               SET(oflag, OXTABS);
-       else
-               CLR(oflag, OXTABS);
-       if (ISSET(flags, LCASE)) {
-               SET(iflag, IUCLC);
-               SET(oflag, OLCUC);
-               SET(lflag, XCASE);
-       }
-       else {
-               CLR(iflag, IUCLC);
-               CLR(oflag, OLCUC);
-               CLR(lflag, XCASE);
-       }
-
-
-       if (ISSET(flags, RAW)) {
-               iflag &= IXOFF;
-               CLR(lflag, ISIG|ICANON|IEXTEN|XCASE);
-               CLR(cflag, PARENB);
-       } else {
-               SET(iflag, BRKINT|IXON|IMAXBEL);
-               SET(lflag, ISIG|IEXTEN);
-               if (ISSET(iflag, IUCLC) && ISSET(oflag, OLCUC))
-                       SET(lflag, XCASE);
-               if (ISSET(flags, CBREAK))
-                       CLR(lflag, ICANON);
-               else
-                       SET(lflag, ICANON);
-               switch (ISSET(flags, ANYP)) {
-               case 0:
-                       CLR(cflag, PARENB);
-                       break;
-               case ANYP:
-                       SET(cflag, PARENB);
-                       CLR(iflag, INPCK);
-                       break;
-               case EVENP:
-                       SET(cflag, PARENB);
-                       SET(iflag, INPCK);
-                       CLR(cflag, PARODD);
-                       break;
-               case ODDP:
-                       SET(cflag, PARENB);
-                       SET(iflag, INPCK);
-                       SET(cflag, PARODD);
-                       break;
-               }
-       }
-
-       /* Nothing we can do with CRTBS. */
-       if (ISSET(flags, PRTERA))
-               SET(lflag, ECHOPRT);
-       else
-               CLR(lflag, ECHOPRT);
-       if (ISSET(flags, CRTERA))
-               SET(lflag, ECHOE);
-       else
-               CLR(lflag, ECHOE);
-       /* Nothing we can do with TILDE. */
-       if (ISSET(flags, MDMBUF))
-               SET(cflag, MDMBUF);
-       else
-               CLR(cflag, MDMBUF);
-       if (ISSET(flags, NOHANG))
-               CLR(cflag, HUPCL);
-       else
-               SET(cflag, HUPCL);
-       if (ISSET(flags, CRTKIL))
-               SET(lflag, ECHOKE);
-       else
-               CLR(lflag, ECHOKE);
-       if (ISSET(flags, CTLECH))
-               SET(lflag, ECHOCTL);
-       else
-               CLR(lflag, ECHOCTL);
-       if (!ISSET(flags, DECCTQ))
-               SET(iflag, IXANY);
-       else
-               CLR(iflag, IXANY);
-       CLR(lflag, TOSTOP|FLUSHO|PENDIN|NOFLSH);
-       SET(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));
-
-       if (ISSET(flags, RAW|LITOUT|PASS8)) {
-               CLR(cflag, CSIZE);
-               SET(cflag, CS8);
-               if (!ISSET(flags, RAW|PASS8))
-                       SET(iflag, ISTRIP);
-               else
-                       CLR(iflag, ISTRIP);
-               if (!ISSET(flags, RAW|LITOUT))
-                       SET(oflag, OPOST);
-               else
-                       CLR(oflag, OPOST);
-       } else {
-               CLR(cflag, CSIZE);
-               SET(cflag, CS7);
-               SET(iflag, ISTRIP);
-               SET(oflag, OPOST);
-       }
-
-       tmode.c_iflag = iflag;
-       tmode.c_oflag = oflag;
-       tmode.c_cflag = cflag;
-       tmode.c_lflag = lflag;
-}
-#endif
 
 #ifdef XXX_DELAY
 struct delayval {
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to