X-Git-Url: http://git.joshuawise.com/firearm.git/blobdiff_plain/1e66d5d1256a0e765f54201160b659ab2574b7d9..1d97a0955e863b7dc7bbe4350bcef8c2047768d8:/testbench.cpp diff --git a/testbench.cpp b/testbench.cpp index 4188d71..53be841 100644 --- a/testbench.cpp +++ b/testbench.cpp @@ -1,8 +1,30 @@ #include "Vsystem.h" #include +#define _XOPEN_SOURCE +#include +#include Vsystem *top; +void term_output(unsigned char d) +{ + int fd = posix_openpt(O_RDWR); + static int fd2 = -1; + char b[128]; + + if (fd2 == -1) + { + grantpt(fd); + fcntl(fd, F_SETFD, 0); /* clear close-on-exec */ + sprintf(b, "rxvt -pty-fd %d -bg black -fg white -title \"Output terminal\" &", fd); + system(b); + unlockpt(fd); + fd2 = open(ptsname(fd), O_RDWR); + close(fd); + } + write(fd2, &d, 1); +} + unsigned int main_time = 0; double sc_time_stamp ()