raw mode now works (canon todo)
This commit is contained in:
parent
dede047166
commit
059606b5ef
1 changed files with 23 additions and 13 deletions
|
|
@ -4,32 +4,42 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "term.h"
|
||||
#include "termio.h"
|
||||
|
||||
int main(void) {
|
||||
struct ct_term *const term;
|
||||
struct ct_term *term;
|
||||
int retv = OK;
|
||||
|
||||
if (stashterm(&term)) {
|
||||
if (ct_stashterm(&term)) {
|
||||
perror("saveterm");
|
||||
exit(ERR);
|
||||
}
|
||||
if (termsize(term)) {
|
||||
if (ct_termsize(term)) {
|
||||
perror("termsize");
|
||||
retv = ERR;
|
||||
goto end;
|
||||
}
|
||||
|
||||
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);
|
||||
if (termmode_raw(term)) {
|
||||
perror("termmode_raw");
|
||||
retv = ERR;
|
||||
goto end;
|
||||
}
|
||||
printf("\n");
|
||||
sleep(3);
|
||||
|
||||
printf("%d - %d (%d)\n", term->rows, term->cols, term->fd);
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// printf("\n");
|
||||
while (1)
|
||||
sleep(3);
|
||||
|
||||
end:
|
||||
resetterm(term);
|
||||
return 0;
|
||||
ct_resetterm(term);
|
||||
return retv;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue