"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "nsd-checkzone.c" between
nsd-4.3.5.tar.gz and nsd-4.3.6.tar.gz

About: NSD is an authoritative only, high performance, simple name server daemon.

nsd-checkzone.c  (nsd-4.3.5):nsd-checkzone.c  (nsd-4.3.6)
skipping to change at line 34 skipping to change at line 34
struct nsd nsd; struct nsd nsd;
/* /*
* Print the help text. * Print the help text.
* *
*/ */
static void static void
usage (void) usage (void)
{ {
fprintf(stderr, "Usage: nsd-checkzone <zone name> <zone file>\n"); fprintf(stderr, "Usage: nsd-checkzone [-p] <zone name> <zone file>\n");
fprintf(stderr, "\t-p\tprint the zone if the zone is ok\n");
fprintf(stderr, "Version %s. Report bugs to <%s>.\n", fprintf(stderr, "Version %s. Report bugs to <%s>.\n",
PACKAGE_VERSION, PACKAGE_BUGREPORT); PACKAGE_VERSION, PACKAGE_BUGREPORT);
} }
static void static void
check_zone(struct nsd* nsd, const char* name, const char* fname) check_zone(struct nsd* nsd, const char* name, const char* fname, FILE *out)
{ {
const dname_type* dname; const dname_type* dname;
zone_options_type* zo; zone_options_type* zo;
zone_type* zone; zone_type* zone;
unsigned errors; unsigned errors;
/* init*/ /* init*/
nsd->db = namedb_open("", nsd->options); nsd->db = namedb_open("", nsd->options);
dname = dname_parse(nsd->options->region, name); dname = dname_parse(nsd->options->region, name);
if(!dname) { if(!dname) {
skipping to change at line 70 skipping to change at line 71
/* read the zone */ /* read the zone */
errors = zonec_read(name, fname, zone); errors = zonec_read(name, fname, zone);
if(errors > 0) { if(errors > 0) {
printf("zone %s file %s has %u errors\n", name, fname, errors); printf("zone %s file %s has %u errors\n", name, fname, errors);
#ifdef MEMCLEAN /* otherwise, the OS collects memory pages */ #ifdef MEMCLEAN /* otherwise, the OS collects memory pages */
namedb_close(nsd->db); namedb_close(nsd->db);
region_destroy(nsd->options->region); region_destroy(nsd->options->region);
#endif #endif
exit(1); exit(1);
} }
if (out) {
print_rrs(out, zone);
printf("; ");
}
printf("zone %s is ok\n", name); printf("zone %s is ok\n", name);
namedb_close(nsd->db); namedb_close(nsd->db);
} }
/* dummy functions to link */ /* dummy functions to link */
int writepid(struct nsd * ATTR_UNUSED(nsd)) int writepid(struct nsd * ATTR_UNUSED(nsd))
{ {
return 0; return 0;
} }
void unlinkpid(const char * ATTR_UNUSED(file)) void unlinkpid(const char * ATTR_UNUSED(file))
skipping to change at line 98 skipping to change at line 103
} }
extern char *optarg; extern char *optarg;
extern int optind; extern int optind;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
/* Scratch variables... */ /* Scratch variables... */
int c; int c;
int print_zone = 0;
struct nsd nsd; struct nsd nsd;
memset(&nsd, 0, sizeof(nsd)); memset(&nsd, 0, sizeof(nsd));
log_init("nsd-checkzone"); log_init("nsd-checkzone");
/* Parse the command line... */ /* Parse the command line... */
while ((c = getopt(argc, argv, "h")) != -1) { while ((c = getopt(argc, argv, "hp")) != -1) {
switch (c) { switch (c) {
case 'h': case 'h':
usage(); usage();
exit(0); exit(0);
case 'p':
print_zone = 1;
break;
case '?': case '?':
default: default:
usage(); usage();
exit(1); exit(1);
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
/* Commandline parse error */ /* Commandline parse error */
skipping to change at line 131 skipping to change at line 140
usage(); usage();
exit(1); exit(1);
} }
nsd.options = nsd_options_create(region_create_custom(xalloc, free, nsd.options = nsd_options_create(region_create_custom(xalloc, free,
DEFAULT_CHUNK_SIZE, DEFAULT_LARGE_OBJECT_SIZE, DEFAULT_CHUNK_SIZE, DEFAULT_LARGE_OBJECT_SIZE,
DEFAULT_INITIAL_CLEANUP_SIZE, 1)); DEFAULT_INITIAL_CLEANUP_SIZE, 1));
if (verbosity == 0) if (verbosity == 0)
verbosity = nsd.options->verbosity; verbosity = nsd.options->verbosity;
check_zone(&nsd, argv[0], argv[1]); check_zone(&nsd, argv[0], argv[1], print_zone ? stdout : NULL);
region_destroy(nsd.options->region); region_destroy(nsd.options->region);
/* yylex_destroy(); but, not available in all versions of flex */ /* yylex_destroy(); but, not available in all versions of flex */
exit(0); exit(0);
} }
 End of changes. 7 change blocks. 
4 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)