
From: Paul Mackerras <paulus@samba.org>

It turns out that we are not handling the TABDLY bits of the termios
c_oflag field correctly on PPC, PPC64 and Alpha.  These three architectures
have a value for XTABS that is different from the TAB3 value.  POSIX
specifies that setting the TABDLY field to TAB3 should result in tabs being
expanded to spaces.  In n_tty.c:opost() we check for O_TABDLY(tty) ==
XTABS, which is fine on most architectures because they have XTABS == TAB3.

I think the right thing to do is just to change the definition of XTABS to
be the same as TAB3 on these architectures.  The patch below does this for
PPC and PPC64 (and I suggest the Alpha maintainer should do the same).  At
the moment, applications using either the XTABS or TAB3 values won't get
the expected behaviour.  With this patch, apps that use TAB3 will get the
expected behaviour.  Apps that use XTABS will need to be recompiled (but
note that the POSIX-specified name to use is TAB3 not XTABS).


---

 25-akpm/include/asm-ppc/termbits.h   |    2 +-
 25-akpm/include/asm-ppc64/termbits.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN include/asm-ppc64/termbits.h~ppc-termio-fix include/asm-ppc64/termbits.h
--- 25/include/asm-ppc64/termbits.h~ppc-termio-fix	2004-05-09 16:25:25.636662056 -0700
+++ 25-akpm/include/asm-ppc64/termbits.h	2004-05-09 16:25:25.640661448 -0700
@@ -89,6 +89,7 @@ struct termios {
 #define   TAB1	00002000
 #define   TAB2	00004000
 #define   TAB3	00006000
+#define   XTABS	00006000	/* required by POSIX to == TAB3 */
 #define CRDLY	00030000
 #define   CR0	00000000
 #define   CR1	00010000
@@ -103,7 +104,6 @@ struct termios {
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
 
 /* c_cflag bit meaning */
 #define CBAUD	0000377
diff -puN include/asm-ppc/termbits.h~ppc-termio-fix include/asm-ppc/termbits.h
--- 25/include/asm-ppc/termbits.h~ppc-termio-fix	2004-05-09 16:25:25.637661904 -0700
+++ 25-akpm/include/asm-ppc/termbits.h	2004-05-09 16:25:25.640661448 -0700
@@ -81,6 +81,7 @@ struct termios {
 #define   TAB1	00002000
 #define   TAB2	00004000
 #define   TAB3	00006000
+#define   XTABS	00006000	/* required by POSIX to == TAB3 */
 #define CRDLY	00030000
 #define   CR0	00000000
 #define   CR1	00010000
@@ -95,7 +96,6 @@ struct termios {
 #define VTDLY	00200000
 #define   VT0	00000000
 #define   VT1	00200000
-#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
 
 /* c_cflag bit meaning */
 #define CBAUD	0000377

_
