From: Guus Sliepen Date: Wed, 30 Jul 2003 11:50:45 +0000 (+0000) Subject: No C99 initialisers, gcc 2.95.3 doesn't like it. X-Git-Tag: release-1.0~30 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=fcbe29bc4cc67530581a36cf1a3a1445c741b8e5;p=tinc No C99 initialisers, gcc 2.95.3 doesn't like it. Also make sure getopt.h is included. --- diff --git a/configure.in b/configure.in index 91f76dcb..d7754f90 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Id: configure.in,v 1.13.2.75 2003/07/30 09:45:20 guus Exp $ +dnl $Id: configure.in,v 1.13.2.76 2003/07/30 11:50:44 guus Exp $ AC_PREREQ(2.57) AC_INIT(src/tincd.c) @@ -89,7 +89,7 @@ dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([syslog.h sys/file.h sys/ioctl.h sys/param.h sys/time.h sys/socket.h sys/wait.h sys/mman.h netdb.h arpa/inet.h netinet/in_systm.h netinet/in.h]) +AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/param.h sys/time.h sys/socket.h sys/wait.h sys/mman.h netdb.h arpa/inet.h netinet/in_systm.h netinet/in.h]) AC_CHECK_HEADERS([net/ethernet.h net/if.h net/if_arp.h netinet/if_ether.h netinet/ip.h netinet/tcp.h netinet/ip_icmp.h netinet/ip6.h netinet/icmp6.h], [], [], [#ifdef HAVE_SYS_TYPES_H diff --git a/src/edge.c b/src/edge.c index 95e7f7e0..9dbb0c89 100644 --- a/src/edge.c +++ b/src/edge.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: edge.c,v 1.1.2.24 2003/07/29 10:50:15 guus Exp $ + $Id: edge.c,v 1.1.2.25 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -125,13 +125,13 @@ void edge_del(edge_t *e) edge_t *lookup_edge(node_t *from, node_t *to) { - edge_t v = { - .from = from, - .to = to - }; - + edge_t v; + cp(); + v.from = from; + v.to = to; + return avl_search(from->edge_tree, &v); } diff --git a/src/net_setup.c b/src/net_setup.c index 3695e18e..5bbaa799 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_setup.c,v 1.1.2.40 2003/07/29 22:59:00 guus Exp $ + $Id: net_setup.c,v 1.1.2.41 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -202,7 +202,7 @@ bool setup_myself(void) char *name, *hostname, *mode, *afname, *cipher, *digest; char *address = NULL; char *envp[5]; - struct addrinfo hint, *ai, *aip; + struct addrinfo *ai, *aip, hint = {0}; bool choice; int i, err; @@ -446,12 +446,10 @@ bool setup_myself(void) get_config_string(lookup_config(config_tree, "BindToAddress"), &address); - hint = (struct addrinfo) { - .ai_family = addressfamily, - .ai_socktype = SOCK_STREAM, - .ai_protocol = IPPROTO_TCP, - .ai_flags = AI_PASSIVE, - }; + hint.ai_family = addressfamily; + hint.ai_socktype = SOCK_STREAM; + hint.ai_protocol = IPPROTO_TCP; + hint.ai_flags = AI_PASSIVE; err = getaddrinfo(address, myport, &hint, &ai); diff --git a/src/netutl.c b/src/netutl.c index 1ec6e5a8..ef9a6608 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.50 2003/07/29 22:59:00 guus Exp $ + $Id: netutl.c,v 1.12.4.51 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -36,15 +36,14 @@ bool hostnames = false; */ struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) { - struct addrinfo *ai; - struct addrinfo hint = { - .ai_family = addressfamily, - .ai_socktype = socktype, - }; + struct addrinfo *ai, hint = {0}; int err; cp(); + hint.ai_family = addressfamily; + hint.ai_socktype = socktype; + err = getaddrinfo(address, service, &hint, &ai); if(err) { @@ -58,17 +57,16 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock sockaddr_t str2sockaddr(const char *address, const char *port) { - struct addrinfo *ai; - struct addrinfo hint = { - .ai_family = AF_UNSPEC, - .ai_flags = AI_NUMERICHOST, - .ai_socktype = SOCK_STREAM, - }; + struct addrinfo *ai, hint = {0}; sockaddr_t result; int err; cp(); + hint.ai_family = AF_UNSPEC; + hint.ai_flags = AI_NUMERICHOST; + hint.ai_socktype = SOCK_STREAM; + err = getaddrinfo(address, port, &hint, &ai); if(err || !ai) { diff --git a/src/node.c b/src/node.c index 5fb3d0d7..b69c5b1c 100644 --- a/src/node.c +++ b/src/node.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: node.c,v 1.1.2.25 2003/07/29 10:50:15 guus Exp $ + $Id: node.c,v 1.1.2.26 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -145,24 +145,24 @@ void node_del(node_t *n) node_t *lookup_node(char *name) { - node_t n = { - .name = name, - }; + node_t n = {0}; cp(); + n.name = name; + return avl_search(node_tree, &n); } node_t *lookup_node_udp(const sockaddr_t *sa) { - node_t n = { - .address = *sa, - .name = NULL, - }; + node_t n = {0}; cp(); + n.address = *sa; + n.name = NULL; + return avl_search(node_udp_tree, &n); } diff --git a/src/protocol.c b/src/protocol.c index c2d92898..6088740a 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: protocol.c,v 1.28.4.144 2003/07/29 10:50:15 guus Exp $ + $Id: protocol.c,v 1.28.4.145 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -209,13 +209,12 @@ void exit_requests(void) bool seen_request(char *request) { - past_request_t p = { - .request = request, - }; - past_request_t *new; + past_request_t *new, p = {0}; cp(); + p.request = request; + if(avl_search(past_request_tree, &p)) { ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Already seen request")); return true; diff --git a/src/subnet.c b/src/subnet.c index 4541594d..36d1627e 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: subnet.c,v 1.1.2.48 2003/07/24 12:08:16 guus Exp $ + $Id: subnet.c,v 1.1.2.49 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -305,15 +305,14 @@ subnet_t *lookup_subnet(const node_t *owner, const subnet_t *subnet) subnet_t *lookup_subnet_mac(const mac_t *address) { - subnet_t subnet = { - .type = SUBNET_MAC, - .net.mac.address = *address, - .owner = NULL - }; - subnet_t *p; + subnet_t *p, subnet = {0}; cp(); + subnet.type = SUBNET_MAC; + subnet.net.mac.address = *address; + subnet.owner = NULL; + p = (subnet_t *) avl_search(subnet_tree, &subnet); return p; @@ -321,16 +320,15 @@ subnet_t *lookup_subnet_mac(const mac_t *address) subnet_t *lookup_subnet_ipv4(const ipv4_t *address) { - subnet_t subnet = { - .type = SUBNET_IPV4, - .net.ipv4.address = *address, - .net.ipv4.prefixlength = 32, - .owner = NULL - }; - subnet_t *p; + subnet_t *p, subnet = {0}; cp(); + subnet.type = SUBNET_IPV4; + subnet.net.ipv4.address = *address; + subnet.net.ipv4.prefixlength = 32; + subnet.owner = NULL; + do { /* Go find subnet */ @@ -360,16 +358,15 @@ subnet_t *lookup_subnet_ipv4(const ipv4_t *address) subnet_t *lookup_subnet_ipv6(const ipv6_t *address) { - subnet_t subnet = { - .type = SUBNET_IPV6, - .net.ipv6.address = *address, - .net.ipv6.prefixlength = 128, - .owner = NULL - }; - subnet_t *p; + subnet_t *p, subnet = {0}; cp(); + subnet.type = SUBNET_IPV6; + subnet.net.ipv6.address = *address; + subnet.net.ipv6.prefixlength = 128; + subnet.owner = NULL; + do { /* Go find subnet */ diff --git a/src/tincd.c b/src/tincd.c index 6b90de76..4b303622 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tincd.c,v 1.10.4.78 2003/07/29 22:59:00 guus Exp $ + $Id: tincd.c,v 1.10.4.79 2003/07/30 11:50:45 guus Exp $ */ #include "system.h" @@ -38,6 +38,8 @@ #include +#include + #include "conf.h" #include "logger.h" #include "net.h"