summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--main.c4
2 files changed, 7 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b352ab3..e9b5f00 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,11 @@ CFLAGS := ${cflags.${BUILD}}
6 6
7LIBS := -lcups 7LIBS := -lcups
8 8
9CFLAGS += -L/usr/local/lib
10CFLAGS += -I/usr/local/include
11
12FILES := cgi.c
13
9test: main 14test: main
10 ./main 15 ./main
11 16
@@ -15,5 +20,5 @@ clean:
15 rm -f ./main 20 rm -f ./main
16 21
17%: 22%:
18 $(CC) $(CFLAGS) -o $@ cgi.c main.c $(LIBS) 23 $(CC) $(CFLAGS) -o $@ $(FILES) main.c $(LIBS)
19 24
diff --git a/main.c b/main.c
index 8f1d3ef..c1a7c30 100644
--- a/main.c
+++ b/main.c
@@ -254,7 +254,7 @@ static int serve(int server_fd)
254} 254}
255 255
256int main(const int argc, char const * argv[]) { 256int main(const int argc, char const * argv[]) {
257 int server_fd = -1, opt = 1; 257 int server_fd = -1;
258 258
259 int port = atoi(argc > 1 ? argv[1] : "8080"); 259 int port = atoi(argc > 1 ? argv[1] : "8080");
260 0 == port ? port = 8080 : port; 260 0 == port ? port = 8080 : port;
@@ -269,8 +269,6 @@ int main(const int argc, char const * argv[]) {
269 // I <3 C 269 // I <3 C
270 0 == (server_fd = socket(AF_INET, SOCK_STREAM, 0)) 270 0 == (server_fd = socket(AF_INET, SOCK_STREAM, 0))
271 ? err(errno, NULL) 271 ? err(errno, NULL)
272 : setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt))
273 ? err(errno, "setsockopt failed on socket with fileno %d", server_fd)
274 : bind(server_fd, (struct sockaddr*) &address, sizeof(address)) 272 : bind(server_fd, (struct sockaddr*) &address, sizeof(address))
275 ? err(errno, NULL) 273 ? err(errno, NULL)
276 : listen(server_fd, SOMAXCONN) 274 : listen(server_fd, SOMAXCONN)
..