channel=$(grep -x "$channel" /etc/scoop-cgi/channels)
if [ -z "$channel" ]; then
echo "Status: 404"
- echo "Content-type: text/plain\n"
+ printf "Content-type: text/plain\n\n"
echo "404. Channel not logged."
exit 0
fi
time=$(echo "$PATH_INFO" | awk -F / '{print $3}' | xargs date -I -d)
+today=$(date -I)
+time=${time:-$today}
db=$(cat /etc/scoop-cgi/database)
-echo "Content-type: text/plain\n"
-scoop -d "$db" -p "$channel" -D "${time:-now}" -F "%Y-%m-%d %H:%M:%S" \
+printf "Content-type: text/plain\n\n"
+PAGER=/dev/tty scoop -d "$db" -p "$channel" -D "$time" -F "%Y-%m-%d %H:%M:%S" \
| awk '{$1=""; print substr($0, 2, length($0) - 1)}'