82 lines
1.9 KiB
Bash
82 lines
1.9 KiB
Bash
|
#!/usr/pkg/bin/bash
|
||
|
|
||
|
#DOC MAINDIR specifies where the script begins to build gophermaps from.
|
||
|
#DOC HEADER is printed at the top of each gophermap
|
||
|
#DOC FOOTER is printed at the end of each gophermap
|
||
|
|
||
|
MAINDIR="$HOME/gopher"
|
||
|
|
||
|
HEADER="Welcome to my gopherspace
|
||
|
____ ____ _ _ _
|
||
|
| \| _ \| | | |
|
||
|
| | | | | | | | | |
|
||
|
|_|_|_|_| |_|\____/
|
||
|
"
|
||
|
|
||
|
FOOTER="
|
||
|
|
||
|
Thanks for using
|
||
|
|
||
|
_ _ ._ |_ _ ._
|
||
|
(_| (_) |_) | | (/_ |
|
||
|
_| |
|
||
|
"
|
||
|
|
||
|
|
||
|
#DOC Gopher File Codes
|
||
|
#DOy 0 text file
|
||
|
#DOC r directory
|
||
|
#DOC 3 error message
|
||
|
#DOC 5 archive file (zip, tar etc)
|
||
|
#DOC 7 search query
|
||
|
#DOC 8 telnet session
|
||
|
#DOC 9 binary file
|
||
|
#DOC g GIF image
|
||
|
#DOC h HTML file
|
||
|
#DOC i info text
|
||
|
#DOC I generic image file (other than GIF)
|
||
|
#DOC d document file (ps, pdf, doc etc)
|
||
|
#DOC s sound file
|
||
|
#DOC ; video file
|
||
|
#DOC c calendar file
|
||
|
#DOC M MIME file (mbox, emails etc)
|
||
|
|
||
|
#DOC function gophref - 3 Args filetype, selector, name
|
||
|
#DOC The filetypes are well defined at this URL
|
||
|
#DOC https://github.com/michael-lazar/hn-gopher/blob/master/hn-gopher/opt/gophernicus_2.4/READM
|
||
|
#DOC
|
||
|
function gophref(){
|
||
|
if [ -z "$1" ] && [ -z "$2" ];then
|
||
|
exit -100
|
||
|
elif [ -z "$2" ];then
|
||
|
echo "$1$2 $2";
|
||
|
else
|
||
|
echo "$1$3 $2";
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function gopHeader(){
|
||
|
if [ -z "$2" ];then
|
||
|
headerWidth=40
|
||
|
else
|
||
|
headerWidth=$2
|
||
|
fi
|
||
|
lineSegment=""
|
||
|
for ((i=1;i<$headerWidth; i++))
|
||
|
do
|
||
|
lineSegment="-$lineSegment"
|
||
|
done
|
||
|
|
||
|
echo "$lineSegment"
|
||
|
printf "%*s" $(((${#1}+$headerWidth)/2)) "$1"
|
||
|
printf '\n'
|
||
|
echo "$lineSegment"
|
||
|
}
|
||
|
|
||
|
echo "$HEADER"
|
||
|
gopHeader "PHLOG Posts"
|
||
|
gophref 0 TextFile "Big Times"
|
||
|
gopHeader "Looking for more? Check these out."
|
||
|
gophref 1 2021-04-16 "More Offgrid Fun"
|
||
|
gophref 0 OldStuff "Older Stuff"
|
||
|
echo "$FOOTER"
|