richterm

"terminal emulator" with support for text fonts and images for plan9
git clone git://nsmpr.xyz/richterm.git
Log | Files | Refs | README

commit 1064dcb9efa975594980410708ab7b4d52bda0e1
parent 922675fb154bde0363cf6b6e7fb8a0438262c88c
Author: glenda <glenda@9front.local>
Date:   Thu,  3 Jun 2021 19:16:32 +0000

preliminary fs.c

Diffstat:
Mfs.c | 37+++++++++++++++++++++++++++++++++++++
Mrichterm.c | 6+++++-
Mrichterm.h | 26++++++++++++++++++++------
3 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/fs.c b/fs.c @@ -0,0 +1,37 @@ +#include <u.h> +#include <libc.h> +#include <fcall.h> +#include <thread.h> +#include <9p.h> + +#include "richterm.h" + +File *new; + +void +fs_read(Req *r) +{ + respond(r, nil); +} + +void +fs_write(Req *r) +{ + respond(r, nil); +} + +Fsctl * +initfs(void) +{ + Fsctl *fsctl; + static Srv srv = { + .read = fs_read, + .write = fs_write, + }; + fsctl = mallocz(sizeof(Fsctl), 1); + fsctl->c = chancreate(sizeof(int), 0); + srv.tree = alloctree("richterm", "richterm", DMDIR|555, nil); + if (srv.tree == nil) return nil; + new = createfile(srv.tree->root, "new", "richterm", 0666, nil); + return fsctl; +} diff --git a/richterm.c b/richterm.c @@ -30,6 +30,8 @@ Channel *pidchan; Devfsctl *dctl; +Fsctl *fsctl; + Fonts fonts; void generatepage(Rectangle, Rich *); @@ -50,7 +52,9 @@ runcmd(void *args) if ((dctl = initdevfs()) == nil) sysfatal("initdevfs failed: %r"); - + if ((fsctl = initfs()) == nil) + sysfatal("initfs failed: %r"); + rfork(RFFDG); close(0); open("/dev/cons", OREAD); diff --git a/richterm.h b/richterm.h @@ -1,16 +1,12 @@ typedef struct Data Data; + struct Data { char *p; long size; }; -typedef struct Devfsctl Devfsctl; -struct Devfsctl { - Channel *rc; - Channel *wc; -}; - typedef struct Object Object; + struct Object { /* old fields */ char *type; @@ -25,4 +21,22 @@ struct Object { }; Data strtodata(char *); + + +typedef struct Devfsctl Devfsctl; + +struct Devfsctl { + Channel *rc; + Channel *wc; +}; + Devfsctl * initdevfs(void); + + +typedef struct Fsctl Fsctl; + +struct Fsctl { + Channel *c; +}; + +Fsctl * initfs(void);