Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

64. Pseudoterminals > Terminal Attributes and Window Size

Terminal Attributes and Window Size

The master and slave device share terminal attributes (termios) and window size (winsize) structures. (Both of these structures are described in Chapter 62.) This means that the program running above the pseudoterminal master can change these attributes for the pseudoterminal slave by applying tcsetattr() and ioctl() to the file descriptor of the master device.

One example of where changing terminal attributes can be useful is in the script program. Suppose we are running script in a terminal emulator window, and we change the size of the window. In this case, the terminal emulator program will inform the kernel of the change in the size of the corresponding terminal device, but this change is not reflected in the separate kernel record for the pseudoterminal slave (see Figure 64-4). As a consequence, screen-oriented programs (e.g., vi) running above the pseudoterminal slave will produce confusing output, since their understanding of the terminal window size differs from the actual size of the terminal. We can solve this problem as follows:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint