ASCII Text with Overstriking File Format – Purpose Explained

documentationmantext formatting

After downloading the source code for Bash, I was browsing through the doc directory and came across the following files:

These control characters are not displayed in the representation provided by the Git web interface but the actual file can be downloaded and examined in text editor such as Vim.

Running the file command on bash.0 prints the following output:

bash.0: ASCII text, with overstriking

I’ve never come across this file format before and I was wondering what its purpose is and how it’s used. Searching the Web for the phrase “ASCII text, with overstriking” hasn’t been very enlightening.

Best Answer

A web search for "backspace" and "overstrike" would get better results.

The file is a manual page — formatted using nroff. Usually files such as bash.0 are simply generated and discarded. A while back, they were saved, to reduce work for the man program. Rather than /usr/share/man/man1, your manual pages would be read from /usr/share/man/cat1. Read the description of catman for instance.

nroff is the Unix command for formatting manual pages and other files. Back when it was first written, there were several other utilities, each with its own markup language. I've used at least a dozen different ones. But they all solved the problem of printing emphasized text in the same way: using carriage control. Backspaces are just noticeable because they are not used in other plain-text files. Tabs, carriage returns, line-feeds and form-feeds all have a role in plain text files (though form-feeds are far less important than they were originally).

nroff uses underlining to indicate italics and overstriking to represent bold. The technique is dated: it is useful for hard-copy devices where more than one character can be printed in the same position. Very few video terminals do that. In terminfo(5), that would be

   over_strike               os     os   terminal can over-
                                         strike

or more completely:

If the terminal overstrikes (rather than clearing a position when a character is struck over) then it should have the os capability.

In the usual case, the last character written on a given row/column of a video terminal would be all that is shown. nroff organized the output so that an underlined character was written as an underline, a backspace and the actual character. Doing that ensured that terminals without the overstrike feature would print something useful.

Among the very few video terminals listed which have the overstrike capability, I see the DEC gt40, which I used for about three years (1976-1979). There was no Unix on that system (it ran RT-11), but I wrote a text formatter, using the same type of overstruck text. Ultimately, I needed hardcopy, and wrote a utility to make that happen — something like col, perhaps — but solving a related problem. The terminal printed very slowly when it had a lot of underlined text, until my program reorganized the text to reduce the amount of switching between forward/backward motion.

With video terminals, there is no need for that. But they do not do overstriking. Instead, we have programs that recognize the underlining and show underlines, or have groff, which might show colored text instead of underlining (and bold).

Further reading:

Related Question