Line-drawing characters
Adapted from NCURSES Programming HOWTO, by Pradeep Padala.
If you have ever programmed in DOS, you know about the nifty characters in the extended character set. They are printable only on some terminals. ncurses functions like box() use these characters. Their names all start with ACS_, meaning alternate character set. You might have noticed them in some of the programs in these guides. Here is an example showing all of them.
Example: ACS Variables Example
#include <stdlib.h>#include <curses.h>
intmain(void){ int n = 0;
/* Two columns of 16, so all 32 fit on a 24-line screen */#define SHOW(string, acs) \ n++ /* clang-format off */ /* clang-format on */
return EXIT_SUCCESS;}There are 32 characters, more than a 24-line screen has lines, so the program shows them in two columns of 16. (curses.h also defines eleven ACS_ aliases, such as ACS_BSSB for ACS_ULCORNER, which name the same characters by which sides of the cell they join.) On a terminal narrower than 57 columns, the second column wraps.
The /* clang-format off */ and /* clang-format on */ comments keep the table of names lined up when the code is reformatted.