ObjFW  Diff

Differences From Artifact [daf136e4f4]:

To Artifact [ac49749d23]:


59
60
61
62
63
64
65
66
67


68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84

85
86
87
88

89
90
91
92
93
94
95




96
97
98
99
100
101
102
103
59
60
61
62
63
64
65


66
67
68
69
70
71
72
73
74

75
76
77
78
79
80
81
82
83

84
85
86
87

88
89
90
91




92
93
94
95
96
97
98
99
100
101
102
103







-
-
+
+







-
+








-
+



-
+



-
-
-
-
+
+
+
+








	of_dns_resource_record_type_t recordType =
	    OF_DNS_RESOURCE_RECORD_TYPE_ALL;
	OFDNSResolver *resolver;

#ifdef OF_HAVE_SANDBOX
	OFSandbox *sandbox = [[OFSandbox alloc] init];
	@try {
		[sandbox setAllowsStdIO: true];
		[sandbox setAllowsDNS: true];
		sandbox.allowsStdIO = true;
		sandbox.allowsDNS = true;

		[OFApplication activateSandbox: sandbox];
	} @finally {
		[sandbox release];
	}
#endif

	if ([arguments count] < 1 || [arguments count] > 4) {
	if (arguments.count < 1 || arguments.count > 4) {
		[of_stderr writeFormat:
		    @"Usage: %@ host [type [class [server]]]\n",
		    [OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

	resolver = [OFDNSResolver resolver];

	if ([arguments count] >= 2)
	if (arguments.count >= 2)
		recordType = of_dns_resource_record_type_parse(
		    [arguments objectAtIndex: 1]);

	if ([arguments count] >= 3)
	if (arguments.count >= 3)
		recordClass = of_dns_resource_record_class_parse(
		    [arguments objectAtIndex: 2]);

	if ([arguments count] >= 4) {
		[resolver setConfigReloadInterval: 0];
		[resolver setNameServers:
		    [OFArray arrayWithObject: [arguments objectAtIndex: 3]]];
	if (arguments.count >= 4) {
		resolver.configReloadInterval = 0;
		resolver.nameServers =
		    [arguments objectsInRange: of_range(3, 1)];
	}

	[resolver asyncResolveHost: [arguments objectAtIndex: 0]
		       recordClass: recordClass
			recordType: recordType
			  delegate: self];
}
@end