27int main(
int argc,
char* argv[])
37 JParser<> zap(
"Example program to print IP address.");
39 zap[
'H'] =
make_field(host_name) =
"localhost";
41 << IP_address <<
" -> IP address; "
42 << IP_subhex <<
" -> IP sub-address (hex); "
43 << IP_subdec <<
" -> IP sub-address (dec); "
44 << Hostname <<
" -> host name") = IP_address, IP_subhex, IP_subdec, Hostname;
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
52 int ip = getIPnumber(host_name);
57 cout << getIPaddress(ip) << endl;
return 0;
60 cout << hex << getSubaddress(ip) << endl;
return 0;
63 cout << dec << getSubaddress(ip) << endl;
return 0;
66 cout << dec << getHostname(ip) << endl;
return 0;
69 FATAL(
"Invalid option " << option << endl);
General purpose messaging.
Hostname and IP address functions.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
int main(int argc, char *argv[])
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).