+/*
+ * There are several kinds of tty drivers to contend with. These include:
+ * (1) V6: no CBREAK, no ioctl. (Include PWB V1 here).
+ * (2) V7 research: has CBREAK, has ioctl, and has the tchars (TIOCSETC)
+ * business to change start, stop, etc. chars.
+ * (3) USG V2: Basically like V6 but RAW mode is like V7 RAW.
+ * (We treat it as V6.)
+ * (4) USG V3: equivalent to V7 but totally incompatible.
+ * (5) Berkeley: has ltchars in addition to all of V7.
+ *
+ * The following attempts to decide what we are on, and declare
+ * some variables in the appropriate format. The wierd looking one (ttymode)
+ * is the thing we pass to sTTY and family to turn "RAW" mode on or off
+ * when we go into or out of visual mode. In V7/V6 it's just the flags word
+ * to stty. In USG V3 it's the whole tty structure.
+ */
+#ifdef USG3TTY /* USG V3 */
+ struct termio tty; /* Use this one structure to change modes */
+ typedef struct termio ttymode; /* Mode to contain tty flags */
+
+#else /* All others */
+ struct sgttyb tty; /* Always stty/gtty using this one structure */
+ typedef int ttymode; /* Mode to contain tty flags */
+# ifdef TIOCSETC /* V7 */
+ struct tchars ottyc, nttyc; /* For V7 character masking */
+# endif
+# ifdef TIOCLGET /* Berkeley */
+ struct ltchars olttyc, nlttyc; /* More of tchars style stuff */
+# endif
+