Skip to content

Commit f3b69a6

Browse files
committed
style fix
1 parent 94f8bcc commit f3b69a6

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

httpd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ void serve_forever(const char *PORT) {
6565
if (fork() == 0) {
6666
close(listenfd);
6767
respond(slot);
68-
close(clients[slot]);
69-
clients[slot] = -1;
68+
close(clients[slot]);
69+
clients[slot] = -1;
7070
exit(0);
7171
} else {
7272
close(clients[slot]);
@@ -226,6 +226,6 @@ void respond(int slot) {
226226
shutdown(STDOUT_FILENO, SHUT_WR);
227227
close(STDOUT_FILENO);
228228
}
229-
229+
230230
free(buf);
231231
}

httpd.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#include <string.h>
66

77
// Client request
8-
extern char *method, // "GET" or "POST"
9-
*uri, // "/index.html" things before '?'
10-
*qs, // "a=1&b=2" things after '?'
11-
*prot, // "HTTP/1.1"
12-
*payload; // for POST
8+
extern char *method, // "GET" or "POST"
9+
*uri, // "/index.html" things before '?'
10+
*qs, // "a=1&b=2" things after '?'
11+
*prot, // "HTTP/1.1"
12+
*payload; // for POST
1313

1414
extern int payload_size;
1515

main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
#define CHUNK_SIZE 1024 // read 1024 bytes at a time
55

66
// Public directory settings
7-
#define PUBLIC_DIR "./public"
8-
#define INDEX_HTML "/index.html"
7+
#define PUBLIC_DIR "./public"
8+
#define INDEX_HTML "/index.html"
99
#define NOT_FOUND_HTML "/404.html"
1010

11-
1211
int main(int c, char **v) {
1312
char *port = c == 1 ? "8000" : v[1];
1413
serve_forever(port);
@@ -18,7 +17,7 @@ int main(int c, char **v) {
1817
int file_exists(const char *file_name) {
1918
struct stat buffer;
2019
int exists;
21-
20+
2221
exists = (stat(file_name, &buffer) == 0);
2322

2423
return exists;

0 commit comments

Comments
 (0)