commit 1d169d82463f208e31ade6b646a8c1f1f4e69a30
parent 19b2ac16e6c4001e0779c06bca684cb63622d0e0
Author: leitner <leitner>
Date: Sat, 15 Mar 2003 00:57:42 +0000
add minit-graph from Tommi Virtanen (output ps dependency graph)
Diffstat:
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/byte.h b/byte.h
@@ -1,14 +1,16 @@
#ifndef BYTE_H
#define BYTE_H
+#ifdef __dietlibc__
#include <sys/cdefs.h>
+#endif
#ifndef __pure__
#define __pure__
#endif
/* byte_chr returns the smallest integer i between 0 and len-1
- * inclusive such that one[i] equals needle, or len it not found. */
+ * inclusive such that one[i] equals needle, or len if not found. */
unsigned int byte_chr(const void* haystack, unsigned int len, char needle) __pure__;
/* byte_rchr returns the largest integer i between 0 and len-1 inclusive
diff --git a/contrib/minit-graph b/contrib/minit-graph
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+# Contributed by Tommi Virtanen <[email protected]>
+# Try:
+# minit-graph /etc/minit >foo.dot
+# dot -Tps -o foo.ps foo.dot
+# gv foo.ps
+
+import os, errno, string
+
+def safe(s):
+ r=""
+ for c in s:
+ if c not in "abcdefghijklmnopqrstuvwxyz0123456789_":
+ c="_"
+ r+=c
+ return r
+
+import sys
+try:
+ dir = sys.argv[1]
+except IndexError:
+ dir = '.'
+
+print "digraph minit {"
+
+for svc in os.listdir(dir):
+ if svc=="in" or svc=="out":
+ continue
+ if os.path.exists(os.path.join(dir, svc, "sync")):
+ print "%s [shape=box];"%safe(svc)
+ else:
+ print "%s;"%safe(svc)
+ try:
+ file = open(os.path.join(dir, svc, "depends"))
+ except IOError, e:
+ if e.errno == errno.ENOENT:
+ pass
+ else:
+ raise
+ else:
+ for dep in file.xreadlines():
+ print "%s -> %s;" % (safe(svc), safe(dep.strip()))
+ file.close()
+
+print "};"
+
diff --git a/str.h b/str.h
@@ -1,7 +1,9 @@
#ifndef STR_H
#define STR_H
+#ifdef __dietlibc__
#include <sys/cdefs.h>
+#endif
#ifndef __pure__
#define __pure__
#endif