X-Git-Url: http://git.joshuawise.com/firearm.git/blobdiff_plain/3a57f3e5cbccf519c546eebed9fa9db7c328d72c..95704fd3cfedb792839f6168c777d77ca1da3ceb:/testbench.cpp?ds=sidebyside 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 ()