#!/bin/awk -f BEGIN{ file = ARGV[1]"/remote" ARGC = 0 getline info >"/sys/log/gemini" sub("[#?].*", "", url); gsub("[^/]*/\\.\\.(/|$)", "/", url); file = "/usr/umbraticus/www/jimmy"url if(system("test -r "file)){ print "51 Not Found\r" exit } if(system("test -d "file)){ m["gif"] = "image/gif" m["it"] = "audio/it" m["jpg"] = "image/jpeg" m["mod"] = "audio/mod" m["mp3"] = "audio/mpeg" m["ogg"] = "audio/ogg" m["pdf"] = "application/pdf" m["png"] = "image/png" m["ps"] = "application/postscript" m["tgz"] = "application/gzip" mime = file sub(/.*\./, "", mime) mime = m[mime] if(!mime) mime = "text/plain; charset=utf-8" print "20 "mime"\r" fflush() system("cat "file) exit } if(!match(url, "/$")) url = url"/" print "20 text/gemini\r" while("walk -n1,1 -d -enm "file" | sort" | getline){ "date -i "$2 | getline date print "=> gemini://runjimmyrunrunyoufuckerrun.com"url $1" "date" "$1"/" } while("walk -n1,1 -f -enms "file" | sort" | getline){ "date -i "$2 | getline date print "=> gemini://runjimmyrunrunyoufuckerrun.com"url $1" "date" "$1" "$3 } }