Underlining on most terminals is a kind of appearance mode, much like standout mode. Therefore, it may be implemented using magic cookies or as a flag in the terminal whose current state affects each character that is output. See section Standout and Appearance Modes, for a full explanation.
The `ug' capability is a numeric capability whose presence indicates that the terminal uses magic cookies for underlining. Its value is the number of character positions that a magic cookie for underlining occupies; it is used for underlining just as `sg' is used for standout. Aside from the simplest applications, it is impossible to use underlining correctly without paying attention to the value of `ug'.
There are two other, older ways of doing underlining: there can be a command to underline a single character, or the output of `_', the ASCII underscore character, as an overstrike could cause a character to be underlined. New programs need not bother to handle these capabilities unless the author cares strongly about the obscure terminals which support them. However, terminal descriptions should provide these capabilities when appropriate.
Go to the first, previous, next, last section, table of contents.