Example program to print IP address.  
More...
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include "JSystem/JNetwork.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char *argv[]) | 
|   | 
Example program to print IP address. 
- Author
 - mdejong 
 
Definition in file getIPaddress.cc.
 
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char *  | 
          argv[]  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 27 of file getIPaddress.cc.
   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);
 
   69     FATAL(
"Invalid option " << option << endl);
 
int getIPnumber(const std::string &host_name)
Get IP number. 
 
Utility class to parse command line options. 
 
std::string getIPaddress(const int ip)
Get IP address (decimal-dot notation). 
 
unsigned short getSubaddress(const int ip)
Get host identifier within network. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
std::string getHostname()
Get host name.