aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorc+12023-11-17 10:59:06 -0500
committerc+12023-11-17 10:59:06 -0500
commit7be0923d486cd6ed2e304d3673146563ad677ea7 (patch)
tree793ec2091f778e214f947854d4240af6f13db298
parentcd294fb6188ee26caac8c78353f34e757dfd3b10 (diff)
Minor tweaks to cli
-rw-r--r--Makefile2
-rw-r--r--src/include/tree.h6
-rw-r--r--src/source.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 05525e7..a2b1bd7 100644
--- a/Makefile
+++ b/Makefile
@@ -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;
}