diff options
author | c+1 | 2023-11-17 10:59:06 -0500 |
---|---|---|
committer | c+1 | 2023-11-17 10:59:06 -0500 |
commit | 7be0923d486cd6ed2e304d3673146563ad677ea7 (patch) | |
tree | 793ec2091f778e214f947854d4240af6f13db298 /src | |
parent | cd294fb6188ee26caac8c78353f34e757dfd3b10 (diff) |
Minor tweaks to cli
Diffstat (limited to 'src')
-rw-r--r-- | src/include/tree.h | 6 | ||||
-rw-r--r-- | src/source.c | 10 |
2 files changed, 15 insertions, 1 deletions
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; } |