aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/9term.c2
-rw-r--r--src/cmd/9term/FreeBSD.c59
-rw-r--r--src/cmd/9term/bsdpty.c5
-rw-r--r--src/cmd/9term/mkfile3
-rw-r--r--src/cmd/9term/rcstart.c7
-rw-r--r--src/cmd/9term/term.h1
-rw-r--r--src/cmd/9term/win.c2
7 files changed, 14 insertions, 65 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c
index 6979d3cc..7a753431 100644
--- a/src/cmd/9term/9term.c
+++ b/src/cmd/9term/9term.c
@@ -11,6 +11,8 @@
#include <complete.h>
#include "term.h"
+int noecho = 0;
+
typedef struct Text Text;
typedef struct Readbuf Readbuf;
diff --git a/src/cmd/9term/FreeBSD.c b/src/cmd/9term/FreeBSD.c
index 6dba6dd4..eec79c28 100644
--- a/src/cmd/9term/FreeBSD.c
+++ b/src/cmd/9term/FreeBSD.c
@@ -1,58 +1 @@
-#include <u.h>
-#include <sys/types.h>
-#include <termios.h>
-#include <sys/termios.h>
-#include <libutil.h>
-#include <libc.h>
-#include "term.h"
-
-int
-getpts(int fd[], char *slave)
-{
- return openpty(&fd[1], &fd[0], slave, 0, 0);
-}
-
-int
-childpty(int fd[], char *slave)
-{
- int sfd;
-
- close(fd[1]);
- setsid();
- sfd = open(slave, ORDWR);
- if(sfd < 0)
- sysfatal("open %s: %r\n", slave);
- if(ioctl(sfd, TIOCSCTTY, 0) < 0)
- fprint(2, "ioctl TIOCSCTTY: %r\n");
- return sfd;
-}
-
-struct winsize ows;
-
-void
-updatewinsize(int row, int col, int dx, int dy)
-{
- struct winsize ws;
-
- ws.ws_row = row;
- ws.ws_col = col;
- ws.ws_xpixel = dx;
- ws.ws_ypixel = dy;
- if(ws.ws_row != ows.ws_row || ws.ws_col != ows.ws_col)
- if(ioctl(rcfd[0], TIOCSWINSZ, &ws) < 0)
- fprint(2, "ioctl: %r\n");
- ows = ws;
-}
-
-int
-israw(int fd)
-{
- return 0;
-}
-
-int
-setecho(int fd, int on)
-{
- return 0;
-}
-
+#include "bsdpty.c"
diff --git a/src/cmd/9term/bsdpty.c b/src/cmd/9term/bsdpty.c
index ebcf2ef0..8c0bf2c3 100644
--- a/src/cmd/9term/bsdpty.c
+++ b/src/cmd/9term/bsdpty.c
@@ -1,9 +1,13 @@
#include <u.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <errno.h>
#include <grp.h>
#include <termios.h>
#include <sys/termios.h>
+#ifdef __linux__
#include <pty.h>
+#endif
#include <fcntl.h>
#include <libc.h>
#include "term.h"
@@ -30,7 +34,6 @@ getpts(int fd[], char *slave)
pty[8] = *a;
pty[9] = *z;
if((fd[1] = open(pty, ORDWR)) < 0){
-fprint(2, "try %s: %r\n", pty);
if(errno == ENOENT)
break;
}else{
diff --git a/src/cmd/9term/mkfile b/src/cmd/9term/mkfile
index 8b06911d..acfd0b3e 100644
--- a/src/cmd/9term/mkfile
+++ b/src/cmd/9term/mkfile
@@ -1,4 +1,3 @@
-PLAN9=../../..
<$PLAN9/src/mkhdr
TARG=9term win
@@ -13,5 +12,5 @@ SHORTLIB=complete frame draw plumb fs mux thread 9
LDFLAGS=-L$X11/lib -lX11
-Linux.$O: bsdpty.c
+Linux.$O FreeBSD.$O: bsdpty.c
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
index 4b324830..7ee49350 100644
--- a/src/cmd/9term/rcstart.c
+++ b/src/cmd/9term/rcstart.c
@@ -1,9 +1,6 @@
#include <u.h>
-#include <libc.h>
-#if 0
-#include <sys/wait.h>
-#endif
#include <signal.h>
+#include <libc.h>
#include "term.h"
int
@@ -37,6 +34,8 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
dup(sfd, 1);
dup(sfd, 2);
system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'");
+ if(noecho)
+ system("stty -echo");
for(i=3; i<100; i++)
close(i);
execvp(argv[0], argv);
diff --git a/src/cmd/9term/term.h b/src/cmd/9term/term.h
index 4b5339ce..62ef0e68 100644
--- a/src/cmd/9term/term.h
+++ b/src/cmd/9term/term.h
@@ -5,3 +5,4 @@ extern int rcfd;
extern int rcstart(int, char*[], int*, int*);
extern int isecho(int);
extern int setecho(int, int);
+extern int noecho;
diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c
index 0e1fd8a6..fd42abe7 100644
--- a/src/cmd/9term/win.c
+++ b/src/cmd/9term/win.c
@@ -5,6 +5,8 @@
#include <fs.h>
#include "term.h"
+int noecho = 1;
+
#define EVENTSIZE 256
#define STACK 32768