Add include <strings.h> to avoid implicit declaration of built-in functions,
replace bzero() with memset(), mark function argument unused, and use %zu to
print size_t data type.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
#include <unistd.h>
#include <fcntl.h>
//#include <ctype.h>
-//#include <string.h>
+#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
}
-int longipstr( char *s, ip_t *dst, int family )
+int longipstr( char *s, ip_t *dst, int family
+#ifndef ENABLE_IPV6
+UNUSED
+#endif
+)
{
#ifdef ENABLE_IPV6
return inet_pton( family, s, dst );
struct sockaddr_in *sa_in;
struct sockaddr_in6 *sa_in6;
- bzero (sa, sizeof (struct sockaddr_storage));
+ memset (sa, 0, sizeof (struct sockaddr_storage));
switch (af) {
case AF_INET:
sa_in = (struct sockaddr_in *) sa;
}
snprintf( fmt, sizeof(fmt), "HOST: %%-%ds", len_tmp);
#else
- snprintf( fmt, sizeof(fmt), "HOST: %%-%ds", len_hosts);
+ snprintf( fmt, sizeof(fmt), "HOST: %%-%zus", len_hosts);
#endif
snprintf(buf, sizeof(buf), fmt, LocalHostname);
len = reportwide ? strlen(buf) : len_hosts;