1
/* siloconfcheck - validate silo.conf syntax
3
Copyright (C) 2000 Ben Collins <bcollins@debian.org>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25
#include <sys/types.h>
32
/* Get decleration of enum arch */
34
/* And then make sure we get printf right */
35
#define prom_printf printf
37
enum arch architecture;
39
/* Tells cfg.c not to #include anything of it's own, we are in control. */
40
#define SILOCONFCHECK 1
42
#include "../second/cfg.c"
44
int confcheck(char* conf) {
49
if (conf == NULL) return 1;
51
if (stat(conf, &st) || ((fd = open(conf, O_RDONLY)) == -1) ||
52
((buf = (char *)mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED)) {
57
if (cfg_parse(conf, buf, st.st_size)) {
58
fprintf(stderr, "Error parsing silo config file %s\n", conf);
62
munmap(buf, st.st_size);
64
printf("%s appears to be valid\n", conf);