tlib9: allow no $DISPLAY on OS X in getns - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit e113e0a4bbc3024c43f008d17f618950b0ae20af
DIR parent 9142d36228acc954b289705244ce2477187091e9
HTML Author: Russ Cox <rsc@swtch.com>
Date: Mon, 30 Jun 2008 19:41:24 -0400
lib9: allow no $DISPLAY on OS X in getns
Diffstat:
M src/lib9/getns.c | 7 +++++++
1 file changed, 7 insertions(+), 0 deletions(-)
---
DIR diff --git a/src/lib9/getns.c b/src/lib9/getns.c
t@@ -29,8 +29,15 @@ nsfromdisplay(void)
char *disp, *p;
if((disp = getenv("DISPLAY")) == nil){
+#ifdef __APPLE__
+ // Might be running native GUI on OS X.
+ disp = strdup(":0.0");
+ if(disp == nil)
+ return nil;
+#else
werrstr("$DISPLAY not set");
return nil;
+#endif
}
/* canonicalize: xxx:0.0 => xxx:0 */