diff options
Diffstat (limited to 'libc/inet/rpc/get_myaddress.c')
-rw-r--r-- | libc/inet/rpc/get_myaddress.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libc/inet/rpc/get_myaddress.c b/libc/inet/rpc/get_myaddress.c index cbfc05b8d..95ddc71b4 100644 --- a/libc/inet/rpc/get_myaddress.c +++ b/libc/inet/rpc/get_myaddress.c @@ -28,7 +28,9 @@ * Mountain View, California 94043 */ #if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; +static char sccsid[] = + + "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; #endif /* @@ -51,7 +53,7 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro"; /* DO use gethostbyname because it's portable */ #include <netdb.h> get_myaddress(addr) - struct sockaddr_in *addr; +struct sockaddr_in *addr; { char localhost[256 + 1]; struct hostent *hp; @@ -70,7 +72,7 @@ get_myaddress(addr) * don't use gethostbyname, which would invoke yellow pages */ get_myaddress(addr) - struct sockaddr_in *addr; +struct sockaddr_in *addr; { int s; char buf[BUFSIZ]; @@ -79,25 +81,25 @@ get_myaddress(addr) int len; if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - perror("get_myaddress: socket"); - exit(1); + perror("get_myaddress: socket"); + exit(1); } - ifc.ifc_len = sizeof (buf); + ifc.ifc_len = sizeof(buf); ifc.ifc_buf = buf; - if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) { + if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) { perror("get_myaddress: ioctl (get interface configuration)"); exit(1); } ifr = ifc.ifc_req; for (len = ifc.ifc_len; len; len -= sizeof ifreq) { ifreq = *ifr; - if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) { + if (ioctl(s, SIOCGIFFLAGS, (char *) &ifreq) < 0) { perror("get_myaddress: ioctl"); exit(1); } if ((ifreq.ifr_flags & IFF_UP) && - ifr->ifr_addr.sa_family == AF_INET) { - *addr = *((struct sockaddr_in *)&ifr->ifr_addr); + ifr->ifr_addr.sa_family == AF_INET) { + *addr = *((struct sockaddr_in *) &ifr->ifr_addr); addr->sin_port = htons(PMAPPORT); break; } |