#!/bin/bash
FILE=/tmp/$RANDOM
TOP=52
NEXTFIELD=5
LEFT=38
MAXLENGTH=6

GIVENNAME=$1
SURNAME=$2
HOME=$3


if [ $# -eq 0 ]; then
  echo "Syntax: $0 <SecurityNumber>"
  exit 1
fi

sn=$1

if [ ${#sn} -gt $MAXLENGTH ]; then
  echo "Security Number too long"
  exit 1
fi

source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$1" >> $FILE

printFile $FILE
rm $FILE
