Termcap Overview
Termcap is implemented as a plain text file that can be examined and modified with any text editor. On the UNIX and XENIX operating systems, this file is called "/etc/termcap" by default. However, any file can be designated as a termcap file. The termcap file contains "entries" for different kinds of terminals.
The following steps are taken by an application program that uses termcap:
-
The application must determine the type of terminal being used. This is usually done by examining the "TERM=" environment variable. Other methods include examining configuration tables set up by the user when the application was installed.
-
The application must locate the termcap file. This is usually "/etc/termcap". However, the "TERMCAP=" environment variable may be used to indicate a different file. For example: TERMCAP=/usr/wp/termcap.
NOTE: Sometimes the "TERMCAP=" environment variable will contain the actual termcap entry as opposed to the name of a termcap file. This is done to avoid having to read in a file every time an application is started. While this can save time, it can cause confusion when modifying a termcap file because the entry in the environment would keep overriding the termcap file. -
The application then scans the termcap file to locate the entry for the given terminal type. If no entry can be found, the application normally would not be able to continue.
-
The desired termcap entry is read by the application. All of the information needed by the application is gathered and stored in memory for quick access.
-
The termcap file is closed until the application is run again.