/* also parse a.b.c.d addresses */
-struct hostent *hostutil_GetHostByName(ahost)
-register char *ahost; {
+struct hostent *hostutil_GetHostByName(register char *ahost)
+{
register int tc;
static struct hostent thostent;
static char *addrp[2];
memset(addr, 0, sizeof(addr));
while ((tc = *ahost++)) {
if (tc == '.') {
- if (dots >= 3) return (struct hostent *) 0; /* too many dots */
+ if (dots >= 3) return NULL; /* too many dots */
addr[dots++] = tval;
tval = 0;
}
- else if (tc > '9' || tc < '0') return (struct hostent *) 0;
+ else if (tc > '9' || tc < '0') return NULL;
else {
tval *= 10;
tval += tc - '0';
#ifdef h_addr
/* 4.3 system */
addrp[0] = addr;
- addrp[1] = (char *) 0;
+ addrp[1] = NULL;
thostent.h_addr_list = &addrp[0];
#else /* h_addr */
/* 4.2 and older systems */
else {
#ifdef AFS_NT40_ENV
if (afs_winsockInit()<0)
- return (struct hostent *)0;
+ return NULL;
#endif
return gethostbyname(ahost);
}
/* Translate an internet address into a nice printable string. The
* variable addr is in network byte order.
*/
-char *hostutil_GetNameByINet(addr)
- afs_uint32 addr;
+char *hostutil_GetNameByINet(afs_uint32 addr)
{
struct hostent *th;
static char tbuffer[256];
#ifdef AFS_NT40_ENV
if (afs_winsockInit()<0)
- return (char *)0;
+ return NULL;
#endif
th = gethostbyaddr((void *)&addr, sizeof(addr), AF_INET);
if (th) {
** w.x.y.z # machineName
** returns the network interface in network byte order
*/
-afs_uint32
-extractAddr(line, maxSize)
-char* line;
-int maxSize;
+afs_uint32 extractAddr(char *line, int maxSize)
{
char byte1[32], byte2[32], byte3[32], byte4[32];
int i=0;
** On Solaris, if we pass a 4 byte integer directly into inet_ntoa(), it
** causes a memory fault.
*/
-char* afs_inet_ntoa(afs_uint32 addr)
+char *afs_inet_ntoa(afs_uint32 addr)
{
struct in_addr temp;
temp.s_addr = addr;
}
/* same as above, but to a non-static buffer, must be freed by called */
-char* afs_inet_ntoa_r(afs_uint32 addr, char *buf)
+char *afs_inet_ntoa_r(afs_uint32 addr, char *buf)
{
int temp;