From 5f8b897a3ba80dc4bd82a13372ae8b8a279930f2 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 9 May 2016 14:08:56 -0400 Subject: Migrateing to nicer looking stuff --- main.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..b1b68cf --- /dev/null +++ b/main.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include "common.c" + +int main(){ + char* data = getenv("QUERY_STRING"); + char* hardip = getenv("REMOTE_ADDR"); + printf("%s%c%c\n", + "Content-Type:text/html;charset=iso-8859-1",13,10); + printf("Data:%s",data); +} + +void addConnected(int32_t ipaddr){ + char* shm; + int shmid; + /* + //Create the segment. + if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) { + perror("shmget"); + exit(1); + } + + //Now we attach the segment to our data space. + if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) { + perror("shmat"); + exit(1); + } + + /* + * If there's another process that got there first + * Wait for it to finish loading data before we start + */ + while (*shm != '*') + sleep(1); +} -- cgit v1.2.3-70-g09d2