diff options
author | Vladimir Dronnikov <dronnikov@gmail.com> | 2009-10-16 16:25:19 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-10-16 16:25:19 +1100 |
commit | dce3a7a42d585b74ce68081010b42afe81c8f4c4 (patch) | |
tree | e80cd4f574aa4df481bb3000b35a49d0debc85b2 /drivers/md/unroll.awk | |
parent | ae8fa2831bbc5092ee9d1b90e623af881cf27140 (diff) |
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>
Diffstat (limited to 'drivers/md/unroll.awk')
-rw-r--r-- | drivers/md/unroll.awk | 20 |
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 + } +} |