c3Reg/bounddipl/c3reg

109 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
FILE=/tmp/$RANDOM
TOP=1
LEFT=5
# Additional heading space
HEADINGNEXTPAGE=19
HEADINGLEFT=1
HEADINGRIGHT=10
# GPG Space
NEXTPAGE=34
NEXTPAGESMALL=60
NEXTFIELDBOTTOM=13
NEXTFIELDRIGHT=18
NEXTFIELDRIGHTSMALL=30
if [ $# -eq 0 ]; then
echo -e "$0: Syntax:\n$0 FIELD\n\nExample:\n$0 7\n\n\nFields:
==================
| VISAS || VISAS |
==================
| 0 | 1 || 4 | 5 |
|---|---||---|---|
| 2 | 3 || 6 | 7 |
==================
"
exit 1
fi
PAGE=$(($1 / 4))
FIELD=$(($1 % 4))
shift 1
echo "PAGE: $PAGE, FIELD: $FIELD"
function moveDown() {
for((i=0; i<$(($FIELD / 2)); i++)); do
for((j=0; j<$NEXTFIELDBOTTOM; j++)); do
printf "\n" >> $FILE
done
done
}
function heading() {
moveDown
if [ $(($FIELD % 2)) -eq 0 ]; then
HSPACE=$HEADINGLEFT
SPACE=0
else
HSPACE=$HEADINGRIGHT
SPACE=$NEXTFIELDRIGHT
fi
bigLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE $FILE
if [ $(($FIELD % 2)) -eq 1 ]; then
makeLeft $(($HSPACE - 1)) $FILE
fi
else
makeLeft 1 $FILE
makeLeft $HSPACE $FILE
fi
printf "C3Reg\n" >> $FILE
resetLetters $FILE
}
function insertDate() {
if [ $(($FIELD % 2 )) -eq 0 ]; then
SPACE=0
else
SPACE=$NEXTFIELDRIGHTSMALL
fi
smallLetters $FILE
if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGESMALL $FILE
fi
makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE
else
printf "$(date -I)" >> $FILE
fi
}
source ../include/nixdorf
init
makeNewline $TOP $FILE
heading
insertDate
printFile $FILE
rm $FILE