summaryrefslogtreecommitdiffstats
path: root/tools/sed-structs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sed-structs')
-rw-r--r--tools/sed-structs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/sed-structs b/tools/sed-structs
new file mode 100644
index 0000000..1b7afdf
--- /dev/null
+++ b/tools/sed-structs
@@ -0,0 +1,14 @@
+
+s/^\s*typedef\s+struct\s+(\w+)\s+(\w+)\s*;.*$/typedef struct \1 \2;/
+t finish
+/^\s*typedef\s+struct.*[^;].*/ ! b
+h
+:loop
+n
+/^\s*\}/ ! b loop
+s/^\s*\}\s*(\w+)\s*;.*$/\1;/
+H;x
+s/\n/ /g
+:finish
+s/ {2,}/ /g
+p