ref: 5a7732335f618f8cc7e96e28941bee126f6d0032
parent: 872b3e0905a1b89852de33a993506b60edc1ba97
author: sirjofri <sirjofri@sirjofri.de>
date: Sun Aug 31 04:55:45 EDT 2025
hide ipnet derived values by default, -i to show all values
--- a/dat.h
+++ b/dat.h
@@ -12,6 +12,8 @@
extern int pagewidth;
extern int pageheight;
+extern int showipnet;
+
struct Pos {int x;
int y;
--- a/draw.c
+++ b/draw.c
@@ -78,11 +78,21 @@
p1.x, p2.y);
}
+static int
+isipnet(Tuple *t)
+{+ return strcmp(t->key, "ipnet") == 0;
+}
+
static void
drawtuple(Tuple *t, void *aux)
{Pos *p = aux;
+ int ipnet = isipnet(t);
+ if (!showipnet && t->ipnet && !ipnet)
+ return;
+
drawtext(*p, 1, "%s%s: %s", t->ipnet ? "*" : "", t->key, t->value);
p->y -= lineheight;
}
@@ -105,6 +115,11 @@
Block *b = aux;
int w;
+ if (!showipnet && t->ipnet && !isipnet(t))
+ return;
+
+ b->height += lineheight;
+
w = strlen(t->key) + strlen(t->value) + 3;
if (w > b->width)
b->width = w;
@@ -114,7 +129,6 @@
setblocksize(Block *b)
{b->width = 0;
- b->height = lineheight * b->ntuples;
fortuple(b, tuplesize, b);
b->width *= charwidth;
}
--- a/netgraph.c
+++ b/netgraph.c
@@ -9,7 +9,7 @@
static void
usage(void)
{- fprint(2, "usage: %s [-s systuples]\n", argv0);
+ fprint(2, "usage: %s [-i] [-s systuples]\n", argv0);
exits("usage");}
@@ -24,6 +24,8 @@
int pagewidth = 1191;
int pageheight = 842;
+int showipnet = 0;
+
static void
procrequest(char *key, char *val)
{@@ -127,6 +129,9 @@
break;
case 'x':
netdir = EARGF(usage());
+ break;
+ case 'i':
+ showipnet++;
break;
}ARGEND;
--
⑨