aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/tree.h6
-rw-r--r--src/source.c10
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;
}