summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-13 00:57:28 +0200
committerMiguel <m.i@gmx.at>2018-10-13 00:57:28 +0200
commit279f3336a8f6b31ca38bdd272c73aebd68fa88fe (patch)
treeb4bb4a21a4acf38eb810768ac6c1b099e2f18a58 /fs
parentb461c3558b2fe765a4bac512638b0acf5185b4bb (diff)
ncurses arrow keys working etc
Diffstat (limited to 'fs')
-rw-r--r--fs/fd.c8
-rw-r--r--fs/fifo.c4
-rw-r--r--fs/fifo.h2
-rw-r--r--fs/stdstreams.c1
4 files changed, 15 insertions, 0 deletions
diff --git a/fs/fd.c b/fs/fd.c
index 740bf35..a9ca63a 100644
--- a/fs/fd.c
+++ b/fs/fd.c
@@ -246,6 +246,8 @@ int fds_from_pipe(fd pipefds[2])
mem+=4;
*mem=1;
+ read.can_write=0;
+
read.read=pipe_get;
wrt.read=0;
@@ -312,6 +314,11 @@ fd fd_from_sysfs(void(*g)(ringbuffer *r,void (*f)(ringbuffer *r,char *fmt, ...))
return f;
}
+bool fifo_can_write(fifo *f)
+{
+ return !(f->full(f->data));
+}
+
fd fd_from_fifo(fifo* fif)
{
fd f;
@@ -323,5 +330,6 @@ fd fd_from_fifo(fifo* fif)
f.has=fifo_has;
f.dupl=default_dupl;
f.close=default_close;
+ f.can_write=fifo_can_write;
return f;
}
diff --git a/fs/fifo.c b/fs/fifo.c
index abd6c46..e5e071d 100644
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -14,3 +14,7 @@ bool fifo_has(fifo* f)
{
return f->has(f->data);
}
+bool fifo_full(fifo* f)
+{
+ return f->full(f->data);
+}
diff --git a/fs/fifo.h b/fs/fifo.h
index 92f3b75..27af389 100644
--- a/fs/fifo.h
+++ b/fs/fifo.h
@@ -11,6 +11,7 @@ typedef struct fifo_struct
bool (*put)(struct fifo_struct*,uint8_t);
uint8_t (*get)(struct fifo_struct*);
bool (*has)(struct fifo_struct*);
+ bool (*full)(struct fifo_struct*);
void *data; // opaque data
}fifo;
@@ -18,6 +19,7 @@ typedef struct fifo_struct
bool fifo_put(fifo*,uint8_t);
uint8_t fifo_get(fifo*);
bool fifo_has(fifo*);
+bool fifo_full(fifo*);
fifo fifo_create_buffered(uint8_t size);
#endif
diff --git a/fs/stdstreams.c b/fs/stdstreams.c
index 1cb9402..e5a2a08 100644
--- a/fs/stdstreams.c
+++ b/fs/stdstreams.c
@@ -52,5 +52,6 @@ fd fd_from_ringbuffer()
f->put=ringbuffer_put;
f->get=ringbuffer_get;
f->has=ringbuffer_has;
+ f->full=ringbuffer_full;
return fd_from_fifo(f);
}