SunOS can rot in hell.

This commit is contained in:
rsc 2004-03-26 01:59:35 +00:00
parent 4e3a2cc1f9
commit be22ae2d07
52 changed files with 211 additions and 160 deletions

View file

@ -214,7 +214,7 @@ threadmain(int argc, char *argv[])
if(maxtab <= 0)
maxtab = 8;
initdraw(nil, nil, "9term");
initdraw(0, nil, "9term");
notify(hangupnote);
mc = initmouse(nil, screen);
@ -299,13 +299,27 @@ loop(void)
{
Rune r;
int i;
Alt a[] = {
{mc->c, &mc->m, CHANRCV},
{kc->c, &r, CHANRCV},
{hostc, &i, CHANRCV},
{mc->resizec, nil, CHANRCV},
{nil, nil, CHANEND},
};
Alt a[5];
a[0].c = mc->c;
a[0].v = &mc->m;
a[0].op = CHANRCV;
a[1].c = kc->c;
a[1].v = &r;
a[1].op = CHANRCV;
a[2].c = hostc;
a[2].v = &i;
a[2].op = CHANRCV;
a[3].c = mc->resizec;
a[3].v = nil;
a[3].op = CHANRCV;
a[4].c = nil;
a[4].v = nil;
a[4].op = CHANEND;
for(;;) {
tcheck();
@ -326,7 +340,7 @@ loop(void)
key(r);
break;
case 2:
conswrite(rcbuf[i].data, rcbuf[i].n);
conswrite((char*)rcbuf[i].data, rcbuf[i].n);
break;
case 3:
doreshape();

View file

@ -1,6 +1,8 @@
#include "9term.h"
#include <u.h>
#include <termios.h>
#include <sys/termios.h>
#include <libc.h>
#include "term.h"
int
getpts(int fd[], char *slave)
@ -14,6 +16,19 @@ getpts(int fd[], char *slave)
return 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);
return sfd;
}
struct winsize ows;
void
@ -26,7 +41,7 @@ updatewinsize(int row, int col, int dx, int dy)
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)
if(ioctl(rcfd, TIOCSWINSZ, &ws) < 0)
fprint(2, "ioctl: %r\n");
ows = ws;
}

View file

@ -35,7 +35,12 @@ rcstart(int argc, char **argv, int *pfd)
dup(sfd, 0);
dup(sfd, 1);
dup(sfd, 2);
system("stty tabs -onlcr -echo erase ^h intr ^?");
// system("stty tabs -onlcr -echo erase '^h' intr '^?'");
system("echo tabs; stty tabs");
system("echo onlcr; stty -onlcr");
system("echo echo; stty -echo");
system("echo erase; stty erase '^h'");
system("echo intr; stty intr '^?'");
execvp(argv[0], argv);
fprint(2, "exec %s failed: %r\n", argv[0]);
_exits("oops");

View file

@ -133,10 +133,10 @@ threadmain(int argc, char **argv)
name = "gnot";
threadnotify(nopipes, 1);
if((fs = nsmount("acme", "")) < 0)
if((fs = nsmount("acme", "")) == 0)
sysfatal("nsmount acme: %r");
ctlfd = fsopen(fs, "new/ctl", ORDWR|OCEXEC);
if(ctlfd < 0 || fsread(ctlfd, buf, 12) != 12)
if(ctlfd == 0 || fsread(ctlfd, buf, 12) != 12)
sysfatal("ctl: %r");
id = atoi(buf);
sprint(buf, "%d/tag", id);