forked from unpbook/unpv13e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprmyaddrs1.lc
19 lines (14 loc) · 822 Bytes
/
prmyaddrs1.lc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "unp.h"## 1 ##src/names/prmyaddrs1.c##
char **my_addrs(int *);## 2 ##src/names/prmyaddrs1.c##
int## 3 ##src/names/prmyaddrs1.c##
main(int argc, char **argv)## 4 ##src/names/prmyaddrs1.c##
{## 5 ##src/names/prmyaddrs1.c##
int addrtype;## 6 ##src/names/prmyaddrs1.c##
char **pptr, buf[INET6_ADDRSTRLEN];## 7 ##src/names/prmyaddrs1.c##
if ((pptr = my_addrs(&addrtype)) == NULL)## 8 ##src/names/prmyaddrs1.c##
err_quit("my_addrs error");## 9 ##src/names/prmyaddrs1.c##
for (; *pptr != NULL; pptr++)## 10 ##src/names/prmyaddrs1.c##
printf("\taddress: %s\n",## 11 ##src/names/prmyaddrs1.c##
Inet_ntop(addrtype, *pptr, buf, sizeof(buf)));## 12 ##src/names/prmyaddrs1.c##
exit(0);## 13 ##src/names/prmyaddrs1.c##
}## 14 ##src/names/prmyaddrs1.c##