significantly simplifying the code and improving its portability. It
also adds a delay option from OpenBSD to make the display go at a
useful speed on fast terminals, and fixes signal handling to make it
reliable.
Patch supplied by Joseph Myers <jsm28@cam.ac.uk> in PR 6659.