commit 5487fb548d58061299f0cf54269f34f6e24459a1
parent 1b8ac46d900edb841a3b4f82c049936f81d30dea
Author: Pavel Renev <an2qzavok@gmail.com>
Date: Sat, 14 Sep 2024 23:35:18 +0000
src/wdb: bugfixes probably
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/wdb/new b/src/wdb/new
@@ -6,7 +6,7 @@ id=`{uuid}
file=$home/lib/wdb/data/$id
cat > $file <<EOF
-{ $uuid
+{ $id
{ name
.n unnamed
}
diff --git a/src/wdb/search.c b/src/wdb/search.c
@@ -15,7 +15,7 @@ enum{
ListSize = 256,
};
-int tagsqn, typeqn;
+int linecount, tagsqn, typeqn;
char *buf, *tagsquery[MaxTags + 1], *typequery[MaxTags + 1], *tagslist[MaxTags];
FLTNode *uuid, *name, *tags, *type;
Reprog *re;
@@ -127,10 +127,14 @@ testtype(FLTP *){
void
runtests(FLTP *fltp){
+ char buf[256];
if (testname(fltp) == 0) return;
if (testtags(fltp) == 0) return;
if (testtype(fltp) == 0) return;
- print("%.*s\n", (int)(uuid->parent->next->nbytes), AFTER(uuid->parent->next));
+ sprint(buf, "%.*s\n", (int)(uuid->parent->next->nbytes), AFTER(uuid->parent->next));
+ if(buf[0] == '{') sysfatal("parser lost the plot :%d", linecount);
+ print(buf);
+
}
void
@@ -179,6 +183,7 @@ loadindex(void){
wdb->wp = nw;
bfd = Bfdopen(0, OREAD);
while((bp = Brdline(bfd, '\n')) != nil){
+ linecount++;
evalfltp(wdb, bp, Blinelen(bfd));
}
Bterm(bfd);