#!/usr/bin/env lua local fcgi = require"fcgi" apps = { yqtemplate = require"yqtemplate" } while fcgi.accept() do app = fcgi.getenv("DOCUMENT_URI"):sub(6) appfn = apps[app] if appfn then appfn.run(fcgi) else fcgi.print"Content-Type: text/html; charset=utf-8\r\n\r\n" fcgi.print[[ Annwan's CGI scripts ]] if app and app ~= "" then fcgi.print("

No such application: " .. app .. "\n") end fcgi.print("

Available applications:

]] end end