Re: POSIX compliant termios.h?

From: Ed Schouten <ed_at_80386.nl>
Date: Tue, 12 Aug 2008 16:47:08 +0200
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
| _at__at_ -109,6 +109,9 _at__at_
|  #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/

Received on Tue Aug 12 2008 - 12:47:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:33 UTC