aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-05-27 22:01:58 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-05-27 22:01:58 -0400
commit945e882abbb877e704a17651c1e7e633fe668a7f (patch)
tree81d639b7822af19395fca79c5c38ea7cbb133846
parenta98c7d4ef01272e02d5cacec49a902d5da188d22 (diff)
string literal root idents unprinted link
-rw-r--r--nodelink.c4
-rw-r--r--read.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/nodelink.c b/nodelink.c
index 0aea005..2838593 100644
--- a/nodelink.c
+++ b/nodelink.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include "nodelink.h"
#include "strbst.h"
@@ -29,7 +30,8 @@ static void printeach(strbstnode* loc, char reprint) {
// loc->ind is the name of the connection and loc->data the link
if (!reprint) printf(" "); // indent on subnode
printlink(loc->ind, loc->data); // prints it
- if (reprint) { // and their subnodes if iterating over root tree
+ // and subnodes if iterating over root tree (except root link)
+ if (reprint && strcmp(loc->ind,"root")) {
// prints the link's target's link tree
printeach( ( (link*)loc->data)->to->links->head, 0);
}
diff --git a/read.c b/read.c
index cd71702..b1b4789 100644
--- a/read.c
+++ b/read.c
@@ -94,7 +94,7 @@ node* readfile(char* name) {
FILE* read = fopen(name, "r");
node *root, *cur;
cur = root = newnode();
- link* curl = addbstlink(root->links, name, root);
+ link* curl = addbstlink(root->links, "root", root);
llnode start;
start.next = NULL; // empty desc isn't undefined