shithub: werc

Download patch

ref: 1b8c25edce7859dd0bed1a27df18185295c052b1
parent: 5cb56d26c4173088aee574f33b150c76db3ef023
author: kris <kris@engel.se.cat-v.org>
date: Mon Jun 4 02:02:00 EDT 2007

Blockbuffer all output.

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -124,6 +124,18 @@
 if (test -d $body)
     body=$body/index
 
+fn template {
+    template.awk | rc |
+    awk '{
+        buf = buf $0"\n"
+        if(length(buf) > 8192) {
+            printf "%s", buf
+            buf = ""
+        }
+    }
+    END{ printf "%s", buf }'
+}
+
 # RSS
 fn statpost {
 	f = $1
@@ -146,7 +158,7 @@
 }
 
 if(! ~ $REQUEST_URI */index.rss) {
-	cat $headers $template | template.awk | rc
+	cat $headers $template | template
 	exit
 }
 
@@ -154,7 +166,7 @@
 uri=$baseuri$"uri
 
 # Should be in a separate file.
-cat <<'!' | template.awk | rc
+cat <<'!' | template
 <?xml version="1.0"?>
 <rss version="2.0">
 	<channel>