| 1 | #!/usr/bin/envscip-shell filesystem . . `/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 $(unamescip-shell system . . 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 `seqscip-shell system . . seq. ${lines}`; do |
| 18 | echoscip-shell system . . echo. "000000000" |
| 19 | done |
| 20 | |
| 21 | strlen=$(echoscip-shell system . . echo. $i | wcscip-shell system . . wc. -c) |
| 22 | strlen=$((strlen-2)) |
| 23 | printfscip-shell system . . printf. '0%*.*s0%s0\n' 0 $((padlength - strlen)) "$pad" "$i" |
| 24 | |
| 25 | for i in `seqscip-shell system . . seq. ${lines}`; do |
| 26 | echoscip-shell system . . echo. "100000000" >&2 |
| 27 | done |
| 28 | |
| 29 | strlen=$(echoscip-shell system . . echo. $i | wcscip-shell system . . wc. -c) |
| 30 | strlen=$((strlen-2)) |
| 31 | printfscip-shell system . . printf. '1%*.*s0%s0\n' 0 $((padlength - strlen)) "$pad" "$i" |
| 32 | ;; |
| 33 | *) |
| 34 | for i in `seqscip-shell system . . seq. -w 0000001 ${lines}`; do |
| 35 | echoscip-shell system . . echo. "0${i}0" |
| 36 | done |
| 37 | |
| 38 | for i in `seqscip-shell system . . seq. -w 0000001 ${lines}`; do |
| 39 | echoscip-shell system . . echo. "1${i}0" >&2 |
| 40 | done |
| 41 | ;; |
| 42 | esac |
| 43 | |
| 44 | exit ${XCCDF_RESULT_PASS} |