Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We now present a function, ptyMasterOpen(), that employs the functions described in the previous sections to open a pseudoterminal master and obtain the name of the corresponding pseudoterminal slave. Our reasons for providing such a function are twofold:
Most programs perform these steps in exactly the same way, so it is convenient to encapsulate them in a single function.
Our ptyMasterOpen() function hides all of the details that are specific to UNIX 98 pseudoterminals. In Section 64.8, we present a reimplementation of this function that uses BSD-style pseudoterminals. All of the code that we present in the remainder of this chapter can work with either of these implementations.