]> Joshua Wise's Git repositories - firearm.git/blobdiff - testbench.cpp
anulib: move the stack ALL the way up
[firearm.git] / testbench.cpp
index 4188d71555204b17cb2ad4057a326902b851943d..53be841f3480dad2e27d203c94c0ce141131b035 100644 (file)
@@ -1,8 +1,30 @@
 #include "Vsystem.h"
 #include <stdio.h>
+#define _XOPEN_SOURCE
+#include <stdlib.h>
+#include <fcntl.h>
 
 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 ()
This page took 0.022387 seconds and 4 git commands to generate.