Ansify entry and exit points.

MFC after:	1 month
This commit is contained in:
Cy Schubert 2017-06-28 19:08:07 +00:00
parent ad6481dddc
commit e5426b9f65
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320455
3 changed files with 16 additions and 20 deletions

View File

@ -10,9 +10,8 @@
#include "ipf.h"
char *hostname(family, ip)
int family;
void *ip;
char *
hostname(int family, void *ip)
{
static char hostbuf[MAXHOSTNAMELEN+1];
struct hostent *hp;
@ -24,7 +23,7 @@ char *hostname(family, ip)
if (family == AF_INET) {
ipa.s_addr = *(u_32_t *)ip;
if (ipa.s_addr == htonl(0xfedcba98))
return "test.host.dots";
return ("test.host.dots");
}
if ((opts & OPT_NORESOLVE) == 0) {
@ -34,7 +33,7 @@ char *hostname(family, ip)
*hp->h_name != '\0') {
strncpy(hostbuf, hp->h_name, sizeof(hostbuf));
hostbuf[sizeof(hostbuf) - 1] = '\0';
return hostbuf;
return (hostbuf);
}
np = getnetbyaddr(ipa.s_addr, AF_INET);
@ -42,19 +41,19 @@ char *hostname(family, ip)
*np->n_name != '\0') {
strncpy(hostbuf, np->n_name, sizeof(hostbuf));
hostbuf[sizeof(hostbuf) - 1] = '\0';
return hostbuf;
return (hostbuf);
}
}
}
if (family == AF_INET) {
return inet_ntoa(ipa);
return (inet_ntoa(ipa));
}
#ifdef USE_INET6
(void) inet_ntop(AF_INET6, ip, hostbuf, sizeof(hostbuf) - 1);
hostbuf[MAXHOSTNAMELEN] = '\0';
return hostbuf;
return (hostbuf);
#else
return "IPv6";
return ("IPv6");
#endif
}

View File

@ -10,8 +10,8 @@
#include "ipf.h"
char *portname(pr, port)
int pr, port;
char *
portname(int pr, int port)
{
static char buf[32];
struct protoent *p = NULL;
@ -28,16 +28,16 @@ char *portname(pr, port)
NULL : sv1;
}
if (sv)
return buf;
return (buf);
} else if ((pr != -2) && (p = getprotobynumber(pr))) {
if ((sv = getservbyport(htons(port), p->p_name))) {
strncpy(buf, sv->s_name, sizeof(buf)-1);
buf[sizeof(buf)-1] = '\0';
return buf;
return (buf);
}
}
}
(void) sprintf(buf, "%d", port);
return buf;
return (buf);
}

View File

@ -11,10 +11,7 @@
ipstate_t *
printstate(sp, opts, now)
ipstate_t *sp;
int opts;
u_long now;
printstate(ipstate_t *sp, int opts, u_long now)
{
struct protoent *pr;
synclist_t ipsync;
@ -210,7 +207,7 @@ printstate(sp, opts, now)
if (kmemcpy((char *)&ipsync, (u_long)sp->is_sync,
sizeof(ipsync))) {
PRINTF("status could not be retrieved\n");
return NULL;
return (NULL);
}
PRINTF("idx %d num %d v %d pr %d rev %d\n",
@ -220,5 +217,5 @@ printstate(sp, opts, now)
PRINTF("not synchronized\n");
}
return sp->is_next;
return (sp->is_next);
}