shithub: riscv

Download patch

ref: 9e8e4444a3856877ed7632fb3a878a014ced994f
parent: d9c61762450f5371bd0fef4df7190efff6c4f341
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 4 17:22:00 EDT 2023

libndb: make ndbipinfo() put each ip and attributes entry on its own line

this groups attriutes specific for a ip on the same line
as the ip= attribute.

this was previously not visible as ipquery ignores
the line structure.

--- a/sys/src/libndb/ndbipinfo.c
+++ b/sys/src/libndb/ndbipinfo.c
@@ -154,6 +154,20 @@
 }
 
 static Ndbtuple*
+ndbline(Ndbtuple *t)
+{
+	Ndbtuple *nt;
+
+	for(nt = t; nt != nil; nt = nt->entry){
+		if(nt->entry == nil)
+			nt->line = t;
+		else
+			nt->line = nt->entry;
+	}
+	return t;
+}
+
+static Ndbtuple*
 netinfo(Ndb *db, Ndbtuple *t, char **alist, int n)
 {
 	uchar ip[IPaddrlen], net[IPaddrlen];
@@ -219,7 +233,7 @@
 
 	ndbfree(f);
 	ndbsetmalloctag(t, getcallerpc(&db));
-	return t;
+	return ndbline(t);
 }
 
 /*