#!/bin/bash read -d '>' auth read -d '>' cmd case "$cmd" in "\n" printf "Content-type: text/plain\r\n\r\n" echo Not found } serve_history() { limit=${1:-35} grep=$2 printf "\n" printf "Content-type: text/html\r\n\r\n" cat <<-EOF History EOF exec 2>&1 dillo_dir=${0%/*/*/*} history_file=$dillo_dir/history.txt if [ -n "$grep" ]; then grep "$grep"; else cat fi < "$history_file" | tail -n $limit | tac | awk ' { timestamp = $1 " " $2 if ($3 != "+0000") { timestamp = timestamp " " $3 } printf "
%s %s %s
\n", timestamp, $4, $4, $5, $5 }' cat <<-EOF EOF } case "$url" in history:*/*) a="${url#history:}"; serve_history "${a%/*}" "${a#*/}";; history:*) serve_history "${url#history:}";; *) serve_404;; esac