* #!/usr/bin/cgi-fcgi-interp [<options>],<interpreter>
*/
/*
- * cgi-fcgi-interp.[ch] - C helpers common to the whole of chiark-utils
+ * cgi-fcgi-interp.[ch] - Convenience wrapper for cgi-fcgi
*
* Copyright 2016 Ian Jackson
* Copyright 1982,1986,1993 The Regents of the University of California
script = *argv++;
if (!script) badusage("need script argument");
- if (*argv) badusage("too many arguments");
if (!stage2) {
static char buf[1024];
static int pending;
+ /* %: does not contain newlines
+ * _: empty (garbage)
+ */
+
+ /* %%%%%%%%%%%__________________ */
+ /* ^ pending */
+
for (;;) {
int avail = sizeof(buf) - pending;
ssize_t got = read(errpipe, buf+pending, avail);
if (got==-1) {
if (errno==EINTR) continue;
- else if (errno==EWOULDBLOCK || errno==EAGAIN) /*ok*/;
+ else if (errno==EWOULDBLOCK || errno==EAGAIN) return;
else diee("(stage2) errpipe read");
got = 0;
} else if (got==0) {
}
syslog(LOG_ERR,"stderr: %.*s", printupto-eaten, buf+eaten);
eaten += eat;
+ scanned = eaten;
}
pending -= eaten;
memmove(buf, buf+eaten, pending);