hlfw.ca

x9dev

Download patch

ref: 21bb2953707254e2b7aa5f8c9bcfcacad32989ec
parent: a1500f0da30314afbdad648f2324f51fea1625e6
parent: 028e3beae75ff7dcb926daa9361a06839a457b38
author: Michael Misch <michealmisch1985@gmail.com>
date: Tue Jul 27 12:19:56 PDT 2021

Merge branch 'main' of github.com:halfwit/x9dev

--- a/README.md
+++ b/README.md
@@ -2,22 +2,13 @@
 
 __*THIS IS A WORK IN PROGRESS*__
 
- - this is still in the design phase, though some code exists; no draw calls have been written yet.
- 
 x9dev is an x11 server which interacts with plan9's /dev filesystem.
-This started as a fork of http://plan9.stanleylieber.com/pkg/386/equis-2012.01.11.tbz
+This started as a fork of [equis](http://plan9.stanleylieber.com/pkg/386/equis-2012.01.11.tbz)
 
 ## Usage
 
-`x9dev [-u] [-s screen]`
+`x9dev [-D]` should be ran in a chroot, where your plan9 /dev/draw has been imported.
 
-- `-u` creates a unique session
-- `-s screen` attaches to a named session
-
-`x9dev` is meant to be called via an external dial implementation. For example, with x9srv on a POSIX system
-
-`tlsclient 'tcp!192.168.1.2!17019' x9dev`
-
 ## Building
 
 Requires plan9port
@@ -36,9 +27,9 @@
 meson configure build/ -Dbuild_x9dev=true
 # Here you'd also tune to your system, see `meson configure build/` for a list of tunable options
 # Build
-ninja -C build -j 8 # or however many processors you have
+ninja -C build
 
-install -m644 hw/x9dev /usr/local/bin/x9dev
+install -m644 build/hw/x9dev/src/x9dev /usr/local/bin/x9dev
 ```
 
 ## Extensions
--- a/draw/draw.h
+++ b/draw/draw.h
@@ -342,7 +342,7 @@
 extern int	freeimage(Image*);
 extern int	_freeimage1(Image*);
 extern int	geninitdraw(char*, void(*)(Display*, char*), char*, char*, int);
-extern int	initdraw(void(*)(Display*, char*), char*, char*);
+extern int	initdraw(void(*)(Display*, char*), char*);
 extern int	newwindow(char*);
 extern Display*	initdisplay(char*, char*, void(*)(Display*, char*));
 extern int	loadimage(Image*, Rectangle, uchar*, int);
--- a/draw/init.c
+++ b/draw/init.c
@@ -109,8 +109,8 @@
 int
 initdraw(void(*error)(Display*, char*), char *chroot, char *label)
 {
-	char *dev;
-	sprintf(dev, "%s/dev/", chroot);
+	static char dev[] = "/dev";
+
 	return geninitdraw(dev, error, label, dev, Refnone);
 }
 
--- a/x9dev.c
+++ b/x9dev.c
@@ -28,8 +28,8 @@
 #include <errno.h>
 #include "x9dev.h"
 
+char *chroot;
 extern x9devInfo x9di;
-char *root = "/";
 int debug = 0;
 
 void
@@ -38,7 +38,7 @@
     int fd;
     char path[256]; /* Plan9 Maxpath */
 
-    if(initdraw(NULL, root, "x9dev") < 0)
+    if(initdraw(NULL, "x9dev") < 0)
         FatalError("can't open display");
 
     x9di.depth = screen->depth;
@@ -104,11 +104,6 @@
     if (!strcmp(argv[i], "-D")){
         debug++;
         return 1;
-    } else if (!strcmp(argv[i], "-p")){
-        if (argc <= i){
-            sprintf(root, "%s", argv[i+1]);
-            root = argv[i+1];
-        }
     }
 
     return 0;