示例#1
0
void
main(int argc, char **argv)
{
	Ipinfo ii;
	uchar addrs[2][IPaddrlen];
	int i, j;

	db = ndbopen(0);

	fmtinstall('E', eipconv);
	fmtinstall('I', eipconv);
	if(argc < 2)
		exits(0);
	if(strchr(argv[1], '.')){
		if(ipinfo(db, 0, argv[1], 0, &ii) < 0)
			exits(0);
	} else {
		if(ipinfo(db, argv[1], 0, 0, &ii) < 0)
			exits(0);
	}
	print("a %I m %I n %I f %s e %E a %I\n", ii.ipaddr,
		ii.ipmask, ii.ipnet, ii.bootf, ii.etheraddr, ii.auip);

	i = lookupserver("auth", addrs, &ii);
	print("lookupserver returns %d\n", i);
	for(j = 0; j < i; j++)
		print("%I\n", addrs[j]);
	i = lookupserver("dns", addrs, &ii);
	print("lookupserver returns %d\n", i);
	for(j = 0; j < i; j++)
		print("%I\n", addrs[j]);
}
示例#2
0
文件: testlook.c 项目: aahud/harvey
void
main(int argc, char **argv)
{
	Ipinfo ii;
	Ndb *db;

	db = ndbopen(0);

	fmtinstall('E', eipconv);
	fmtinstall('I', eipconv);
	if(argc < 2)
		exits(0);
	if(strchr(argv[1], '.')){
		if(ipinfo(db, 0, argv[1], 0, &ii) < 0)
			exits(0);
	} else {
		if(ipinfo(db, argv[1], 0, 0, &ii) < 0)
			exits(0);
	}
	fprint(2, "a %I m %I n %I f %s e %E\n", ii.ipaddr,
		ii.ipmask, ii.ipnet, ii.bootf, ii.etheraddr);
}