tags:

views:

23

answers:

1

In POSIX _POSIX_VDISABLE value if -1, there is no disabling character for special character for all the terminal device files; otherwise the value is the disabling character value..

Can please anyone help me understand this. I m not able to get the exact meaning of this.

Please

+2  A: 

If you look at the definition of special characters, that should mean (thre '-1' value), that all those special characters are active:

In canonical input, the terminal driver recognizes a number of special characters which perform various control functions.
These include the ERASE character (usually DEL) for editing input, and other editing characters.
The INTR character (normally Ctrl-c) for sending a SIGINT signal, and other signal-raising characters, may be available in either canonical or noncanonical input mode.

And you have a lot of those specal characters:


The question has been raised to see if such a value was portable (did always compiled) in 1997:

The wording in section 2.9.4:

If any of the constants in Table 2-11 are defined to have value -1 in the header ....

can suggest, on casual reading, code like the following to minimize size and optimize efficiency for each implementation:

#ifdef _POSIX_VDISABLE
#if    _POSIX_VDISABLE == -1
    /* code that assumes no vdisable capability */
#else
    /* code that assumes vdisable capability */
#endif
#else
    /* code that uses pathconf() to determine vdisable capability */
#endif

The interpretation #34 suggests that it will.

By using these values at COMPILE-TIME, a portable POSIX.1 application can avoid loading all pathconf() related code associated with a symbol in Table 2-11 when the symbol is defined.

VonC
The strange thing is that glibc seems to treat it as an unsigned char, which I have never figured out.
Tim Post
@Tim: Hence my links to the interpretations: "The standard makes no requirement that the constant _POSIX_VDISABLE be a preprocessor number."
VonC
Thank you so much.. By the way i m still a student pursuing my Computer Science Engineering :), How do guys have so much of knowledge(asking with respect). I mean i feel, I hardly know anything in this world :(
Nagaraj Tantri
@Nagaraj: Err... in this exact instance, Google help me for the link to the interpretations of `_POSIX_VDISABLE` in compile time ;)
VonC