named-checkconf.c revision dafcb997e390efa4423883dafd100c975c4095d6
/*
* Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2002 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named-checkconf.c,v 1.28 2004/03/05 04:57:20 marka Exp $ */
#include <config.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <isc/commandline.h>
#include <isccfg/namedconf.h>
#include "check-tool.h"
#define CHECK(r)\
do { \
result = (r); \
if (result != ISC_R_SUCCESS) \
goto cleanup; \
} while (0)
static void
usage(void) {
"[named.conf]\n");
exit(1);
}
static isc_result_t
char *directory;
/*
* Change directory.
*/
if (result != ISC_R_SUCCESS) {
"change directory to '%s' failed: %s\n",
return (result);
}
return (ISC_R_SUCCESS);
}
static isc_result_t
{
const char *zclass;
const char *zname;
const char *zfile;
if (!cfg_obj_isstring(classobj))
else
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
if (result != ISC_R_SUCCESS)
return(result);
}
static isc_result_t
{
else
{
if (tresult != ISC_R_SUCCESS)
}
return (result);
}
static isc_result_t
const char *vclass;
{
const char *vname;
vclass = "IN";
if (cfg_obj_isstring(classobj))
}
if (tresult != ISC_R_SUCCESS)
}
if (tresult != ISC_R_SUCCESS)
}
return (result);
}
int
int c;
int exit_status = 0;
switch (c) {
case 'd':
debug++;
break;
case 'j':
break;
case 't':
if (result != ISC_R_SUCCESS) {
exit(1);
}
if (result != ISC_R_SUCCESS) {
exit(1);
}
break;
case 'v':
exit(0);
case 'z':
break;
default:
usage();
}
}
exit(1);
if (result != ISC_R_SUCCESS)
exit_status = 1;
if (result != ISC_R_SUCCESS)
exit_status = 1;
}
return (exit_status);
}