hl-vt100/test.c

38 lines
789 B
C
Raw Normal View History

2011-08-28 19:48:33 +00:00
#include <stdlib.h>
2011-08-31 07:00:24 +00:00
#include <unistd.h>
#include <utmp.h>
#include <string.h>
#include <pty.h>
#include <stdio.h>
2011-09-22 07:22:04 +00:00
#include "vt100_headless.h"
2011-09-22 18:29:27 +00:00
#include "terminal_vt100.h"
2011-09-22 07:22:04 +00:00
void disp(struct vt100_headless *vt100)
2011-08-31 22:12:25 +00:00
{
unsigned int y;
2011-09-21 17:36:54 +00:00
const char **lines;
2011-08-31 22:12:25 +00:00
2011-09-22 18:14:43 +00:00
lines = vt100_dump(vt100->term);
write(1, "\n", 1);
2011-09-22 18:14:43 +00:00
for (y = 0; y < vt100->term->height; ++y)
2011-08-31 22:12:25 +00:00
{
2011-09-22 18:14:43 +00:00
write(1, lines[y], vt100->term->width);
2011-08-31 22:12:25 +00:00
write(1, "\n", 1);
}
2011-08-31 07:00:24 +00:00
}
2011-09-22 18:14:43 +00:00
int main(int ac, char **av)
{
2011-09-22 07:22:04 +00:00
struct vt100_headless *vt100_headless;
2011-08-31 07:00:24 +00:00
2011-09-10 18:59:22 +00:00
if (ac == 1)
{
puts("Usage: test PROGNAME");
2011-09-10 18:59:22 +00:00
return EXIT_FAILURE;
}
2011-09-22 07:22:04 +00:00
vt100_headless = vt100_headless_init();
vt100_headless->changed = disp;
vt100_headless_fork(vt100_headless, av[1], (av + 1));
2011-08-28 19:48:33 +00:00
return EXIT_SUCCESS;
}