Last change
on this file since 161 was
49,
checked in by Sam Hocevar, 15 years ago
|
- Imported original public domain release, for future reference.
|
-
Property svn:keywords set to
Id
|
File size:
380 bytes
|
Line | |
---|
1 | #include <sys/types.h> |
---|
2 | #include <sys/socket.h> |
---|
3 | #include <netinet/in.h> |
---|
4 | #include <netdb.h> |
---|
5 | |
---|
6 | main(int argc, char **argv) |
---|
7 | { |
---|
8 | struct hostent *hn=gethostbyname(argv[1]); |
---|
9 | if (hn) |
---|
10 | { |
---|
11 | printf("host %s\n",hn->h_name); |
---|
12 | char **a=hn->h_addr_list; |
---|
13 | while (*a) |
---|
14 | { |
---|
15 | char *b=*a; |
---|
16 | printf("address %d.%d.%d.%d\n",b[0],b[1],b[2],b[3]); |
---|
17 | a++; |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.