SunOS can rot in hell.
This commit is contained in:
parent
4e3a2cc1f9
commit
be22ae2d07
52 changed files with 211 additions and 160 deletions
|
|
@ -239,7 +239,7 @@ xstat(int argc, char **argv)
|
|||
usage();
|
||||
|
||||
fid = xwalk(argv[0]);
|
||||
if((d = fsdirfstat(fid)) < 0)
|
||||
if((d = fsdirfstat(fid)) == 0)
|
||||
sysfatal("dirfstat: %r");
|
||||
fmtinstall('D', dirfmt);
|
||||
fmtinstall('M', dirmodefmt);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ number(Mntdir *md, Text *t, Range r, int line, int dir, int size, int *evalp)
|
|||
if(line<0 || line>t->file->b.nc)
|
||||
goto Rescue;
|
||||
*evalp = TRUE;
|
||||
return (Range){line, line};
|
||||
return range(line, line);
|
||||
}
|
||||
q0 = r.q0;
|
||||
q1 = r.q1;
|
||||
|
|
@ -104,7 +104,7 @@ number(Mntdir *md, Text *t, Range r, int line, int dir, int size, int *evalp)
|
|||
--q0;
|
||||
}
|
||||
*evalp = TRUE;
|
||||
return (Range){q0, q1};
|
||||
return range(q0, q1);
|
||||
|
||||
Rescue:
|
||||
if(md != nil)
|
||||
|
|
@ -197,7 +197,7 @@ address(Mntdir *md, Text *t, Range lim, Range ar, void *a, uint q0, uint q1, int
|
|||
if(c == '.')
|
||||
r = ar;
|
||||
else
|
||||
r = (Range){t->file->b.nc, t->file->b.nc};
|
||||
r = range(t->file->b.nc, t->file->b.nc);
|
||||
if(q < q1)
|
||||
dir = Fore;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ Exectab exectab[] = {
|
|||
{ LTab, tab, FALSE, XXX, XXX },
|
||||
{ LUndo, undo, FALSE, TRUE, XXX },
|
||||
{ LZerox, zeroxx, FALSE, XXX, XXX },
|
||||
{ nil, nil, 0, 0, 0 },
|
||||
{ nil, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
Exectab*
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ void flushwarnings(void);
|
|||
void startplumbing(void);
|
||||
|
||||
Runestr runestr(Rune*, uint);
|
||||
Range range(int, int);
|
||||
|
||||
#define runemalloc(a) (Rune*)emalloc((a)*sizeof(Rune))
|
||||
#define runerealloc(a, b) (Rune*)erealloc((a), (b)*sizeof(Rune))
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ Xfid*
|
|||
fsysflush(Xfid *x, Fid *f)
|
||||
{
|
||||
USED(f);
|
||||
sendp(x->c, xfidflush);
|
||||
sendp(x->c, (void*)xfidflush);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
@ -526,7 +526,7 @@ fsysopen(Xfid *x, Fid *f)
|
|||
if(((f->dir->perm&~(DMDIR|DMAPPEND))&m) != m)
|
||||
goto Deny;
|
||||
|
||||
sendp(x->c, xfidopen);
|
||||
sendp(x->c, (void*)xfidopen);
|
||||
return nil;
|
||||
|
||||
Deny:
|
||||
|
|
@ -624,7 +624,7 @@ fsysread(Xfid *x, Fid *f)
|
|||
free(b);
|
||||
return x;
|
||||
}
|
||||
sendp(x->c, xfidread);
|
||||
sendp(x->c, (void*)xfidread);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
@ -633,7 +633,7 @@ Xfid*
|
|||
fsyswrite(Xfid *x, Fid *f)
|
||||
{
|
||||
USED(f);
|
||||
sendp(x->c, xfidwrite);
|
||||
sendp(x->c, (void*)xfidwrite);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ Xfid*
|
|||
fsysclunk(Xfid *x, Fid *f)
|
||||
{
|
||||
fsysdelid(f->mntdir);
|
||||
sendp(x->c, xfidclose);
|
||||
sendp(x->c, (void*)xfidclose);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ expandfile(Text *t, uint q0, uint q1, Expand *e)
|
|||
e->u.at = t;
|
||||
e->a0 = amin+1;
|
||||
eval = FALSE;
|
||||
address(nil, nil, (Range){-1,-1}, (Range){0, 0}, t, e->a0, amax, tgetc, &eval, (uint*)&e->a1);
|
||||
address(nil, nil, range(-1,-1), range(0,0), t, e->a0, amax, tgetc, &eval, (uint*)&e->a1);
|
||||
return TRUE;
|
||||
|
||||
Isntfile:
|
||||
|
|
@ -723,7 +723,7 @@ openfile(Text *t, Expand *e)
|
|||
eval = FALSE;
|
||||
else{
|
||||
eval = TRUE;
|
||||
r = address(nil, t, (Range){-1, -1}, (Range){t->q0, t->q1}, e->u.at, e->a0, e->a1, e->agetc, &eval, &dummy);
|
||||
r = address(nil, t, range(-1,-1), range(t->q0, t->q1), e->u.at, e->a0, e->a1, e->agetc, &eval, &dummy);
|
||||
if(eval == FALSE)
|
||||
e->jump = FALSE; /* don't jump if invalid address */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -894,7 +894,7 @@ textselect(Text *t)
|
|||
/* horrible botch: while asleep, may have lost selection altogether */
|
||||
if(selectq > t->file->b.nc)
|
||||
selectq = t->org + t->fr.p0;
|
||||
t->fr.scroll = nil;
|
||||
t->fr.scroll = 0;
|
||||
if(selectq < t->org)
|
||||
q0 = selectq;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -14,6 +14,16 @@
|
|||
static Point prevmouse;
|
||||
static Window *mousew;
|
||||
|
||||
Range
|
||||
range(int q0, int q1)
|
||||
{
|
||||
Range r;
|
||||
|
||||
r.q0 = q0;
|
||||
r.q1 = q1;
|
||||
return r;
|
||||
}
|
||||
|
||||
Runestr
|
||||
runestr(Rune *r, uint n)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ xfidctl(void *arg)
|
|||
threadsetname("xfidctlthread");
|
||||
x = arg;
|
||||
for(;;){
|
||||
f = recvp(x->c);
|
||||
f = (void(*)(Xfid*))recvp(x->c);
|
||||
(*f)(x);
|
||||
flushimage(display, 1);
|
||||
sendp(cxfidfree, x);
|
||||
|
|
@ -104,8 +104,8 @@ xfidopen(Xfid *x)
|
|||
switch(q){
|
||||
case QWaddr:
|
||||
if(w->nopen[q]++ == 0){
|
||||
w->addr = (Range){0,0};
|
||||
w->limit = (Range){-1,-1};
|
||||
w->addr = range(0,0);
|
||||
w->limit = range(-1,-1);
|
||||
}
|
||||
break;
|
||||
case QWdata:
|
||||
|
|
@ -164,7 +164,7 @@ xfidopen(Xfid *x)
|
|||
seq++;
|
||||
filemark(t->file);
|
||||
cut(t, t, nil, FALSE, TRUE, nil, 0);
|
||||
w->wrselrange = (Range){t->q1, t->q1};
|
||||
w->wrselrange = range(t->q1, t->q1);
|
||||
w->nomark = TRUE;
|
||||
break;
|
||||
case QWeditout:
|
||||
|
|
@ -173,7 +173,7 @@ xfidopen(Xfid *x)
|
|||
respond(x, &fc, Eperm);
|
||||
return;
|
||||
}
|
||||
w->wrselrange = (Range){t->q1, t->q1};
|
||||
w->wrselrange = range(t->q1, t->q1);
|
||||
break;
|
||||
}
|
||||
winunlock(w);
|
||||
|
|
|
|||
|
|
@ -7,15 +7,19 @@
|
|||
* American Heritage Dictionary (encrypted)
|
||||
*/
|
||||
|
||||
static Rune intab[256] = {
|
||||
[0x82] 0xe9,
|
||||
[0x85] 0xe0,
|
||||
[0x89] 0xeb,
|
||||
[0x8a] 0xe8,
|
||||
[0xa4] 0xf1,
|
||||
[0xf8] 0xb0,
|
||||
[0xf9] 0xb7,
|
||||
};
|
||||
static Rune intab[256];
|
||||
|
||||
static void
|
||||
initintab(void)
|
||||
{
|
||||
intab[0x82] = 0xe9;
|
||||
intab[0x85] = 0xe0;
|
||||
intab[0x89] = 0xeb;
|
||||
intab[0x8a] = 0xe8;
|
||||
intab[0xa4] = 0xf1;
|
||||
intab[0xf8] = 0xb0;
|
||||
intab[0xf9] = 0xb7;
|
||||
}
|
||||
|
||||
static char tag[64];
|
||||
|
||||
|
|
@ -33,6 +37,7 @@ ahdprintentry(Entry e, int cmd)
|
|||
int c, state = Run;
|
||||
|
||||
if(!inited){
|
||||
initintab();
|
||||
for(c=0; c<256; c++)
|
||||
if(intab[c] == 0)
|
||||
intab[c] = c;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ inittagtab(void)
|
|||
tagtab[TI]= "TI";
|
||||
tagtab[TX]= "TX";
|
||||
tagtab[VD]= "VD";
|
||||
};
|
||||
}
|
||||
|
||||
static char *mget(int, char *, char *, char **);
|
||||
#if 0
|
||||
|
|
|
|||
|
|
@ -992,7 +992,7 @@ static int naux;
|
|||
static char auxname[Maxaux][Buflen];
|
||||
static char auxval[Maxaux][Buflen];
|
||||
static char spec[Buflen];
|
||||
static uchar *auxstate[Naux]; /* vals for most recent tag */
|
||||
static char *auxstate[Naux]; /* vals for most recent tag */
|
||||
static Entry curentry;
|
||||
#define cursize (curentry.end-curentry.start)
|
||||
|
||||
|
|
@ -1154,7 +1154,7 @@ oedprintentry(Entry e, int cmd)
|
|||
outchars(auxstate[Num]);
|
||||
outchars(") ");
|
||||
} else if(t == Sgk) {
|
||||
i = grtab[auxstate[Num][0]];
|
||||
i = grtab[(uchar)auxstate[Num][0]];
|
||||
if(i != NONE)
|
||||
outrune(i);
|
||||
outchars(". ");
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ yyerror(char *e, ...)
|
|||
exits("syntax");
|
||||
}
|
||||
|
||||
long
|
||||
int
|
||||
yylex(void)
|
||||
{
|
||||
char *q, *eq;
|
||||
|
|
|
|||
|
|
@ -122,22 +122,25 @@ static Fcall* fsysremove(Fcall*, uchar*, Fid*);
|
|||
static Fcall* fsysstat(Fcall*, uchar*, Fid*);
|
||||
static Fcall* fsyswstat(Fcall*, uchar*, Fid*);
|
||||
|
||||
Fcall* (*fcall[Tmax])(Fcall*, uchar*, Fid*) =
|
||||
Fcall* (*fcall[Tmax])(Fcall*, uchar*, Fid*);
|
||||
|
||||
static void
|
||||
initfcall(void)
|
||||
{
|
||||
[Tflush] = fsysflush,
|
||||
[Tversion] = fsysversion,
|
||||
[Tauth] = fsysauth,
|
||||
[Tattach] = fsysattach,
|
||||
[Twalk] = fsyswalk,
|
||||
[Topen] = fsysopen,
|
||||
[Tcreate] = fsyscreate,
|
||||
[Tread] = fsysread,
|
||||
[Twrite] = fsyswrite,
|
||||
[Tclunk] = fsysclunk,
|
||||
[Tremove]= fsysremove,
|
||||
[Tstat] = fsysstat,
|
||||
[Twstat] = fsyswstat,
|
||||
};
|
||||
fcall[Tflush] = fsysflush;
|
||||
fcall[Tversion] = fsysversion;
|
||||
fcall[Tauth] = fsysauth;
|
||||
fcall[Tattach] = fsysattach;
|
||||
fcall[Twalk] = fsyswalk;
|
||||
fcall[Topen] = fsysopen;
|
||||
fcall[Tcreate] = fsyscreate;
|
||||
fcall[Tread] = fsysread;
|
||||
fcall[Twrite] = fsyswrite;
|
||||
fcall[Tclunk] = fsysclunk;
|
||||
fcall[Tremove]= fsysremove;
|
||||
fcall[Tstat] = fsysstat;
|
||||
fcall[Twstat] = fsyswstat;
|
||||
}
|
||||
|
||||
char Ebadfcall[] = "bad fcall type";
|
||||
char Eperm[] = "permission denied";
|
||||
|
|
@ -208,6 +211,7 @@ fsysproc(void *v)
|
|||
uchar *buf;
|
||||
|
||||
USED(v);
|
||||
initfcall();
|
||||
t = nil;
|
||||
for(;;){
|
||||
buf = malloc(messagesize); /* avoid memset of emalloc */
|
||||
|
|
|
|||
|
|
@ -89,21 +89,25 @@ char *rflush(Fid*), *rversion(Fid*), *rauth(Fid*),
|
|||
*rread(Fid*), *rwrite(Fid*), *rclunk(Fid*),
|
||||
*rremove(Fid*), *rstat(Fid*), *rwstat(Fid*);
|
||||
|
||||
char *(*fcalls[])(Fid*) = {
|
||||
[Tversion] rversion,
|
||||
[Tflush] rflush,
|
||||
[Tauth] rauth,
|
||||
[Tattach] rattach,
|
||||
[Twalk] rwalk,
|
||||
[Topen] ropen,
|
||||
[Tcreate] rcreate,
|
||||
[Tread] rread,
|
||||
[Twrite] rwrite,
|
||||
[Tclunk] rclunk,
|
||||
[Tremove] rremove,
|
||||
[Tstat] rstat,
|
||||
[Twstat] rwstat,
|
||||
};
|
||||
char *(*fcalls[Tmax])(Fid*);
|
||||
|
||||
static void
|
||||
initfcalls(void)
|
||||
{
|
||||
fcalls[Tversion]= rversion;
|
||||
fcalls[Tflush]= rflush;
|
||||
fcalls[Tauth]= rauth;
|
||||
fcalls[Tattach]= rattach;
|
||||
fcalls[Twalk]= rwalk;
|
||||
fcalls[Topen]= ropen;
|
||||
fcalls[Tcreate]= rcreate;
|
||||
fcalls[Tread]= rread;
|
||||
fcalls[Twrite]= rwrite;
|
||||
fcalls[Tclunk]= rclunk;
|
||||
fcalls[Tremove]= rremove;
|
||||
fcalls[Tstat]= rstat;
|
||||
fcalls[Twstat]= rwstat;
|
||||
}
|
||||
|
||||
char Eperm[] = "permission denied";
|
||||
char Enotdir[] = "not a directory";
|
||||
|
|
@ -141,6 +145,7 @@ main(int argc, char *argv[])
|
|||
int stdio = 0;
|
||||
char *service;
|
||||
|
||||
initfcalls();
|
||||
service = "ramfs";
|
||||
defmnt = "/tmp";
|
||||
ARGBEGIN{
|
||||
|
|
|
|||
|
|
@ -216,10 +216,9 @@ void Updenv(void){
|
|||
}
|
||||
*/
|
||||
int
|
||||
cmpenv(a, b)
|
||||
char **a, **b;
|
||||
cmpenv(const void *a, const void *b)
|
||||
{
|
||||
return strcmp(*a, *b);
|
||||
return strcmp(*(char**)a, *(char**)b);
|
||||
}
|
||||
char **mkenv(){
|
||||
register char **env, **ep, *p, *q;
|
||||
|
|
@ -462,7 +461,7 @@ void Noerror(void){
|
|||
interrupted=0;
|
||||
}
|
||||
int
|
||||
Isatty(fd){
|
||||
Isatty(int fd){
|
||||
return isatty(fd);
|
||||
}
|
||||
void Abort(void){
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <u.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include <u.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue