int nslookup_main(int argc, char **argv) { /* We allow 1 or 2 arguments. * The first is the name to be looked up and the second is an * optional DNS server with which to do the lookup. * More than 3 arguments is an error to follow the pattern of the * standard nslookup */ if (!argv[1] || argv[1][0] == '-' || argc > 3) bb_show_usage(); /* initialize DNS structure _res used in printing the default * name server and in the explicit name server option feature. */ res_init(); /* rfc2133 says this enables IPv6 lookups */ /* (but it also says "may be enabled in /etc/resolv.conf") */ /*_res.options |= RES_USE_INET6;*/ set_default_dns(argv[2]); server_print(); /* getaddrinfo and friends are free to request a resolver * reinitialization. Just in case, set_default_dns() again * after getaddrinfo (in server_print). This reportedly helps * with bug 675 "nslookup does not properly use second argument" * at least on Debian Wheezy and Openwrt AA (eglibc based). */ set_default_dns(argv[2]); return print_host(argv[1], "Name:"); }
/* ________________________________________________________________________ */ int main(int argc, char **argv) { struct hostent *host = NULL; #if 0 res_init(); server_print(); #endif host = gethostbyaddr_wrapper(argv[1]); if (host) { printf("Server :::::::::>> %s\n", host->h_name); /* addr_list_fprint(host->h_addr_list); */ } else printf("Server :::::::::>> Host not found\n"); return EXIT_SUCCESS; #if 0 if (is_ip_address(argv[1])) { host = gethostbyaddr_wrapper(argv[1]); } else { host = gethostbyname(argv[1]); } hostent_fprint(host, 0); return EXIT_SUCCESS; #endif }
/* ________________________________________________________________________ */ int nslookup_main(int argc, char **argv) { struct hostent *host; /* * initialize DNS structure _res used in printing the default * name server and in the explicit name server option feature. */ res_init(); /* * We allow 1 or 2 arguments. * The first is the name to be looked up and the second is an * optional DNS server with which to do the lookup. * More than 3 arguments is an error to follow the pattern of the * standard nslookup */ if (argc < 2 || *argv[1]=='-' || argc > 3) bb_show_usage(); else if(argc == 3) set_default_dns(argv[2]); server_print(); if (is_ip_address(argv[1])) { host = gethostbyaddr_wrapper(argv[1]); } else { host = xgethostbyname(argv[1]); } hostent_fprint(host, "Name: "); return EXIT_SUCCESS; }
int nslookup_main(int argc, char **argv) { /* We allow 1 or 2 arguments. * The first is the name to be looked up and the second is an * optional DNS server with which to do the lookup. * More than 3 arguments is an error to follow the pattern of the * standard nslookup */ if (!argv[1] || argv[1][0] == '-' || argc > 3) bb_show_usage(); #ifndef __UC_LIBC__ /* initialize DNS structure _res used in printing the default * name server and in the explicit name server option feature. */ res_init(); #endif /* rfc2133 says this enables IPv6 lookups */ /* (but it also says "may be enabled in /etc/resolv.conf") */ /*_res.options |= RES_USE_INET6;*/ if (argv[2]) set_default_dns(argv[2]); server_print(); return print_host(argv[1], "Name:"); }
int main(int argc, char *argv[]) { if (argc == 1) { #ifdef _WIN32 server Server(argv[0]); thread server_print(&server::server_print, Server); thread server_send(&server::server_send, Server); server_send.join(); server_print.join(); Server.stop_server(); #endif #ifdef __linux__ server Server; thread server_send(&server::server_send, Server, argv[0]); thread server_print(&server::server_print, Server); server_print.join(); server_send.join(); Server.stop_server(); #endif } else { #ifdef _WIN32 client Client; thread client_print(&client::client_print, Client); thread client_send(&client::client_send, Client); client_send.join(); client_print.join(); Client.stop_client(); #endif #ifdef __linux__ client Client(argv[2], argv[3], argv[4], argv[5], argv[6]); thread client_print(&client::client_print, Client); thread client_send(&client::client_send, Client); client_send.join(); client_print.join(); Client.stop_client(); #endif } return 0; }
/* ________________________________________________________________________ */ int nslookup_main(int argc, char **argv) { struct hostent *host; if (argc < 2 || *argv[1]=='-') { show_usage(); } res_init(); server_print(); if (is_ip_address(argv[1])) { host = gethostbyaddr_wrapper(argv[1]); } else { host = gethostbyname(argv[1]); } hostent_fprint(host, 0); return EXIT_SUCCESS; }
void do_console() { char buf[1024]; while(1) { scanf( "%s", buf ); if( strcmp( buf, "quit" ) == 0 ){ break; }else if( strcmp( buf, "stop" ) == 0 ){ server_stop( websrv ); }else if( strcmp( buf, "start" ) == 0 ){ server_start( websrv ); }else if( strcmp( buf, "clear" ) == 0 ){ server_clear( websrv ); }else if( strcmp( buf, "reload" ) == 0 ){ server_reload( websrv ); }else if( strcmp( buf, "print" ) == 0 ){ server_print( websrv ); memory_print(); }else{ SLEEP(3); //Temperory fixed for linux nohup! } } }