File: test_gethostent.c

package info (click to toggle)
proxychains-ng 4.17-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 456 kB
  • sloc: ansic: 3,651; sh: 376; makefile: 80
file content (24 lines) | stat: -rw-r--r-- 470 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <netdb.h>
#include <stdio.h>
#include "../src/common.c"

void printhostent(struct hostent *hp) {
	char ipbuf[16];
	pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
	printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n", 
		hp->h_aliases, 
		hp->h_length,
		hp->h_name,
		hp->h_addr_list,
		hp->h_addrtype,
		ipbuf
	);
}

int main(int argc, char** argv) {
	struct hostent *hp;
	while((hp = gethostent())) {
		printhostent(hp);
	}
	return 0;
}