term: add function to query terminal dimensions
This commit is contained in:
@@ -30,6 +30,8 @@ typedef enum b_print_format {
|
||||
B_PRINT_ERR,
|
||||
} b_print_format;
|
||||
|
||||
extern b_status b_term_get_dimensions(FILE *fp, unsigned int *w, unsigned int *h);
|
||||
|
||||
extern b_status b_print(b_print_format format, const char *str, ...);
|
||||
extern b_status b_print_paragraph(
|
||||
const char *str, FILE *fp, b_paragraph_format *format);
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
|
||||
typedef b_status (*print_function)(FILE *fp, const char *s);
|
||||
|
||||
b_status b_term_get_dimensions(FILE *fp, unsigned int *w, unsigned int *h)
|
||||
{
|
||||
return z__b_stream_dimensions(fp, w, h) == 0 ? B_SUCCESS
|
||||
: B_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static int print(FILE *fp, const char *str)
|
||||
{
|
||||
return fputs(str, fp);
|
||||
|
||||
Reference in New Issue
Block a user