19 main(
int argc,
char **argv)
26 bool canonicalize =
false;
29 bool only_dnssec =
false;
30 bool print_soa =
true;
41 int soa_serial_increment_func_data = 0;
43 while ((c = getopt(argc, argv,
"0bcdhnpsvzS:")) != -1) {
59 fprintf(stderr,
"Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n");
63 printf(
"Usage: %s [OPTIONS] <zonefile>\n", argv[0]);
64 printf(
"\tReads the zonefile and prints it.\n");
65 printf(
"\tThe RR count of the zone is printed to stderr.\n");
66 printf(
"\t-b include bubblebabble of DS's.\n");
67 printf(
"\t-0 zeroize timestamps and signature in RRSIG records.\n");
68 printf(
"\t-c canonicalize all rrs in the zone.\n");
69 printf(
"\t-d only show DNSSEC data from the zone\n");
70 printf(
"\t-h show this text\n");
71 printf(
"\t-n do not print the SOA record\n");
72 printf(
"\t-p prepend SOA serial with spaces so"
73 " it takes exactly ten characters.\n");
74 printf(
"\t-s strip DNSSEC data from the zone\n");
75 printf(
"\t-S [[+|-]<number> | YYYYMMDDxx | "
77 "\t\tSet serial number to <number> or,"
78 " when preceded by a sign,\n"
79 "\t\toffset the existing number with "
80 "<number>. With YYYYMMDDxx\n"
81 "\t\tthe serial is formatted as a datecounter"
82 ", and with unixtime as the\n"
83 "\t\tnumber of seconds since 1-1-1970."
84 " However, on serial number"
85 "\n\t\tdecrease, +1 is used in stead"
87 printf(
"\t-v shows the version and exits\n");
88 printf(
"\t-z sort the zone (implies -c).\n");
89 printf(
"\nif no file is given standard input is read\n");
101 fprintf(stderr,
"Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n");
114 if (*optarg ==
'+' || *optarg ==
'-') {
115 soa_serial_increment_func_data =
117 soa_serial_increment_func =
119 }
else if (! strtok(optarg,
"0123456789")) {
120 soa_serial_increment_func_data =
122 soa_serial_increment_func =
124 }
else if (!strcasecmp(optarg,
"YYYYMMDDxx")){
125 soa_serial_increment_func =
127 }
else if (!strcasecmp(optarg,
"unixtime")){
128 soa_serial_increment_func =
131 fprintf(stderr,
"-S expects a number "
132 "optionally preceded by a "
133 "+ or - sign to indicate an "
134 "offset, or the text YYYYMM"
135 "DDxx or unixtime\n");
150 fp = fopen(filename,
"r");
152 fprintf(stderr,
"Unable to open %s: %s\n", filename, strerror(errno));
161 fprintf(stderr,
"%s at %d\n",
214 if (soa_serial_increment_func) {
217 , soa_serial_increment_func
218 , soa_serial_increment_func_data