makeLeft and makeNewline put into include

This commit is contained in:
Bandie 2020-06-11 12:13:23 +02:00
parent da8dcc7222
commit 822d58734c
Signed by: Bandie
GPG Key ID: 843D7FA93BA46312
5 changed files with 48 additions and 72 deletions

View File

@ -39,5 +39,17 @@ function italicLetters() {
printf "\x1b\x34" >> "$1" printf "\x1b\x34" >> "$1"
} }
function makeNewline() {
for((i=0; i<$1; i++)); do
printf "\n" >> "$2"
done
}
function makeLeft() {
for((i=0; i<$1; i++)); do
printf " " >> "$2"
done
}
init init
resetLetters $DEVICE resetLetters $DEVICE

View File

@ -8,18 +8,6 @@ GIVENNAME=$1
SURNAME=$2 SURNAME=$2
HOME=$3 HOME=$3
function makeNewline() {
for((i=0; i<$1; i++)); do
printf "\n" >> $FILE
done
}
function makeLeft() {
for((i=0; i<$LEFT; i++)); do
printf " " >> $FILE
done
}
if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then if [ ${#GIVENNAME} -gt $MAXLENGTH ] || [ ${#SURNAME} -gt $MAXLENGTH ] || [ ${#HOME} -gt $MAXLENGTH ]; then
echo "MAXLENGTH EXCEEDED." echo "MAXLENGTH EXCEEDED."
@ -30,20 +18,20 @@ fi
source ../include/nixdorf source ../include/nixdorf
init init
makeNewline $TOP makeNewline $TOP $FILE
makeLeft makeLeft $LEFT $FILE
printf "$GIVENNAME" >> $FILE printf "$GIVENNAME" >> $FILE
makeNewline 4 makeNewline 4 $FILE
makeLeft makeLeft $LEFT $FILE
printf "$SURNAME" >> $FILE printf "$SURNAME" >> $FILE
makeNewline 3 makeNewline 3 $FILE
makeLeft makeLeft $LEFT $FILE
printf "$HOME" >> $FILE printf "$HOME" >> $FILE
makeNewline 4 makeNewline 4 $FILE
makeLeft makeLeft $LEFT $FILE
if [ -n "$EVENT" ]; then if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE printf "$EVENT, $(date -I)" >> $FILE

View File

@ -45,18 +45,6 @@ function moveDown() {
done done
} }
function makeNewline() {
for((i=0; i<$1; i++)); do
printf "\n" >> $FILE
done
}
function makeLeft() {
for((i=0; i<$1; i++)); do
printf " " >> $FILE
done
}
function heading() { function heading() {
moveDown moveDown
@ -69,11 +57,11 @@ function heading() {
fi fi
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE makeLeft $HEADINGNEXTPAGE $FILE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $SPACE makeLeft $SPACE $FILE
bigLetters $FILE bigLetters $FILE
printf "GPG" >> $FILE printf "GPG" >> $FILE
@ -90,10 +78,10 @@ function insertFP() {
smallLetters $FILE smallLetters $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE $FILE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE resetLetters $FILE
printf "\n" >> $FILE printf "\n" >> $FILE
@ -101,10 +89,10 @@ function insertFP() {
smallLetters $FILE smallLetters $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE $FILE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2 $3 $4" >> $FILE printf "$1 $2 $3 $4" >> $FILE
resetLetters $FILE resetLetters $FILE
printf "\n" >> $FILE printf "\n" >> $FILE
@ -114,8 +102,8 @@ function insertFP() {
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) makeLeft $(($SPACE + 2)) $FILE
printf "$1 $2" >> $FILE printf "$1 $2" >> $FILE
resetLetters $FILE resetLetters $FILE
printf "\n" >> $FILE printf "\n" >> $FILE
@ -123,10 +111,10 @@ function insertFP() {
smallLetters $FILE smallLetters $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE $FILE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE printf "$EVENT, $(date -I)" >> $FILE
@ -138,7 +126,7 @@ function insertFP() {
source ../include/nixdorf source ../include/nixdorf
init init
makeNewline $TOP makeNewline $TOP $FILE
heading heading
insertFP $@ insertFP $@

36
jhp/iro
View File

@ -47,18 +47,6 @@ function moveDown() {
done done
} }
function makeNewline() {
for((i=0; i<$1; i++)); do
printf "\n" >> $FILE
done
}
function makeLeft() {
for((i=0; i<$1; i++)); do
printf " " >> $FILE
done
}
function heading() { function heading() {
moveDown moveDown
@ -76,29 +64,29 @@ function heading() {
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE
fi fi
makeLeft 1 makeLeft 1 $FILE
makeLeft $SPACE makeLeft $SPACE $FILE
italicLetters $FILE italicLetters $FILE
printf "INTERGALACTIC\n" >> $FILE printf "INTERGALACTIC\n" >> $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGE makeLeft $NEXTPAGE
fi fi
makeLeft 1 makeLeft 1 $FILE
makeLeft $SPACE makeLeft $SPACE $FILE
printf "REGISTRATION\n" >> $FILE printf "REGISTRATION\n" >> $FILE
bigLetters $FILE bigLetters $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $HEADINGNEXTPAGE makeLeft $HEADINGNEXTPAGE $FILE
if [ $(($FIELD % 2)) -eq 1 ]; then if [ $(($FIELD % 2)) -eq 1 ]; then
makeLeft $(($HSPACE - 1)) makeLeft $(($HSPACE - 1)) $FILE
fi fi
else else
if [ $(($FIELD % 2)) -eq 0 ]; then if [ $(($FIELD % 2)) -eq 0 ]; then
makeLeft 1 makeLeft 1 $FILE
fi fi
makeLeft $HSPACE makeLeft $HSPACE $FILE
fi fi
printf "OFFICE\n" >> $FILE printf "OFFICE\n" >> $FILE
resetLetters $FILE resetLetters $FILE
@ -114,10 +102,10 @@ function insertDate() {
smallLetters $FILE smallLetters $FILE
if [ $PAGE -eq 1 ]; then if [ $PAGE -eq 1 ]; then
makeLeft $NEXTPAGESMALL makeLeft $NEXTPAGESMALL $FILE
fi fi
makeLeft $LEFT makeLeft $LEFT $FILE
makeLeft $(($SPACE + 2)) makeLeft $(($SPACE + 2)) $FILE
if [ -n "$EVENT" ]; then if [ -n "$EVENT" ]; then
printf "$EVENT, $(date -I)" >> $FILE printf "$EVENT, $(date -I)" >> $FILE
else else
@ -129,7 +117,7 @@ function insertDate() {
source ../include/nixdorf source ../include/nixdorf
init init
makeNewline $TOP makeNewline $TOP $FILE
heading heading
insertDate insertDate

2
start
View File

@ -169,7 +169,7 @@ function jhpReg() {
confirm=" Forename: $FNAME\n Surename: $SNAME\n Planet: $PLANET" confirm=" Forename: $FNAME\n Surename: $SNAME\n Planet: $PLANET"
ynBox "IRO Stamp" "Does this being wants to have a IRO stamp?" ynBox "IRO Stamp" "Does this being want to have a IRO stamp?"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
STAMP=true STAMP=true
else else