summaryrefslogtreecommitdiff
path: root/test/API/separate.awk
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-04-13 16:14:14 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-04-13 16:35:41 +0200
commitd61066fcfe7f00843c4660182ea38ba3a5e41803 (patch)
tree1150d6abdf8943d3da6b3b8afcd8f7affb5a109d /test/API/separate.awk
parente90c33f951efc032ca23f48326343a83c0b54b10 (diff)
test: add API test
part1; Needs improvement: Think about a sensible way to map feature sets to the mandated syms. Our LEGACY stuff maps to OB, OBXSI for example. A "normal" config should satisfy the BASE (i.e. $foo.SUSv4.syms) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'test/API/separate.awk')
-rw-r--r--test/API/separate.awk48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/API/separate.awk b/test/API/separate.awk
new file mode 100644
index 000000000..f7850c4f4
--- /dev/null
+++ b/test/API/separate.awk
@@ -0,0 +1,48 @@
+#!/usr/bin/awk -f
+#
+# Usage: awk -f separate.awk foo.SUSv4.in
+# Input: http://www.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html#tag_13_77_03_06
+# Output: foo-$CODE.SUSv4.syms, foo.SUSv4.syms
+#
+# Copyright (C) 2010 Bernhard Reutner-Fischer
+# Public domain
+
+function get_code(line)
+{
+ sub("\\]\\[.*", "", line)
+ sub("\\[", "", line)
+ sub(" ", "", line)
+ return line
+}
+BEGIN{
+ code="";# feature set; XSI, OB XSI, CX, etc
+
+}
+/\[Option Start\]/{
+ code = get_code($0)
+ next
+}
+/\[Option End\]/{ code = ""; next; }
+/.*/ {
+ if (!hdrname) {
+ split(FILENAME, fparts, ".")
+ hdrname = fparts[1]
+ stdname = fparts[2]
+ if (fparts[3] != "in") {
+ print "inputfilename may not be ok, exiting."
+ exit(1)
+ }
+ }
+ if (code) {
+ fname = hdrname "-" code "." stdname ".syms"
+ } else {
+ fname = hdrname "." stdname ".syms"
+ }
+ sub("^*", "", $0)
+ if (file[code]) {
+ print $0 >> fname
+ } else {
+ print $0 > fname
+ file[code] = 1
+ }
+}