From 747b3f76980848902610f39f2673e2f2dfbb608a Mon Sep 17 00:00:00 2001 From: "Gu://em_" Date: Thu, 20 Nov 2025 18:32:38 +0100 Subject: [PATCH] fix: typo in config parser concerning the --default_file flag --- httpd/config.txt | 1 + httpd/src/config/config.c | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/httpd/config.txt b/httpd/config.txt index c35b687..239d20d 100644 --- a/httpd/config.txt +++ b/httpd/config.txt @@ -7,3 +7,4 @@ server_name = my_server ip = 127.0.0.1 port = 6996 root_dir = . +default_file='/dev/null' diff --git a/httpd/src/config/config.c b/httpd/src/config/config.c index b0ca6b7..c7f8153 100644 --- a/httpd/src/config/config.c +++ b/httpd/src/config/config.c @@ -180,21 +180,22 @@ static void print_arg_error(int err, char **argv, struct option options[], struct config *parse_configuration(int argc, char *argv[]) { - struct option options[] = { // Global - { "daemon", required_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - // Vhosts - { "server_name", required_argument, NULL, 's' }, - { "port", required_argument, NULL, 'p' }, - { "ip", required_argument, NULL, 'i' }, - { "root_dir", required_argument, NULL, 'r' }, - { "defaut_file", required_argument, NULL, 'D' }, - // Logging - { "pid_file", required_argument, NULL, 'P' }, - { "log_file", required_argument, NULL, 'L' }, - { "log", required_argument, NULL, 'l' }, - // End - { NULL, 0, NULL, 0 } + struct option options[] = { + // Global + { "daemon", required_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + // Vhosts + { "server_name", required_argument, NULL, 's' }, + { "port", required_argument, NULL, 'p' }, + { "ip", required_argument, NULL, 'i' }, + { "root_dir", required_argument, NULL, 'r' }, + { "default_file", required_argument, NULL, 'D' }, + // Logging + { "pid_file", required_argument, NULL, 'P' }, + { "log_file", required_argument, NULL, 'L' }, + { "log", required_argument, NULL, 'l' }, + // End + { NULL, 0, NULL, 0 } }; struct config *config = calloc(1, sizeof(struct config));