aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/unroll.awk
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-12-04 14:59:47 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-12-04 14:59:47 +0000
commit5cb2faa6ede7ada9cb2bffc832c4ce60f53d6834 (patch)
tree7b72b66081d042a41dc822575503133364857ce2 /drivers/md/unroll.awk
parente0ee98513d1a2e24d2ddbdecf4216bcca29d1158 (diff)
parent6060e8df517847bf445ebc61de7d4d9c7faae990 (diff)
Merge branch 'pending-misc' (early part) into devel
Diffstat (limited to 'drivers/md/unroll.awk')
-rw-r--r--drivers/md/unroll.awk20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/md/unroll.awk b/drivers/md/unroll.awk
new file mode 100644
index 00000000000..c6aa03631df
--- /dev/null
+++ b/drivers/md/unroll.awk
@@ -0,0 +1,20 @@
+
+# This filter requires one command line option of form -vN=n
+# where n must be a decimal number.
+#
+# Repeat each input line containing $$ n times, replacing $$ with 0...n-1.
+# Replace each $# with n, and each $* with a single $.
+
+BEGIN {
+ n = N + 0
+}
+{
+ if (/\$\$/) { rep = n } else { rep = 1 }
+ for (i = 0; i < rep; ++i) {
+ tmp = $0
+ gsub(/\$\$/, i, tmp)
+ gsub(/\$\#/, n, tmp)
+ gsub(/\$\*/, "$", tmp)
+ print tmp
+ }
+}