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 <dronnikov@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Vladimir Dronnikov
2009-10-16 16:25:19 +11:00
committed by NeilBrown
parent ae8fa2831b
commit dce3a7a42d
6 changed files with 54 additions and 58 deletions

20
drivers/md/unroll.awk Normal file
View File

@@ -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
}
}