ref: 0748e023cf5eb117f0fa8b68cc0a8c9602e17bba
parent: 9383debbbe85a800aa0c0e5bd49e764f10228b47
author: aiju <devnull@localhost>
date: Tue Jul 3 19:04:12 EDT 2018
add guimain() and cpubody() indirection to allow for osx cocoa port
--- a/cpu.c
+++ b/cpu.c
@@ -39,6 +39,8 @@
char *user, *pass;
char secstorebuf[65536];
+extern void guimain(void);
+
char*
estrdup(char *s)
{
@@ -235,10 +237,14 @@
exits("usage");
}
+static char *cmd;
+
+extern void cpubody(void);
+
void
cpumain(int argc, char **argv)
{
- char *s, *cmd = nil;
+ char *s;
user = getenv("USER");
pass = getenv("PASS");
@@ -303,7 +309,18 @@
if(argc != 0)
usage();
- if(!nogfx) {
+ if(!nogfx)
+ guimain();
+ else
+ cpubody();
+}
+
+void
+cpubody(void)
+{
+ char *s;
+
+ if(!nogfx){
if(bind("#i", "/dev", MBEFORE) < 0)
panic("bind #i: %r");
if(bind("#m", "/dev", MBEFORE) < 0)
@@ -311,7 +328,6 @@
if(cmd == nil)
atexit(ending);
}
-
if(bind("/root", "/", MAFTER) < 0)
panic("bind /root: %r");
--- a/gui-osx/screen.c
+++ b/gui-osx/screen.c
@@ -740,3 +740,9 @@
{
InitCursor();
}
+
+void
+guimain(void)
+{
+ cpubody();
+}
--- a/gui-win32/screen.c
+++ b/gui-win32/screen.c
@@ -693,3 +693,9 @@
FlushConsoleInputBuffer(h);
_setmode(0, raw? _O_BINARY: _O_TEXT);
}
+
+void
+guimain(void)
+{
+ cpubody();
+}
--- a/gui-x11/x11.c
+++ b/gui-x11/x11.c
@@ -1200,3 +1200,9 @@
t.c_lflag |= (ECHO|ICANON);
tcsetattr(0, TCSAFLUSH, &t);
}
+
+void
+guimain(void)
+{
+ cpubody();
+}
--- a/kern/screen.h
+++ b/kern/screen.h
@@ -63,3 +63,5 @@
void mouseresize(void);
void mousetrack(int, int, int, ulong);
void absmousetrack(int, int, int, ulong);
+void cpubody(void);
+void guimain(void);