From c09b54222f1e18c16488b76a380ffc8332ea1e7d Mon Sep 17 00:00:00 2001
From: Dan Egnor <egnor@ofb.net>
Date: Thu, 13 Jul 2000 00:56:00 +0000
Subject: [PATCH] Stuff.

---
 Makefile.am |  3 ++-
 Makefile.in |  3 ++-
 oop-adns.h  |  2 +-
 test-oop.c  | 25 ++++++++++++++++---------
 4 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 3436706..0a53de1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,8 +9,9 @@
 AUTOMAKE_OPTIONS = foreign 1.2
 lib_LTLIBRARIES = liboop.la liboop-adns.la liboop-glib.la liboop-www.la
 INCLUDES = $(GLIB_INCLUDES) $(WWW_INCLUDES)
+EXTRA_DIST = liboop.spec
 
-# versions updated as of 0.4; 0.5 only changes build stuff.
+# versions updated as of 0.4; 0.5 and 0.6 only change build stuff.
 
 liboop_la_LDFLAGS = -version-info 2:0:0 # version:revision:age
 liboop_la_SOURCES = sys.c select.c signal.c alloc.c
diff --git a/Makefile.in b/Makefile.in
index aeae635..776b80a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -88,8 +88,9 @@ WWW_LIBS = @WWW_LIBS@
 AUTOMAKE_OPTIONS = foreign 1.2
 lib_LTLIBRARIES = liboop.la liboop-adns.la liboop-glib.la liboop-www.la
 INCLUDES = $(GLIB_INCLUDES) $(WWW_INCLUDES)
+EXTRA_DIST = liboop.spec
 
-# versions updated as of 0.4; 0.5 only changes build stuff.
+# versions updated as of 0.4; 0.5 and 0.6 only change build stuff.
 
 liboop_la_LDFLAGS = -version-info 2:0:0 # version:revision:age
 liboop_la_SOURCES = sys.c select.c signal.c alloc.c
diff --git a/oop-adns.h b/oop-adns.h
index 82a7a84..030875b 100644
--- a/oop-adns.h
+++ b/oop-adns.h
@@ -18,7 +18,7 @@ typedef struct oop_adns_query oop_adns_query;
 typedef void *oop_adns_call(oop_adapter_adns *,adns_answer *,void *);
 
 /* A liboop adns adapter creates an adns instance tied to a liboop source. 
-   oop_adns_new() Returns NULL on failure.*/
+   oop_adns_new() returns NULL on failure.*/
 oop_adapter_adns *oop_adns_new(oop_source *,adns_initflags,FILE *diag);
 void oop_adns_delete(oop_adapter_adns *);
 
diff --git a/test-oop.c b/test-oop.c
index 23dbaf2..13d2baa 100644
--- a/test-oop.c
+++ b/test-oop.c
@@ -124,11 +124,12 @@ static void *on_signal(oop_source *source,int sig,void *data) {
 #include "adns.h"
 #include "oop-adns.h"
 
+#define ADNS_CANCEL
 #define NUM_Q 6
 oop_adns_query *q[NUM_Q];
 oop_adapter_adns *adns;
 
-void *stop_lookup(oop_source *src,int sig,void *data) {
+void cancel_adns(void) {
 	int i;
 
 	for (i = 0; i < NUM_Q; ++i)
@@ -141,7 +142,10 @@ void *stop_lookup(oop_source *src,int sig,void *data) {
 		oop_adns_delete(adns);
 		adns = NULL;
 	}
+}
 
+void *stop_lookup(oop_source *src,int sig,void *data) {
+	cancel_adns();
 	src->cancel_signal(src,SIGQUIT,stop_lookup,NULL);
 	return OOP_CONTINUE;
 }
@@ -151,17 +155,20 @@ void *on_lookup(oop_adapter_adns *adns,adns_answer *reply,void *data) {
 	for (i = 0; i < NUM_Q; ++i) if (data == &q[i]) q[i] = NULL;
 
 	printf("adns: %s =>",reply->owner);
-	if (adns_s_ok != reply->status) {
+	if (adns_s_ok != reply->status)
 		printf(" error: %s\n",adns_strerror(reply->status));
-		return OOP_CONTINUE;
+	else {
+		if (NULL != reply->cname) printf(" (%s)",reply->cname);
+		assert(adns_r_a == reply->type);
+		for (i = 0; i < reply->nrrs; ++i)
+			printf(" %s",inet_ntoa(reply->rrs.inaddr[i]));
+		printf("\n");
 	}
-	if (NULL != reply->cname) printf(" (%s)",reply->cname);
-	assert(adns_r_a == reply->type);
-	for (i = 0; i < reply->nrrs; ++i)
-		printf(" %s",inet_ntoa(reply->rrs.inaddr[i]));
-	printf("\n");
-	free(reply);
 
+	free(reply);
+#ifdef ADNS_CANCEL
+	cancel_adns();
+#endif
 	return OOP_CONTINUE;
 }
 
-- 
GitLab