1 #include <rudiments/hostentry.h>
2 #include <rudiments/stdio.h>
3 
main(int argc,const char ** argv)4 int main(int argc, const char **argv) {
5 
6 	uint32_t	i;
7 
8 	// get the host entry for hostname "localhost"
9 	hostentry	he;
10 	he.initialize("localhost");
11 
12 	// print out details
13 	stdoutput.printf("	Name: %s\n",he.getName());
14 	stdoutput.printf("	Alias list:\n");
15 	for (i=0; he.getAliasList() && he.getAliasList()[i]; i++) {
16 		stdoutput.printf("		%s\n",he.getAliasList()[i]);
17 	}
18 	stdoutput.printf("	Address type: %d\n",he.getAddressType());
19 	stdoutput.printf("	Address length: %d\n",he.getAddressLength());
20 	stdoutput.printf("	Address list:\n");
21 	for (i=0; he.getAddressList() && he.getAddressList()[i]; i++) {
22 		const char	*addr=he.getAddressList()[i];
23 		stdoutput.printf("		%d.%d.%d.%d\n",
24 					addr[0],addr[1],addr[2],addr[3]);
25 	}
26 	stdoutput.printf("\n");
27 }
28