#!/bin/rc cr= webroot = ./ while(! ~ $#* 0) { switch ($1) { case -w webroot=$2 shift case * echo Usage: g9srv/blog [-w webroot] exit usage } shift } sitename='Fultons gem pod' blogname='My blog' fn header{ echo $1 $2$cr } fn gettitle{ echo `{echo $1 | sed 's/\+/ /g'} } posts=`{ls -p $webroot/posts} fullurl=`{read} url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*// s/ //'} if(~ $url '') url=/ if (~ $url '/'){ header 20 text/gemini echo '#' $sitename echo $tagline echo '##' $blogname for(i in $posts){ name=`{gettitle $i} echo '=>' posts/$i $name } cat homepage exit 0 } if(test -f $webroot$url){ header 20 text/gemini cat $webroot$url }