I tried running server.c outside the appliance on my mac and when compiling got the following message
server.c:358:26: error: implicit declaration of function 'memmem' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
needle = memmem(haystack, size, "\r\n\r\n", 4);
^
server.c:358:26: note: did you mean 'memset'?
/usr/include/string.h:74:7: note: 'memset' declared here
void *memset(void *, int, size_t);
^
server.c:358:24: error: incompatible integer to pointer conversion
assigning to 'char *' from 'int' [-Werror,-Wint-conversion]
needle = memmem(haystack, size, "\r\n\r\n", 4);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
server.c:375:60: error: format specifies type 'int' but the argument has
type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
if (dprintf(cfd, "Content-Length: %i\r\n", length) < 0)
~~ ^~~~~~
%zu
server.c:426:60: error: format specifies type 'int' but the argument has
type 'ssize_t' (aka 'long') [-Werror,-Wformat]
if (dprintf(cfd, "Content-Length: %i\r\n", length) < 0)
~~ ^~~~~~
%zi
server.c:727:15: error: incompatible integer to pointer conversion
initializing 'char *' with an expression of type 'int'
[-Werror,-Wint-conversion]
...needle = memmem(haystack, request + length - haystack, "\r\n\r\n", 4);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
I've installed all the libraries required for programming with C on my mac and why didn't the compiling worked?