all: replace graphical interface with text interface

This commit is contained in:
David du Colombier 2017-07-24 16:19:17 +02:00
parent 279e1332c4
commit ff042867bb
5 changed files with 28 additions and 62 deletions

View File

@ -18,10 +18,6 @@ LIBS1=\
libauthsrv/libauthsrv.a\
libsec/libsec.a\
libmp/libmp.a\
libmemdraw/libmemdraw.a\
libmemlayer/libmemlayer.a\
libdraw/libdraw.a\
gui-$(GUI)/libgui.a\
libc/libc.a\
libip/libip.a\
@ -56,20 +52,8 @@ libmp/libmp.a:
libsec/libsec.a:
(cd libsec; $(MAKE))
libmemdraw/libmemdraw.a:
(cd libmemdraw; $(MAKE))
libmemlayer/libmemlayer.a:
(cd libmemlayer; $(MAKE))
libdraw/libdraw.a:
(cd libdraw; $(MAKE))
libc/libc.a:
(cd libc; $(MAKE))
libip/libip.a:
(cd libip; $(MAKE))
gui-$(GUI)/libgui.a:
(cd gui-$(GUI); $(MAKE))

View File

@ -11,13 +11,11 @@ OFILES=\
devaudio.$O\
devaudio-$(AUDIO).$O\
devcons.$O\
devdraw.$O\
devfs-$(OS).$O\
devip.$O\
devip-$(OS).$O\
devlfd.$O\
devmnt.$O\
devmouse.$O\
devpipe.$O\
devroot.$O\
devssl.$O\
@ -35,7 +33,6 @@ OFILES=\
sysproc.$O\
qio.$O\
qlock.$O\
term.$O\
uart.$O\
waserror.$O\
$(OS).$O

View File

@ -466,7 +466,6 @@ enum{
Qreboot,
Qsecstore,
Qshowfile,
Qsnarf,
Qswap,
Qsysname,
Qsysstat,
@ -500,7 +499,6 @@ static Dirtab consdir[]={
"reboot", {Qreboot}, 0, 0664,
"secstore", {Qsecstore}, 0, 0666,
"showfile", {Qshowfile}, 0, 0220,
"snarf", {Qsnarf}, 0, 0666,
"swap", {Qswap}, 0, 0664,
"sysname", {Qsysname}, 0, 0664,
"sysstat", {Qsysstat}, 0, 0666,
@ -511,7 +509,6 @@ static Dirtab consdir[]={
char secstorebuf[65536];
Dirtab *secstoretab = &consdir[Qsecstore];
Dirtab *snarftab = &consdir[Qsnarf];
int
readnum(ulong off, char *buf, ulong n, ulong val, int size)
@ -611,15 +608,6 @@ consopen(Chan *c, int omode)
if(omode != OREAD)
memset(secstorebuf, 0, sizeof secstorebuf);
break;
case Qsnarf:
if(omode == ORDWR)
error(Eperm);
if(omode == OREAD)
c->aux = strdup("");
else
c->aux = mallocz(SnarfSize, 1);
break;
}
return c;
}
@ -645,12 +633,6 @@ consclose(Chan *c)
qhangup(kprintoq, nil);
}
break;
case Qsnarf:
if(c->mode == OWRITE)
clipwrite(c->aux);
free(c->aux);
break;
}
}
@ -756,15 +738,6 @@ consread(Chan *c, void *buf, long n, vlong off)
case Qnull:
return 0;
case Qsnarf:
if(offset == 0){
free(c->aux);
c->aux = clipread();
}
if(c->aux == nil)
return 0;
return readstr(offset, buf, n, c->aux);
case Qsecstore:
return readstr(offset, buf, n, secstorebuf);
@ -925,13 +898,6 @@ conswrite(Chan *c, void *va, long n, vlong off)
case Qshowfile:
return showfilewrite(a, n);
case Qsnarf:
if(offset >= SnarfSize || offset+n >= SnarfSize)
error(Etoobig);
snarftab->qid.vers++;
memmove((uchar*)c->aux+offset, va, n);
return n;
case Qsysstat:
n = 0;
break;

View File

@ -9,8 +9,6 @@ extern Dev rootdevtab;
extern Dev pipedevtab;
extern Dev ssldevtab;
extern Dev tlsdevtab;
extern Dev mousedevtab;
extern Dev drawdevtab;
extern Dev ipdevtab;
extern Dev fsdevtab;
extern Dev mntdevtab;
@ -23,8 +21,6 @@ Dev *devtab[] = {
&pipedevtab,
&ssldevtab,
&tlsdevtab,
&mousedevtab,
&drawdevtab,
&ipdevtab,
&fsdevtab,
&mntdevtab,

33
main.c
View File

@ -9,6 +9,8 @@
char *argv0;
char *user;
void ttyinit(void);
extern int errfmt(Fmt*);
void
sizebug(void)
@ -40,18 +42,14 @@ main(int argc, char **argv)
osinit();
procinit0();
printinit();
screeninit();
chandevreset();
chandevinit();
quotefmtinstall();
ttyinit();
if(bind("#c", "/dev", MBEFORE) < 0)
panic("bind #c: %r");
if(bind("#m", "/dev", MBEFORE) < 0)
panic("bind #m: %r");
if(bind("#i", "/dev", MBEFORE) < 0)
panic("bind #i: %r");
if(bind("#I", "/net", MBEFORE) < 0)
panic("bind #I: %r");
if(bind("#U", "/", MAFTER) < 0)
@ -124,3 +122,28 @@ findkey(char **puser, char *dom)
return nil;
}
#undef read
#undef write
#undef system
void
ttyputs(char *s, int n)
{
write(1, s, n);
}
void
ttyreader(void *arg)
{
char c;
while(read(0, &c, 1) == 1)
kbdputc(kbdq, c&0xff);
}
void
ttyinit(void)
{
screenputs = ttyputs;
kproc("tty", ttyreader, 0);
}