projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use bools and enums where appropriate.
[tinc]
/
src
/
netutl.c
diff --git
a/src/netutl.c
b/src/netutl.c
index
1f5e4af
..
0d34d8d
100644
(file)
--- a/
src/netutl.c
+++ b/
src/netutl.c
@@
-17,36
+17,18
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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.4
6 2003/07/12 17:41:46
guus Exp $
+ $Id: netutl.c,v 1.12.4.4
8 2003/07/22 20:55:20
guus Exp $
*/
*/
-#include "config.h"
-
-#include <fcntl.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-
-#include <utils.h>
-#include <xalloc.h>
-
-#include "errno.h"
-#include "conf.h"
+#include "system.h"
+
#include "net.h"
#include "netutl.h"
#include "logger.h"
#include "net.h"
#include "netutl.h"
#include "logger.h"
+#include "utils.h"
+#include "xalloc.h"
-#include "system.h"
-
-int hostnames = 0;
+bool hostnames = false;
/*
Turn a string into a struct addrinfo.
/*
Turn a string into a struct addrinfo.
@@
-262,7
+244,7
@@
void maskcpy(void *va, void *vb, int masklen, int len)
a[i] = 0;
}
a[i] = 0;
}
-
int
maskcheck(void *va, int masklen, int len)
+
bool
maskcheck(void *va, int masklen, int len)
{
int i;
char *a = va;
{
int i;
char *a = va;
@@
-273,11
+255,11
@@
int maskcheck(void *va, int masklen, int len)
masklen %= 8;
if(masklen && a[i++] & (0xff >> masklen))
masklen %= 8;
if(masklen && a[i++] & (0xff >> masklen))
- return
-1
;
+ return
false
;
for(; i < len; i++)
if(a[i] != 0)
for(; i < len; i++)
if(a[i] != 0)
- return
-2
;
+ return
false
;
- return
0
;
+ return
true
;
}
}