01: // Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)
02:
03: package org.xbill.DNS.tests;
04:
05: import java.util.*;
06: import org.xbill.DNS.*;
07:
08: public class primary {
09:
10: private static void usage() {
11: System.out.println("usage: primary [-t] [-a | -i] origin file");
12: System.exit(1);
13: }
14:
15: public static void main(String[] args) throws Exception {
16: boolean time = false;
17: boolean axfr = false;
18: boolean iterator = false;
19: int arg = 0;
20:
21: if (args.length < 2)
22: usage();
23:
24: while (args.length - arg > 2) {
25: if (args[0].equals("-t"))
26: time = true;
27: else if (args[0].equals("-a"))
28: axfr = true;
29: else if (args[0].equals("-i"))
30: iterator = true;
31: arg++;
32: }
33:
34: Name origin = Name.fromString(args[arg++], Name.root);
35: String file = args[arg++];
36:
37: long start = System.currentTimeMillis();
38: Zone zone = new Zone(origin, file);
39: long end = System.currentTimeMillis();
40: if (axfr) {
41: Iterator it = zone.AXFR();
42: while (it.hasNext()) {
43: System.out.println(it.next());
44: }
45: } else if (iterator) {
46: Iterator it = zone.iterator();
47: while (it.hasNext()) {
48: System.out.println(it.next());
49: }
50: } else {
51: System.out.println(zone);
52: }
53: if (time)
54: System.out.println("; Load time: " + (end - start) + " ms");
55: }
56:
57: }
|