summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/padstring
blob: 283475d0711709393e5303682b6e87c0efb7760f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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