From dce3a7a42d585b74ce68081010b42afe81c8f4c4 Mon Sep 17 00:00:00 2001 From: Vladimir Dronnikov Date: Fri, 16 Oct 2009 16:25:19 +1100 Subject: md: drivers/md/unroll.pl replaced with awk analog drivers/md/unroll.pl replaced by awk script to drop build-time dependency on perl Signed-off-by: Vladimir Dronnikov Signed-off-by: NeilBrown --- drivers/md/unroll.awk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 drivers/md/unroll.awk (limited to 'drivers/md/unroll.awk') diff --git a/drivers/md/unroll.awk b/drivers/md/unroll.awk new file mode 100644 index 0000000..c6aa036 --- /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 + } +} -- cgit v1.1