commit 5af19830c3bbec71b3db5c2c19335e5e0c7ff76f from: Omar Polo date: Fri Jun 09 17:29:52 2023 UTC move print_conf and make it take the config as argument commit - 792f302acee3122ed0f9469d8676dbb271f60849 commit + 5af19830c3bbec71b3db5c2c19335e5e0c7ff76f blob - ffc37990b43dc22f237036173b175d23809e64aa blob + 0949e7f566972cc9c7250d448a82bbd76ad5b3f2 --- gmid.c +++ gmid.c @@ -44,6 +44,7 @@ static void main_sig_handler(int, short, void *); static int main_dispatch_server(int, struct privsep_proc *, struct imsg *); static int main_dispatch_logger(int, struct privsep_proc *, struct imsg *); static void __dead main_shutdown(struct conf *); +static void main_print_conf(struct conf *); static struct privsep_proc procs[] = { { "server", PROC_SERVER, main_dispatch_server, server }, @@ -238,7 +239,7 @@ main(int argc, char **argv) if (conftest) { fprintf(stderr, "config OK\n"); if (conftest > 1) - print_conf(); + main_print_conf(conf); return 0; } @@ -432,4 +433,31 @@ main_shutdown(struct conf *conf) close(pidfd); exit(0); +} + +static void +main_print_conf(struct conf *conf) +{ + struct vhost *h; + /* struct location *l; */ + /* struct envlist *e; */ + /* struct alist *a; */ + + if (*conf->chroot != '\0') + printf("chroot \"%s\"\n", conf->chroot); + printf("ipv6 %s\n", conf->ipv6 ? "on" : "off"); + /* XXX: defined mimes? */ + printf("port %d\n", conf->port); + printf("prefork %d\n", conf->prefork); + /* XXX: protocols? */ + if (*conf->user != '\0') + printf("user \"%s\"\n", conf->user); + + TAILQ_FOREACH(h, &conf->hosts, vhosts) { + printf("\nserver \"%s\" {\n", h->domain); + printf(" cert \"%s\"\n", h->cert); + printf(" key \"%s\"\n", h->key); + /* TODO: print locations... */ + printf("}\n"); + } } blob - 804fe9311ff4370bf49949bb994ad9f991224747 blob + 847af9e1cf68acbe1a5199b28428a8e036f588c7 --- gmid.h +++ gmid.h @@ -347,7 +347,6 @@ int config_recv(struct conf *, struct imsg *); /* parse.y */ void yyerror(const char*, ...); int parse_conf(struct conf *, const char*); -void print_conf(void); int cmdline_symset(char *); /* mime.c */ blob - ecbb7281a15eeca6a4397ebb93fd161b2a0a2d2c blob + 97bad0e511042a76daae191256de0e1849c714e2 --- parse.y +++ parse.y @@ -940,33 +940,6 @@ parse_conf(struct conf *c, const char *filename) return 0; } -void -print_conf(void) -{ - struct vhost *h; - /* struct location *l; */ - /* struct envlist *e; */ - /* struct alist *a; */ - - if (*conf->chroot != '\0') - printf("chroot \"%s\"\n", conf->chroot); - printf("ipv6 %s\n", conf->ipv6 ? "on" : "off"); - /* XXX: defined mimes? */ - printf("port %d\n", conf->port); - printf("prefork %d\n", conf->prefork); - /* XXX: protocols? */ - if (*conf->user != '\0') - printf("user \"%s\"\n", conf->user); - - TAILQ_FOREACH(h, &conf->hosts, vhosts) { - printf("\nserver \"%s\" {\n", h->domain); - printf(" cert \"%s\"\n", h->cert); - printf(" key \"%s\"\n", h->key); - /* TODO: print locations... */ - printf("}\n"); - } -} - int symset(const char *name, const char *val, int persist) {