forked from KolibriOS/kolibrios
- added network.obj loader
- added _ksys_kill_process function in libck.a ktcc git-svn-id: svn://kolibrios.org@8337 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
29
programs/develop/ktcc/trunk/samples/net/nslookup.c
Normal file
29
programs/develop/ktcc/trunk/samples/net/nslookup.c
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <net/network.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct addrinfo *res;
|
||||
char host[256];
|
||||
|
||||
void main()
|
||||
{
|
||||
con_init_console_dll();
|
||||
networklib_init();
|
||||
con_set_title("nslookup demo");
|
||||
printf("Host name to resolve: ");
|
||||
con_gets(host, 256);
|
||||
host[strlen(host)-1] = '\0';
|
||||
if(getaddrinfo(host ,0, 0, &res)!=0)
|
||||
{
|
||||
puts("Host not found!");
|
||||
freeaddrinfo(res);
|
||||
con_exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s",inet_ntoa(res->ai_addr->sin_addr));
|
||||
freeaddrinfo(res);
|
||||
con_exit(0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user