X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=scoop-cgi;h=8f56f3e37790bf4459fd09b6fbbb886ccead4af1;hb=da771423ccb2547eb0d304c1b9ea7b32cc95144b;hp=b7531ecb7df6192252ccb70709ccb01f9040593d;hpb=c95e95333f93130886fa49231679a02256cfdcef;p=bin.git diff --git a/scoop-cgi b/scoop-cgi index b7531ec..8f56f3e 100755 --- a/scoop-cgi +++ b/scoop-cgi @@ -28,14 +28,16 @@ fi 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)}'