raw mode now works (canon todo)

This commit is contained in:
Emile Clark-Boman 2025-09-28 13:20:35 +10:00
parent dede047166
commit 059606b5ef

View file

@ -4,32 +4,42 @@
#include <unistd.h> #include <unistd.h>
#include "term.h" #include "term.h"
#include "termio.h"
int main(void) { int main(void) {
struct ct_term *const term; struct ct_term *term;
int retv = OK; int retv = OK;
if (stashterm(&term)) { if (ct_stashterm(&term)) {
perror("saveterm"); perror("saveterm");
exit(ERR); exit(ERR);
} }
if (termsize(term)) { if (ct_termsize(term)) {
perror("termsize"); perror("termsize");
retv = ERR; retv = ERR;
goto end; goto end;
} }
char *line = (char *)malloc(sizeof(char) * (term->cols + 1)); if (termmode_raw(term)) {
memset(line, 'X', term->cols); perror("termmode_raw");
line[term->cols] = '\0'; retv = ERR;
goto end;
for (int i=0; i < term->rows; i++) {
printf("%s", line);
} }
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: end:
resetterm(term); ct_resetterm(term);
return 0; return retv;
} }