POSIX compliant termios.h?

Ed Schouten ed at 80386.nl
Tue Aug 12 14:47:09 UTC 2008

Hello Alexey,

* Alexey Shuvaev <shuvaev at physik.uni-wuerzburg.de> wrote:
> I have just tried to unBROKEN cad/brlcad and noticed that FreeBSD
> termios.h is missing some POSIX mandatory flags. In this case,
> TAB3 output processing flag (expand TABs on output == OXTABS).
> Are there any plans to fix it in the base?
> Attached is the workaround patch for cad/brlcad. Should I push it
> into the ports (via PR, etc...) or it is better to wait a little
> for a fix in the base?

Until very recently, it wasn't really possible to properly add TAB3 to
<termios.h>, because TAB3 was also used inside the <sgtty.h> interface.
Now that <sgtty.h> is no longer accessible by userspace applications, we
could commit the following patch to -CURRENT, but we cannot safely
backport it to RELENG_*:

| --- sys/sys/termios.h
| +++ sys/sys/termios.h
| @@ -109,6 +109,9 @@
|  #ifndef _POSIX_SOURCE
|  #define ONLCR		0x00000002	/* map NL to CR-NL (ala CRMOD) */
|  #define OXTABS		0x00000004	/* expand tabs to spaces */
| +#ifndef _KERNEL
| +#define	TAB3		OXTABS
| +#endif /* !_KERNEL */
|  #define ONOEOT		0x00000008	/* discard EOT's (^D) on output) */
|  #define OCRNL		0x00000010	/* map CR to NL on output */
|  #define ONOCR		0x00000020	/* no CR output at column 0 */

In the mean time, you'd better use the following cpp tricks:

| #ifndef TAB3
| #ifdef OXTABS
| #define TAB3 OXTABS
| #else
| #define TAB3 0
| #endif
| #endif

 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20080812/740aa48a/attachment.pgp

More information about the freebsd-current mailing list