code: drawterm

Download patch

ref: 3bab3a220a585e32551bc3b8e3d2189cd9ee303b
parent: 5df8776cafe4ed614fa3c4a0f9e1e4f01de228de
author: Russ Cox <rsc@swtch.com>
date: Tue Aug 25 18:46:22 EDT 2009

win32 build; add -r option

--- a/cpu.c
+++ b/cpu.c
@@ -29,6 +29,7 @@
 static char	*system;
 static int	cflag;
 extern int	dbg;
+extern char*	base;	// fs base for devroot
 
 static char	*srvname = "ncpu";
 static char	*ealgs = "rc4_256 sha1";
@@ -146,11 +147,14 @@
 	case 'k':
 		keyspec = EARGF(usage());
 		break;
-	case 'u':
-		user = EARGF(usage());
+	case 'r':
+		base = EARGF(usage());
 		break;
 	case 's':
 		secstoreserver = EARGF(usage());
+		break;
+	case 'u':
+		user = EARGF(usage());
 		break;
 	default:
 		usage();
--- a/kern/devdraw.c
+++ b/kern/devdraw.c
@@ -1312,7 +1312,7 @@
 		SET(p);
 		USED(fmt);
 		USED(a);
-		USED(buf);
+		p = buf;
 		USED(p);
 		USED(q);
 		USED(s);
--- a/kern/devfs-win32.c
+++ b/kern/devfs-win32.c
@@ -1,3 +1,8 @@
+/*
+ * Disable Unicode until the calls to FindFirstFile etc
+ * are changed to use wide character strings.
+ */
+#undef UNICODE
 #include	<windows.h>
 #include	<sys/types.h>
 #include	<sys/stat.h>
@@ -593,7 +598,7 @@
 		d.length = stbuf.st_size;
 		d.type = 'U';
 		d.dev = c->dev;
-		n = convD2M(&d, (char*)va+i, count-i);
+		n = convD2M(&d, (uchar*)va+i, count-i);
 		if(n == BIT16SZ){
 			strcpy(uif->nextname, de);
 			break;
@@ -634,7 +639,7 @@
 		if(FindNextFile(d->handle, &d->wfd) == FALSE)
 			return 0;
 	}
-	strcpy(name, d->wfd.cFileName);
+	strcpy(name, (char*)d->wfd.cFileName);
 	d->index++;
 
 	return 1;
--- a/kern/devip-win32.c
+++ b/kern/devip-win32.c
@@ -178,7 +178,7 @@
 
 	he = gethostbyname(host);
 	if(he != 0 && he->h_addr_list[0]) {
-		p = he->h_addr_list[0];
+		p = (uchar*)he->h_addr_list[0];
 		sprint(buf, "%ud.%ud.%ud.%ud", p[0], p[1], p[2], p[3]);
 	} else
 		strcpy(buf, host);