diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/include/tree.h | 6 | ||||
-rw-r--r-- | src/source.c | 10 |
3 files changed, 16 insertions, 2 deletions
@@ -47,6 +47,6 @@ me a: @exit sandwich: - @[ $(id -u) -eq 0 ] && echo "Okay." || echo "What? Make(1) it yourself." + @[ "${USER}" = "root" ] && echo "Okay." || echo "What? Make(1) it yourself." .PHONY: all reg_options dbg_options dbg install uninstall clean diff --git a/src/include/tree.h b/src/include/tree.h index d529bff..fa64fce 100644 --- a/src/include/tree.h +++ b/src/include/tree.h @@ -64,4 +64,10 @@ typedef struct TREE { tree_t* tree_init(int type); void tree_destroy(tree_t* tree); +/* TODO: + + Array of targets, for now just linear but implement something better in the future + tree_targ_t struct contains pointer to a tree_t +*/ + #endif diff --git a/src/source.c b/src/source.c index d0c39b3..f5f3ab1 100644 --- a/src/source.c +++ b/src/source.c @@ -31,10 +31,18 @@ char* source_get_from_fpath(char* path) { char* source_get_from_stdin() { char* src; + size_t l; src = ecalloc(256, sizeof(char)); + l = 0; - src = fgets(src, 256, stdin); + while (fgets(src + l, 20, stdin) != NULL) { + l += strlen(src + l); + } + + (src[l - 1] == '\n') && (src[l - 1] = '\0'); + +// src = fgets(src, 256, stdin); return src; } |