|
3 | 3 | *is for IP V4 CIDR notation, but prepared for V6: just
|
4 | 4 | *add the necessary bits where the comments indicate.
|
5 | 5 | *
|
6 |
| - *$Id: network.c,v 1.1 1998/10/22 20:40:46 momjian Exp $ |
| 6 | + *$Id: network.c,v 1.2 1998/10/26 01:03:24 tgl Exp $ |
7 | 7 | *Jon Postel RIP 16 Oct 1998
|
8 | 8 | */
|
9 | 9 |
|
@@ -313,7 +313,7 @@ network_host(inet *ip)
|
313 | 313 | if (ip_family(ip)==AF_INET)
|
314 | 314 | {
|
315 | 315 | /* It's an IP V4 address: */
|
316 |
| -if (inet_net_ntop(AF_INET,&ip_v4addr(ip),32,tmp,sizeof(tmp))<0) |
| 316 | +if (inet_net_ntop(AF_INET,&ip_v4addr(ip),32,tmp,sizeof(tmp))==NULL) |
317 | 317 | {
|
318 | 318 | elog(ERROR,"unable to print host (%s)",strerror(errno));
|
319 | 319 | return (NULL);
|
@@ -358,7 +358,7 @@ network_broadcast(inet *ip)
|
358 | 358 | /* It's an IP V4 address: */
|
359 | 359 | intaddr=htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >>ip_bits(ip)));
|
360 | 360 |
|
361 |
| -if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0) |
| 361 | +if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL) |
362 | 362 | {
|
363 | 363 | elog(ERROR,"unable to print address (%s)",strerror(errno));
|
364 | 364 | return (NULL);
|
@@ -397,7 +397,7 @@ network_network(inet *ip)
|
397 | 397 | /* It's an IP V4 address: */
|
398 | 398 | intaddr=ntohl(ip_v4addr(ip))& (0xffffffff << (32-ip_bits(ip)));
|
399 | 399 |
|
400 |
| -if (inet_cidr_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0) |
| 400 | +if (inet_cidr_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL) |
401 | 401 | {
|
402 | 402 | elog(ERROR,"unable to print network (%s)",strerror(errno));
|
403 | 403 | return (NULL);
|
@@ -436,7 +436,7 @@ network_netmask(inet *ip)
|
436 | 436 | /* It's an IP V4 address: */
|
437 | 437 | intaddr=htonl((-1 << (32-ip_bits(ip)))&0xffffffff);
|
438 | 438 |
|
439 |
| -if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0) |
| 439 | +if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL) |
440 | 440 | {
|
441 | 441 | elog(ERROR,"unable to print netmask (%s)",strerror(errno));
|
442 | 442 | return (NULL);
|
|