No C99 initialisers, gcc 2.95.3 doesn't like it.

Also make sure getopt.h is included.
This commit is contained in:
Guus Sliepen 2003-07-30 11:50:45 +00:00
parent de223b51b9
commit fcbe29bc4c
8 changed files with 57 additions and 63 deletions

View file

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script. 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_PREREQ(2.57)
AC_INIT(src/tincd.c) AC_INIT(src/tincd.c)
@ -89,7 +89,7 @@ dnl Checks for libraries.
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC 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], 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 [#ifdef HAVE_SYS_TYPES_H

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #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 *lookup_edge(node_t *from, node_t *to)
{ {
edge_t v = { edge_t v;
.from = from,
.to = to
};
cp(); cp();
v.from = from;
v.to = to;
return avl_search(from->edge_tree, &v); return avl_search(from->edge_tree, &v);
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "system.h"
@ -202,7 +202,7 @@ bool setup_myself(void)
char *name, *hostname, *mode, *afname, *cipher, *digest; char *name, *hostname, *mode, *afname, *cipher, *digest;
char *address = NULL; char *address = NULL;
char *envp[5]; char *envp[5];
struct addrinfo hint, *ai, *aip; struct addrinfo *ai, *aip, hint = {0};
bool choice; bool choice;
int i, err; int i, err;
@ -446,12 +446,10 @@ bool setup_myself(void)
get_config_string(lookup_config(config_tree, "BindToAddress"), &address); get_config_string(lookup_config(config_tree, "BindToAddress"), &address);
hint = (struct addrinfo) { hint.ai_family = addressfamily;
.ai_family = addressfamily, hint.ai_socktype = SOCK_STREAM;
.ai_socktype = SOCK_STREAM, hint.ai_protocol = IPPROTO_TCP;
.ai_protocol = IPPROTO_TCP, hint.ai_flags = AI_PASSIVE;
.ai_flags = AI_PASSIVE,
};
err = getaddrinfo(address, myport, &hint, &ai); err = getaddrinfo(address, myport, &hint, &ai);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "system.h"
@ -36,15 +36,14 @@ bool hostnames = false;
*/ */
struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype)
{ {
struct addrinfo *ai; struct addrinfo *ai, hint = {0};
struct addrinfo hint = {
.ai_family = addressfamily,
.ai_socktype = socktype,
};
int err; int err;
cp(); cp();
hint.ai_family = addressfamily;
hint.ai_socktype = socktype;
err = getaddrinfo(address, service, &hint, &ai); err = getaddrinfo(address, service, &hint, &ai);
if(err) { 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) sockaddr_t str2sockaddr(const char *address, const char *port)
{ {
struct addrinfo *ai; struct addrinfo *ai, hint = {0};
struct addrinfo hint = {
.ai_family = AF_UNSPEC,
.ai_flags = AI_NUMERICHOST,
.ai_socktype = SOCK_STREAM,
};
sockaddr_t result; sockaddr_t result;
int err; int err;
cp(); cp();
hint.ai_family = AF_UNSPEC;
hint.ai_flags = AI_NUMERICHOST;
hint.ai_socktype = SOCK_STREAM;
err = getaddrinfo(address, port, &hint, &ai); err = getaddrinfo(address, port, &hint, &ai);
if(err || !ai) { if(err || !ai) {

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "system.h"
@ -145,24 +145,24 @@ void node_del(node_t *n)
node_t *lookup_node(char *name) node_t *lookup_node(char *name)
{ {
node_t n = { node_t n = {0};
.name = name,
};
cp(); cp();
n.name = name;
return avl_search(node_tree, &n); return avl_search(node_tree, &n);
} }
node_t *lookup_node_udp(const sockaddr_t *sa) node_t *lookup_node_udp(const sockaddr_t *sa)
{ {
node_t n = { node_t n = {0};
.address = *sa,
.name = NULL,
};
cp(); cp();
n.address = *sa;
n.name = NULL;
return avl_search(node_udp_tree, &n); return avl_search(node_udp_tree, &n);
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "system.h"
@ -209,13 +209,12 @@ void exit_requests(void)
bool seen_request(char *request) bool seen_request(char *request)
{ {
past_request_t p = { past_request_t *new, p = {0};
.request = request,
};
past_request_t *new;
cp(); cp();
p.request = request;
if(avl_search(past_request_tree, &p)) { if(avl_search(past_request_tree, &p)) {
ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Already seen request")); ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Already seen request"));
return true; return true;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #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 *lookup_subnet_mac(const mac_t *address)
{ {
subnet_t subnet = { subnet_t *p, subnet = {0};
.type = SUBNET_MAC,
.net.mac.address = *address,
.owner = NULL
};
subnet_t *p;
cp(); cp();
subnet.type = SUBNET_MAC;
subnet.net.mac.address = *address;
subnet.owner = NULL;
p = (subnet_t *) avl_search(subnet_tree, &subnet); p = (subnet_t *) avl_search(subnet_tree, &subnet);
return p; 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 *lookup_subnet_ipv4(const ipv4_t *address)
{ {
subnet_t subnet = { subnet_t *p, subnet = {0};
.type = SUBNET_IPV4,
.net.ipv4.address = *address,
.net.ipv4.prefixlength = 32,
.owner = NULL
};
subnet_t *p;
cp(); cp();
subnet.type = SUBNET_IPV4;
subnet.net.ipv4.address = *address;
subnet.net.ipv4.prefixlength = 32;
subnet.owner = NULL;
do { do {
/* Go find subnet */ /* 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 *lookup_subnet_ipv6(const ipv6_t *address)
{ {
subnet_t subnet = { subnet_t *p, subnet = {0};
.type = SUBNET_IPV6,
.net.ipv6.address = *address,
.net.ipv6.prefixlength = 128,
.owner = NULL
};
subnet_t *p;
cp(); cp();
subnet.type = SUBNET_IPV6;
subnet.net.ipv6.address = *address;
subnet.net.ipv6.prefixlength = 128;
subnet.owner = NULL;
do { do {
/* Go find subnet */ /* Go find subnet */

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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" #include "system.h"
@ -38,6 +38,8 @@
#include <lzo1x.h> #include <lzo1x.h>
#include <getopt.h>
#include "conf.h" #include "conf.h"
#include "logger.h" #include "logger.h"
#include "net.h" #include "net.h"