c3Reg/adafruit/reg
2020-06-11 17:54:10 +02:00

53 lines
865 B
Bash
Executable File

#!/bin/bash
FILE=/tmp/$RANDOM
TOP=56
NEXTFIELD=5
LEFT=22
AUTHLEFT=56
DATELEFT=37
MAXLENGTH=17
GIVENNAME=$1
SURNAME=$2
HOME=$3
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
echo "MAXLENGTH EXCEEDED."
exit 1
fi
source ../include/nixdorf
init
smallLetters $FILE
printf "\x1b\x33\x0e" >> $FILE
makeNewline $TOP $FILE
makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE
# Authority field
makeNewline 2 $FILE
makeLeft $AUTHLEFT $FILE
printf "Intergalactic Reg. Office" >> $FILE
makeNewline 3 $FILE
makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE
makeNewline $NEXTFIELD $FILE
makeLeft $LEFT $FILE
printf "$HOME" >> $FILE
makeNewline 4 $FILE
makeLeft $DATELEFT $FILE
if [ -n "$EVENT" ]; then
printf "/ $EVENT, $(date -I)" >> $FILE
else
printf "/ $(date -I)" >> $FILE
fi
printFile $FILE
rm $FILE