Skip to content
Snippets Groups Projects
Commit fe352d37 authored by Claus-Justus Heine's avatar Claus-Justus Heine
Browse files

Replace "echo -n -e" by printf

parent 847a82cb
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,8 @@
DOF_FREE_SIZE=$1
MAX_STRIDE=$2
FW=$(( ${DOF_FREE_SIZE} / 4 ))
PRINT="printf"
#echo -n -e
ALLBITS=$(( (1 << ${DOF_FREE_SIZE}) - 1 ))
if test ${ALLBITS} -eq 0; then
......@@ -15,7 +17,7 @@ if test ${MAX_STRIDE} -gt 1; then
#ifndef _ALBERTA_STRIDE_DOF_FREE_BIT_H_
#define _ALBERTA_STRIDE_DOF_FREE_BIT_H_
EOF
echo -n -e '\n#define MAX_STRIDE '"${MAX_STRIDE}"'\n\n'
${PRINT} '\n#define MAX_STRIDE '"${MAX_STRIDE}"'\n\n'
cat <<EOF
const DOF_FREE_UNIT dof_stride_free_bit[MAX_STRIDE][DOF_FREE_SIZE] = {
EOF
......@@ -39,33 +41,33 @@ while test ${STRIDE} -le ${MAX_STRIDE}; do
BIT=0
if test ${MAX_STRIDE} -gt 1; then
echo -n -e ' {\n '
${PRINT} ' {\n '
else
echo -n -e ' '
${PRINT} ' '
fi
while test ${BIT} -lt ${DOF_FREE_SIZE}; do
VALUE=$(( (${MASK} << ${BIT}) & ${ALLBITS} ))
printf '0x%0'${FW}'x' ${VALUE}
${PRINT} '0x%0'${FW}'x' ${VALUE}
BIT=$(( ${BIT} + 1 ))
if test ${BIT} -lt $(( ${DOF_FREE_SIZE} + ${MAX_STRIDE} - 1 )); then
if test $(( ${BIT} % ${WRAP} )) -eq 0; then
if test ${MAX_STRIDE} -gt 1; then
echo -n -e ',\n '
${PRINT} ',\n '
else
echo -n -e ',\n '
${PRINT} ',\n '
fi
else
echo -n -e ', '
${PRINT} ', '
fi
fi
done
if test ${MAX_STRIDE} -gt 1; then
echo -n -e '\n }'
${PRINT} '\n }'
fi
if test ${STRIDE} -lt ${MAX_STRIDE}; then
echo -n -e ',\n'
${PRINT} ',\n'
else
echo -n -e '\n'
${PRINT} '\n'
fi
STRIDE=$(( ${STRIDE} + 1 ))
done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment