util/config.tests/unix/padstring
author eckhart.koppen@nokia.com
Wed, 31 Mar 2010 11:06:36 +0300
changeset 7 f7bc934e204c
permissions -rwxr-xr-x
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b

#!/bin/sh

LEN="$1"
STR="$2"
PAD='\0'
STRLEN=`echo $STR | wc -c`
RES="$STR"
    
EXTRALEN=`expr $LEN - $STRLEN`
while [ "$EXTRALEN" -gt 32 ]; do
   RES="$RES$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD$PAD"
   EXTRALEN=`expr $EXTRALEN - 32`
done
while [ "$EXTRALEN" -gt 0 ]; do
   RES="$RES$PAD"
   EXTRALEN=`expr $EXTRALEN - 1`
done
cat <<EOF
$RES
EOF