diff blobstat/output.c @ 294:ff2a6433687f

blobstat: code finished, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 21 Sep 2019 21:17:29 +0000
parents
children 99f72069d867
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/blobstat/output.c	Sat Sep 21 21:17:29 2019 +0000
@@ -0,0 +1,20 @@
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "struct.h"
+
+extern struct category *category_list;
+
+print_output()
+{
+	struct category *p;
+	u_long total = 0;
+
+	for (p = category_list; p; p = p->next)
+		total += p->accum;
+	printf("total: 0x%lX (%lu) bytes\n", total, total);
+	for (p = category_list; p; p = p->next)
+		printf("%s: 0x%lX (%lu) bytes, %u%% of total\n", p->accum,
+			p->accum, p->accum * 100 / total);
+	return(0);
+}