config.tests/unix/padstring
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 15:50:13 +0300
changeset 18 2f34d5167611
parent 0 1918ee327afb
permissions -rw-r--r--
Revision: 201011 Kit: 201015

#!/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