JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
remove xinerama flags
[st.git] / std.c
diff --git a/std.c b/std.c
index 4808db4..4c28ae4 100644 (file)
--- a/std.c
+++ b/std.c
@@ -6,6 +6,9 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#if !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
+#include <pty.h>
+#endif
 #include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -306,12 +309,24 @@ unbuffer(void) {
 
 int
 main(int argc, char *argv[]) {
-       fd_set rd;
        if(argc == 2 && !strcmp("-v", argv[1]))
                eprint("std-"VERSION", © 2008 Matthias-Christian Ott\n");
        else if(argc == 1)
                eprint("usage: st [-v]\n");
        getpty();
        shell();
+       fptm = fdopen(ptm, "r+");
+       if(!fptm)
+               eprintn("cannot open slave pty");
+       for(;;) {
+               c = getc(fptm);
+               switch(c) {
+               case '\033':
+                       parseesc();
+                       break;
+               default:
+                       putchar(c);
+               }
+       }
        return 0;
 }