| 1 | #!/usr/bin/env bash |
| 2 | lines=${XCCDF_VALUE_LINES} |
| 3 | |
| 4 | # padding numbers so one line is exactly 10 bytes - 9 numbers and newline |
| 5 | # this way last line prints size of the output |
| 6 | |
| 7 | case $(uname) in |
| 8 | |
| 9 | # FreeBSD's seq is significantly slower than GNU's seq, in order |
| 10 | # to work around this, we just print 10 bytes without the count in |
| 11 | # each loop and only output the loop count at the very end. This |
| 12 | # should still properly test streaming a lot of data into stdin |
| 13 | # and stdout like the original test on Linux was designed to do. |
| 14 | FreeBSD) |
| 15 | padlength=5 |
| 16 | |
| 17 | for i in `seq ${lines}`; do |
| 18 | echo "000000000" |
| 19 | done |
| 20 | |
| 21 | strlen=$(echo $i | wc -c) |
| 22 | strlen=$((strlen-2)) |
| 23 | printf '0%*.*s0%s0\n' 0 $((padlength - strlen)) "$pad" "$i" |
| 24 | |
| 25 | for i in `seq ${lines}`; do |
| 26 | echo "100000000" >&2 |
| 27 | done |
| 28 | |
| 29 | strlen=$(echo $i | wc -c) |
| 30 | strlen=$((strlen-2)) |
| 31 | printf '1%*.*s0%s0\n' 0 $((padlength - strlen)) "$pad" "$i" |
| 32 | ;; |
| 33 | *) |
| 34 | for i in `seq -w 0000001 ${lines}`; do |
| 35 | echo "0${i}0" |
| 36 | done |
| 37 | |
| 38 | for i in `seq -w 0000001 ${lines}`; do |
| 39 | echo "1${i}0" >&2 |
| 40 | done |
| 41 | ;; |
| 42 | esac |
| 43 | |
| 44 | exit ${XCCDF_RESULT_PASS} |