Commit: 02d1631bd2bf7a38195c9dd57f9ac9db84379438
Parent: 42585197ed0bea4a8c9c590b8bbbcfcff5d7f9a9
Author: Randy Palamar
Date: Thu, 26 Aug 2021 16:41:55 -0600
introduce config.def.h and use it to {dis,}enable ipv6
Diffstat:
5 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
@@ -51,6 +51,11 @@ options:
.c.o:
$(CC) $(CFLAGS) -c $<
+config.h:
+ cp config.def.h $@
+
+$(OBJ): config.h config.mk
+
links: $(OBJ)
$(CC) -o $@ $(OBJ) $(LDFLAGS)
diff --git a/config.def.h b/config.def.h
@@ -0,0 +1 @@
+static const int support_ipv6 = 1;
+\ No newline at end of file
diff --git a/dns.c b/dns.c
@@ -3,12 +3,9 @@
* This file is a part of the Links program, released under GPL
*/
-#include <sys/socket.h>
-
+#include "config.h"
#include "links.h"
-int support_ipv6;
-
struct dnsentry {
list_entry_1st
uttime absolute_time;
@@ -489,13 +486,5 @@ int ipv6_full_access(void)
void init_dns(void)
{
- int h;
register_cache_upcall(shrink_dns_cache, 0, cast_uchar "dns");
- h = socket(AF_INET6, SOCK_STREAM, 0);
- if (h == -1) {
- support_ipv6 = 0;
- } else {
- close(h);
- support_ipv6 = 1;
- }
}
diff --git a/links.h b/links.h
@@ -417,8 +417,6 @@ struct lookup_state {
int target_port;
};
-extern int support_ipv6;
-
int numeric_ip_address(const char *name, char address[4]);
int numeric_ipv6_address(const char *name, char address[16], unsigned *scope_id);
void rotate_addresses(struct lookup_result *);
diff --git a/menu.c b/menu.c
@@ -5,6 +5,7 @@
#include <limits.h>
+#include "config.h"
#include "links.h"
static struct history file_history = { 0, { &file_history.items, &file_history.items } };