add struct ct_term terminfo/termios/ioctl wrapper
This commit is contained in:
parent
2033721c22
commit
bcfcbaf529
3 changed files with 89 additions and 0 deletions
36
src/test.c
Normal file
36
src/test.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "term.h"
|
||||
|
||||
int main(void) {
|
||||
struct ct_term *const term = (struct ct_term *)malloc(sizeof(struct ct_term));
|
||||
if (getterm(term)) {
|
||||
perror("getterm");
|
||||
endterm(term);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (termsize(term)) {
|
||||
perror("termsize");
|
||||
endterm(term);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
printf("\e[2J\e[1;1H");
|
||||
|
||||
char *line = (char *)malloc(sizeof(char) * (term->cols + 1));
|
||||
memset(line, 'X', term->cols);
|
||||
line[term->cols] = '\0';
|
||||
|
||||
for (int i=0; i < term->rows; i++) {
|
||||
printf("%s", line);
|
||||
}
|
||||
sleep(3);
|
||||
|
||||
endterm(term);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue