make things work on SunOS

This commit is contained in:
rsc 2004-04-20 02:03:38 +00:00
parent e637c944fe
commit a0f1e21ff9
19 changed files with 43 additions and 20 deletions

View file

@ -259,7 +259,8 @@ struct Ispacer
// Item state flags and value fields // Item state flags and value fields
enum { enum {
IFbrk = 0x80000000, // forced break before this item // IFbrk = 0x80000000, // forced break before this item
#define IFbrk 0x80000000 /* too big for sun */
IFbrksp = 0x40000000, // add 1 line space to break (IFbrk set too) IFbrksp = 0x40000000, // add 1 line space to break (IFbrk set too)
IFnobrk = 0x20000000, // break not allowed before this item IFnobrk = 0x20000000, // break not allowed before this item
IFcleft = 0x10000000, // clear left floats (IFbrk set too) IFcleft = 0x10000000, // clear left floats (IFbrk set too)

View file

@ -60,14 +60,14 @@ updatewinsize(int row, int col, int dx, int dy)
static struct termios ttmode; static struct termios ttmode;
int int
israw(int fd) isecho(int fd)
{ {
if(tcgetattr(fd, &ttmode) < 0) if(tcgetattr(fd, &ttmode) < 0)
fprint(2, "tcgetattr: %r\n"); fprint(2, "tcgetattr: %r\n");
if(debug) fprint(2, "israw %c%c\n", if(debug) fprint(2, "israw %c%c\n",
ttmode.c_lflag&ICANON ? 'c' : '-', ttmode.c_lflag&ICANON ? 'c' : '-',
ttmode.c_lflag&ECHO ? 'e' : '-'); ttmode.c_lflag&ECHO ? 'e' : '-');
return !(ttmode.c_lflag&(ICANON|ECHO)); return (ttmode.c_lflag&(ICANON|ECHO));
} }
int int

View file

@ -39,7 +39,7 @@ initfsize(void)
fsize['s'] = 4; fsize['s'] = 4;
fsize['u'] = 2; fsize['u'] = 2;
fsize['x'] = 2; fsize['x'] = 2;
}; }
int int
fmtsize(Value *v) fmtsize(Value *v)
@ -1021,7 +1021,7 @@ initexpop(void)
expop[OFMT] = ofmt; expop[OFMT] = ofmt;
expop[OEVAL] = oeval; expop[OEVAL] = oeval;
expop[OWHAT] = owhat; expop[OWHAT] = owhat;
}; }
void void
initexpr(void) initexpr(void)

View file

@ -52,7 +52,7 @@ initcmap(void)
cmap['v']= '\v'+1; cmap['v']= '\v'+1;
cmap['\\']= '\\'+1; cmap['\\']= '\\'+1;
cmap['"']= '"'+1; cmap['"']= '"'+1;
}; }
void void
kinit(void) kinit(void)

View file

@ -30,7 +30,7 @@ initbinop(void)
binop[OCAND]= "&&"; binop[OCAND]= "&&";
binop[OCOR]= "||"; binop[OCOR]= "||";
binop[OASGN]= " = "; binop[OASGN]= " = ";
}; }
static char *tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"; static char *tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
char *typenames[] = { char *typenames[] = {

View file

@ -16,7 +16,7 @@ LIB=lib/libbzip2.a
SHORTLIB=bio 9 SHORTLIB=bio 9
<$PLAN9/src/mkmany <$PLAN9/src/mkmany
CFLAGS=$CFLAGS -p -DPLAN9 -Ilib CFLAGS=$CFLAGS -DPLAN9 -Ilib
test:V: $O.bzip2 $O.bunzip2 test:V: $O.bzip2 $O.bunzip2
./$O.bzip2 -1 < sample1.ref > sample1.rb2 ./$O.bzip2 -1 < sample1.ref > sample1.rb2

View file

@ -6,6 +6,8 @@
#include "defs.h" #include "defs.h"
#include "fns.h" #include "fns.h"
#define ptrace dbptrace
extern int infile; extern int infile;
extern int outfile; extern int outfile;
extern int maxpos; extern int maxpos;

View file

@ -697,6 +697,8 @@ notifyf(void *a, char *s)
noted(NDFLT); noted(NDFLT);
rescue(); rescue();
} }
if(strstr(s, "child"))
noted(NCONT);
fprint(2, "ed: note: %s\n", s); fprint(2, "ed: note: %s\n", s);
abort(); abort();
} }
@ -928,7 +930,8 @@ callunix(void)
*p = 0; *p = 0;
pid = fork(); pid = fork();
if(pid == 0) { if(pid == 0) {
execl("/bin/rc", "rc", "-c", buf, 0); execlp("rc", "rc", "-c", buf, 0);
sysfatal("exec failed: %r");
exits("execl failed"); exits("execl failed");
} }
waiting = 1; waiting = 1;

View file

@ -34,7 +34,8 @@ enum
GZOSACORN = 13, /* Acorn RISCOS */ GZOSACORN = 13, /* Acorn RISCOS */
GZOSUNK = 255, GZOSUNK = 255,
GZCRCPOLY = 0xedb88320UL, #define GZCRCPOLY 0xedb88320
/* GZCRCPOLY = 0xedb88320UL, */
GZOSINFERNO = GZOSUNIX, GZOSINFERNO = GZOSUNIX,
}; };

View file

@ -16,7 +16,8 @@ enum
ZTrailInfo = 1 << 3, /* uncsize, csize, and crc are in trailer */ ZTrailInfo = 1 << 3, /* uncsize, csize, and crc are in trailer */
ZCompPatch = 1 << 5, /* compression patched data */ ZCompPatch = 1 << 5, /* compression patched data */
ZCrcPoly = 0xedb88320, /* ZCrcPoly = 0xedb88320, */
#define ZCrcPoly 0xedb88320
/* /*
* compression method * compression method

View file

@ -18,7 +18,9 @@ extern struct penvir {
double grade; double grade;
int pgap; int pgap;
double pslant; double pslant;
int pmode, foregr, backgr; int pmode;
ulong foregr;
ulong backgr;
} *e0, *e1, *esave; } *e0, *e1, *esave;
#define RADIAN 57.3 /* radians per degree */ #define RADIAN 57.3 /* radians per degree */
struct seg { struct seg {

View file

@ -15,7 +15,7 @@ sysfatal(char *fmt, ...)
va_end(arg); va_end(arg);
__fixargv0(); __fixargv0();
fprint(2, "%s; %s\n", argv0 ? argv0 : "<prog>", buf); fprint(2, "%s: %s\n", argv0 ? argv0 : "<prog>", buf);
exits("fatal"); exits("fatal");
} }

View file

@ -254,6 +254,18 @@ walkfile(File *f, char *path)
free(os); free(os);
return f; return f;
} }
static Qid
mkqid(vlong path, long vers, int type)
{
Qid q;
q.path = path;
q.vers = vers;
q.type = type;
return q;
}
Tree* Tree*
alloctree(char *uid, char *gid, ulong mode, void (*destroy)(File*)) alloctree(char *uid, char *gid, ulong mode, void (*destroy)(File*))
@ -281,7 +293,7 @@ alloctree(char *uid, char *gid, ulong mode, void (*destroy)(File*))
muid = estrdup9p(uid); muid = estrdup9p(uid);
f->dir.qid = (Qid){0, 0, QTDIR}; f->dir.qid = mkqid(0, 0, QTDIR);
f->dir.length = 0; f->dir.length = 0;
f->dir.atime = f->dir.mtime = time(0); f->dir.atime = f->dir.mtime = time(0);
f->dir.mode = DMDIR | mode; f->dir.mode = DMDIR | mode;

View file

@ -535,7 +535,7 @@ lzwrite(LZstate *lz, void *buf, int n)
if(n && lz->w){ if(n && lz->w){
nw = (*lz->w)(lz->wr, buf, n); nw = (*lz->w)(lz->wr, buf, n);
if(nw != n){ if(nw != n){
lz->w = nil; lz->w = 0;
lz->wbad = 1; lz->wbad = 1;
}else }else
lz->totw += n; lz->totw += n;

View file

@ -57,7 +57,7 @@ cvtstringtab(char **tab, int n)
rtab = emalloc(n*sizeof(rtab[0])); rtab = emalloc(n*sizeof(rtab[0]));
for(i=0; i<n; i++) for(i=0; i<n; i++)
rtab[i] = toStr(tab[i], strlen(tab[i]), US_Ascii); rtab[i] = toStr((uchar*)tab[i], strlen(tab[i]), US_Ascii);
return rtab; return rtab;
} }
@ -69,7 +69,7 @@ cvtstringinttab(AsciiInt *tab, int n)
stab = emalloc(n*sizeof(stab[0])); stab = emalloc(n*sizeof(stab[0]));
for(i=0; i<n; i++){ for(i=0; i<n; i++){
stab[i].key = toStr(tab[i].key, strlen(tab[i].key), US_Ascii); stab[i].key = toStr((uchar*)tab[i].key, strlen(tab[i].key), US_Ascii);
stab[i].val = tab[i].val; stab[i].val = tab[i].val;
} }
return stab; return stab;

View file

@ -663,7 +663,7 @@ static char rlimi[] = "$%k,R%s,$%z,R%a";
#define OEM IBF(~0,22,30) #define OEM IBF(~0,22,30)
#define FP4 IBF(~0,26,30) #define FP4 IBF(~0,26,30)
#define ALL (~0) #define ALL ((ushort)~0)
/* /*
notes: notes:
10-26: crfD = rD>>2; rD&3 mbz 10-26: crfD = rD>>2; rD&3 mbz

View file

@ -249,7 +249,7 @@ stabssyminit(Fhdr *fp)
/* create new symbol, add it */ /* create new symbol, add it */
if(stabcvtsym(&sym, &s, dir, file, i) < 0) if(stabcvtsym(&sym, &s, dir, file, i) < 0)
continue; continue;
if(addsym(fp, &s) < 0) if(addsym(fp, &s) == nil)
goto err; goto err;
break; break;
} }

View file

@ -25,7 +25,7 @@ newthread(Proc *p, void (*f)(void *arg), void *arg, uint stacksize, char *name,
sysfatal("bad stacksize %d", stacksize); sysfatal("bad stacksize %d", stacksize);
t = _threadmalloc(sizeof(Thread), 1); t = _threadmalloc(sizeof(Thread), 1);
s = _threadmalloc(stacksize, 0); s = _threadmalloc(stacksize, 0);
t->stk = (char*)s; t->stk = (uchar*)s;
t->stksize = stacksize; t->stksize = stacksize;
_threaddebugmemset(s, 0xFE, stacksize); _threaddebugmemset(s, 0xFE, stacksize);
_threadinitstack(t, f, arg); _threadinitstack(t, f, arg);

View file

@ -1,3 +1,4 @@
#include <u.h>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include "threadimpl.h" #include "threadimpl.h"