#include "http_server.h" #include "../common/socket_helper.h" #include "socket_server.h" #include #include #include #include #include #include int main(int argc, char* argv[]) { if (argc != 2) { printf("%s", USAGE_STRING); } char *port = argv[1]; long port_num = strtol(port, NULL, 10); if (port_num < MIN_PORT || port_num > MAX_PORT || errno == ERANGE || errno == EINVAL) { printf("%s", PORT_ERROR); } struct server_info info = setup(port_num); if (info.status == STATUS_ERROR) { printf("%s\n", strerror(errno)); } serve_one_request(info.sock_fd); close(info.sock_fd); }