wikid[discontinued] A quick and simple CLI-program for downloading and rendering wikipedia pages in the terminal. |
|
git clone https://noxz.tech/git/wikid.git | |
Log | Files | README | LICENSE |
1/* See LICENSE file for copyright and license details. */ 2#include <stdlib.h> 3#include <term.h> 4 5unsigned get_terminal_width(void) 6{ 7 const char* term = getenv("TERM"); 8 char buff[1024]; 9 int cols; 10 11 if (!term) 12 return 0; 13 14 if (tgetent(buff, term) <= 0) 15 return 0; 16 17 cols = tgetnum("co"); 18 19 if (cols == -1) 20 return 0; 21 22 return cols; 23}