Add util function to get terminal size

This commit is contained in:
Romain Vimont
2021-11-11 15:22:39 +01:00
parent 3f51a2ab43
commit 38332f683c
3 changed files with 74 additions and 0 deletions

21
app/src/util/term.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef SC_TERM_H
#define SC_TERM_H
#include "common.h"
#include <stdbool.h>
/**
* Return the terminal dimensions
*
* Return false if the dimensions could not be retrieved.
*
* Otherwise, return true, and:
* - if `rows` is not NULL, then the number of rows is written to `*rows`.
* - if `columns` is not NULL, then the number of columns is written to
* `*columns`.
*/
bool
sc_term_get_size(unsigned *rows, unsigned *cols);
#endif