aboutsummaryrefslogtreecommitdiffstats
path: root/getconf.c
blob: 69f6b6979c00bc525cbe2addf238d61e58507dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "config.h"
#include "conf.h"

#include <stdio.h>

RCSID("$Id: getconf.c,v 1.1.1.1 1999/02/02 23:29:39 shmit Exp $");

int
main(int argc, char *argv[])
{
	if (read_config(SERVER_CONFIG_FILE) == -1)
		return 1;

	while (--argc) {
		const config_t *option;

		option = findopt(argv[argc]);
		if (!option)
			fprintf(stderr,
				"Error: option `%s' doesn't exist or"
				" is not set.\n", argv[argc]);
		else
			switch (option->type) {
			case NUMOPT:
				printf("%ld\n", option->numvalue);
				break;
			case STROPT:
				printf("%s\n", option->strvalue);
				break;
			default:
				fprintf(stderr,
					"Error: don't understand option type"
					" (this shouldn't happen).\n");
			}
	}

	return 0;
}