summaryrefslogtreecommitdiff
path: root/shed.c
diff options
context:
space:
mode:
Diffstat (limited to 'shed.c')
-rw-r--r--shed.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/shed.c b/shed.c
index c010cb1..2cf1b54 100644
--- a/shed.c
+++ b/shed.c
@@ -22,13 +22,23 @@ struct shed *shed(struct shed *e)
if (e->cur == NULL) {
e->cur = calloc(1, sizeof(*e->cur));
if (e->cur == NULL) {
+ /* FIXME */
return e;
}
e->handle = shed_handle_non_vi;
+ e->head = e->cur;
+ e->tail = e->cur;
+ } else {
+ e->tail->next = calloc(1, sizeof(*e->cur));
+ if (e->tail->next == NULL) {
+ /* FIXME */
+ return e;
+ }
+ e->tail->next->prev = e->tail;
+ e->tail = e->tail->next;
+ e->cur = e->tail;
}
- memset(e->cur, '\0', sizeof(*e->cur));
-
struct termios original_tio;
if (tcgetattr(STDIN_FILENO, &original_tio) != 0) {
e->cur = NULL;