make things work on SunOS
diff --git a/include/html.h b/include/html.h
index 2fdca44..0bcf3b5 100644
--- a/include/html.h
+++ b/include/html.h
@@ -259,7 +259,8 @@
 
 // Item state flags and value fields
 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)
 	IFnobrk =			0x20000000,	// break not allowed before this item
 	IFcleft =			0x10000000,	// clear left floats (IFbrk set too)
diff --git a/src/cmd/9term/SunOS.c b/src/cmd/9term/SunOS.c
index efc2a97..12f64b8 100644
--- a/src/cmd/9term/SunOS.c
+++ b/src/cmd/9term/SunOS.c
@@ -60,14 +60,14 @@
 static struct termios ttmode;
 
 int
-israw(int fd)
+isecho(int fd)
 {
 	if(tcgetattr(fd, &ttmode) < 0)
 		fprint(2, "tcgetattr: %r\n");
 	if(debug) fprint(2, "israw %c%c\n",
 		ttmode.c_lflag&ICANON ? 'c' : '-',
 		ttmode.c_lflag&ECHO ? 'e' : '-');
-	return !(ttmode.c_lflag&(ICANON|ECHO));
+	return (ttmode.c_lflag&(ICANON|ECHO));
 }
 
 int
diff --git a/src/cmd/acid/expr.c b/src/cmd/acid/expr.c
index 18b68f4..9cfac9e 100644
--- a/src/cmd/acid/expr.c
+++ b/src/cmd/acid/expr.c
@@ -39,7 +39,7 @@
 	fsize['s'] = 4;
 	fsize['u'] = 2;
 	fsize['x'] = 2;
-};
+}
 
 int
 fmtsize(Value *v)
@@ -1021,7 +1021,7 @@
 	expop[OFMT] = ofmt;
 	expop[OEVAL] = oeval;
 	expop[OWHAT] = owhat;
-};
+}
 
 void
 initexpr(void)
diff --git a/src/cmd/acid/lex.c b/src/cmd/acid/lex.c
index db11eb1..bbfb47b 100644
--- a/src/cmd/acid/lex.c
+++ b/src/cmd/acid/lex.c
@@ -52,7 +52,7 @@
 	cmap['v']=	'\v'+1;
 	cmap['\\']=	'\\'+1;
 	cmap['"']=	'"'+1;
-};
+}
 
 void
 kinit(void)
diff --git a/src/cmd/acid/print.c b/src/cmd/acid/print.c
index 9602103..0c66e02 100644
--- a/src/cmd/acid/print.c
+++ b/src/cmd/acid/print.c
@@ -30,7 +30,7 @@
 	binop[OCAND]=	"&&";
 	binop[OCOR]=	"||";
 	binop[OASGN]=	" = ";
-};
+}
 
 static char *tabs = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
 char *typenames[] = {
diff --git a/src/cmd/bzip2/mkfile b/src/cmd/bzip2/mkfile
index e544d4d..d846b93 100644
--- a/src/cmd/bzip2/mkfile
+++ b/src/cmd/bzip2/mkfile
@@ -16,7 +16,7 @@
 SHORTLIB=bio 9
 <$PLAN9/src/mkmany
 
-CFLAGS=$CFLAGS -p -DPLAN9 -Ilib
+CFLAGS=$CFLAGS -DPLAN9 -Ilib
 
 test:V: $O.bzip2 $O.bunzip2
 	./$O.bzip2 -1  < sample1.ref > sample1.rb2
diff --git a/src/cmd/db/print.c b/src/cmd/db/print.c
index d136a78..134cbc8 100644
--- a/src/cmd/db/print.c
+++ b/src/cmd/db/print.c
@@ -6,6 +6,8 @@
 #include "defs.h"
 #include "fns.h"
 
+#define ptrace dbptrace
+
 extern	int	infile;
 extern	int	outfile;
 extern	int	maxpos;
diff --git a/src/cmd/ed.c b/src/cmd/ed.c
index 1c1639b..d947d89 100644
--- a/src/cmd/ed.c
+++ b/src/cmd/ed.c
@@ -697,6 +697,8 @@
 			noted(NDFLT);
 		rescue();
 	}
+	if(strstr(s, "child"))
+		noted(NCONT);
 	fprint(2, "ed: note: %s\n", s);
 	abort();
 }
@@ -928,7 +930,8 @@
 	*p = 0;
 	pid = fork();
 	if(pid == 0) {
-		execl("/bin/rc", "rc", "-c", buf, 0);
+		execlp("rc", "rc", "-c", buf, 0);
+		sysfatal("exec failed: %r");
 		exits("execl failed");
 	}
 	waiting = 1;
diff --git a/src/cmd/gzip/gzip.h b/src/cmd/gzip/gzip.h
index 5b9863b..1713a26 100644
--- a/src/cmd/gzip/gzip.h
+++ b/src/cmd/gzip/gzip.h
@@ -34,7 +34,8 @@
 	GZOSACORN	= 13,			/* Acorn RISCOS */
 	GZOSUNK		= 255,
 
-	GZCRCPOLY	= 0xedb88320UL,
+#define GZCRCPOLY 0xedb88320
+/* 	GZCRCPOLY	= 0xedb88320UL, */
 
 	GZOSINFERNO	= GZOSUNIX,
 };
diff --git a/src/cmd/gzip/zip.h b/src/cmd/gzip/zip.h
index 9b703de..d005469 100644
--- a/src/cmd/gzip/zip.h
+++ b/src/cmd/gzip/zip.h
@@ -16,7 +16,8 @@
 	ZTrailInfo	= 1 << 3,	/* uncsize, csize, and crc are in trailer */
 	ZCompPatch	= 1 << 5,	/* compression patched data */
 
-	ZCrcPoly	= 0xedb88320,
+/*	ZCrcPoly	= 0xedb88320, */
+#define	ZCrcPoly	0xedb88320
 
 	/*
 	 * compression method
diff --git a/src/cmd/plot/libplot/mplot.h b/src/cmd/plot/libplot/mplot.h
index ee924dd..151b9c3 100644
--- a/src/cmd/plot/libplot/mplot.h
+++ b/src/cmd/plot/libplot/mplot.h
@@ -18,7 +18,9 @@
 	double grade;
 	int pgap;
 	double pslant;
-	int pmode, foregr, backgr;
+	int pmode;
+	ulong foregr;
+	ulong backgr;
 } *e0, *e1, *esave;
 #define RADIAN 57.3	/* radians per degree */
 struct seg {
diff --git a/src/lib9/sysfatal.c b/src/lib9/sysfatal.c
index 33a533b..00229db 100644
--- a/src/lib9/sysfatal.c
+++ b/src/lib9/sysfatal.c
@@ -15,7 +15,7 @@
 	va_end(arg);
 
 	__fixargv0();
-	fprint(2, "%s; %s\n", argv0 ? argv0 : "<prog>", buf);
+	fprint(2, "%s: %s\n", argv0 ? argv0 : "<prog>", buf);
 	exits("fatal");
 }
 
diff --git a/src/lib9p/file.c b/src/lib9p/file.c
index 79a8a11..6259a9c 100644
--- a/src/lib9p/file.c
+++ b/src/lib9p/file.c
@@ -254,6 +254,18 @@
 	free(os);
 	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*
 alloctree(char *uid, char *gid, ulong mode, void (*destroy)(File*))
@@ -281,7 +293,7 @@
 
 	muid = estrdup9p(uid);
 
-	f->dir.qid = (Qid){0, 0, QTDIR};
+	f->dir.qid = mkqid(0, 0, QTDIR);
 	f->dir.length = 0;
 	f->dir.atime = f->dir.mtime = time(0);
 	f->dir.mode = DMDIR | mode;
diff --git a/src/libflate/deflate.c b/src/libflate/deflate.c
index 3a55af3..6f01778 100644
--- a/src/libflate/deflate.c
+++ b/src/libflate/deflate.c
@@ -535,7 +535,7 @@
 	if(n && lz->w){
 		nw = (*lz->w)(lz->wr, buf, n);
 		if(nw != n){
-			lz->w = nil;
+			lz->w = 0;
 			lz->wbad = 1;
 		}else
 			lz->totw += n;
diff --git a/src/libhtml/runetab.c b/src/libhtml/runetab.c
index abd0a50..5fe0158 100644
--- a/src/libhtml/runetab.c
+++ b/src/libhtml/runetab.c
@@ -57,7 +57,7 @@
 
 	rtab = emalloc(n*sizeof(rtab[0]));
 	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;
 }
 
@@ -69,7 +69,7 @@
 
 	stab = emalloc(n*sizeof(stab[0]));
 	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;
 	}
 	return stab;
diff --git a/src/libmach/machpower.c b/src/libmach/machpower.c
index f1288fc..c704be7 100644
--- a/src/libmach/machpower.c
+++ b/src/libmach/machpower.c
@@ -663,7 +663,7 @@
 
 #define	OEM	IBF(~0,22,30)
 #define	FP4	IBF(~0,26,30)
-#define	ALL	(~0)
+#define ALL	((ushort)~0)
 /*
 notes:
 	10-26: crfD = rD>>2; rD&3 mbz
diff --git a/src/libmach/symstabs.c b/src/libmach/symstabs.c
index 8c1ddac..07bbd9f 100644
--- a/src/libmach/symstabs.c
+++ b/src/libmach/symstabs.c
@@ -249,7 +249,7 @@
 			/* create new symbol, add it */
 			if(stabcvtsym(&sym, &s, dir, file, i) < 0)
 				continue;
-			if(addsym(fp, &s) < 0)
+			if(addsym(fp, &s) == nil)
 				goto err;
 			break;
 		}
diff --git a/src/libthread/create.c b/src/libthread/create.c
index 518eaae..a8647f9 100644
--- a/src/libthread/create.c
+++ b/src/libthread/create.c
@@ -25,7 +25,7 @@
 		sysfatal("bad stacksize %d", stacksize);
 	t = _threadmalloc(sizeof(Thread), 1);
 	s = _threadmalloc(stacksize, 0);
-	t->stk = (char*)s;
+	t->stk = (uchar*)s;
 	t->stksize = stacksize;
 	_threaddebugmemset(s, 0xFE, stacksize);
 	_threadinitstack(t, f, arg);
diff --git a/src/libthread/sched.c b/src/libthread/sched.c
index 250a19a..d193d6c 100644
--- a/src/libthread/sched.c
+++ b/src/libthread/sched.c
@@ -1,3 +1,4 @@
+#include <u.h>
 #include <signal.h>
 #include <errno.h>
 #include "threadimpl.h"