17 lines
423 B
C
17 lines
423 B
C
|
#include "http_server.h"
|
||
|
#include "../common/socket_helper.h"
|
||
|
#include <errno.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|