blob: f6aa1c55979632a7a3cb7abb93c3a319acd00990 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/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 -pr $webroot/posts}
fullurl=`{read}
echo $fullurl >[1=2]
url=`{echo $fullurl | sed 's/gemini:\/\/[0-9 a-z .]*//
s/
//
s/%2B/+/g'}
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 $webroot/homepage
exit 0
}
if(test -f $webroot$url){
header 20 text/gemini
cat $webroot$url
}
|