mirror of
https://github.com/fumiama/C302.git
synced 2026-02-16 20:27:26 +09:00
feat: adapt to latest CGI protocol
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6...4.1.1)
|
||||||
project(C302 C)
|
project(C302 C)
|
||||||
SET(CMAKE_BUILD_TYPE "Release")
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
|
|
||||||
|
|||||||
16
c302.c
16
c302.c
@@ -2,6 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/select.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "c302.h"
|
#include "c302.h"
|
||||||
@@ -31,3 +32,18 @@ int main(int argc, char **argv) {
|
|||||||
};
|
};
|
||||||
return writev(1, (const struct iovec *)&iov, 4) != len+sizeof(uint32_t);
|
return writev(1, (const struct iovec *)&iov, 4) != len+sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__((destructor)) defer_close_fp() {
|
||||||
|
fflush(stdout);
|
||||||
|
char buf[256];
|
||||||
|
fd_set rfds;
|
||||||
|
struct timeval tv;
|
||||||
|
int ret;
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(0, &rfds);
|
||||||
|
tv.tv_sec = 1;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
if (select(1, &rfds, NULL, NULL, &tv) > 0 && FD_ISSET(0, &rfds)) {
|
||||||
|
read(0, buf, sizeof(buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user