00001 #ifdef TEST 00002 #include "headers.h" 00003 00004 const static string socketAddressCommandString = "socketAddress"; 00005 const static string readCommandString = "read"; 00006 00007 00008 string 00009 SocketAddressCommand::getCommandString() { 00010 return socketAddressCommandString; 00011 } 00012 00013 00014 void 00015 SocketAddressCommand::run(std::ostream& s) { 00016 if (m_args[1].empty()) { 00017 getHelp(s); 00018 return; 00019 } 00020 00021 SocketAddress socketAddress; 00022 00023 if (m_args[1] == showCommandString) { 00024 } 00025 else if (m_args[1] == readCommandString) { 00026 char buf[100]; 00027 sprintf(buf, "%s:%s", m_args[2].c_str(), m_args[3].c_str()); 00028 s << "Reading \"" << buf << "\"\n\n"; 00029 socketAddress.read(buf); 00030 } 00031 else { 00032 getHelp(s); 00033 return; 00034 } 00035 s << socketAddress; 00036 } 00037 00038 00039 void 00040 SocketAddressCommand::getHtmlInterface(std::ostream& s) { 00041 s << "<h2>Socket Address</h2>"; 00042 beginUl(s); 00043 generateHtmlSubcmd(s, showCommandString, "show"); 00044 generateHtmlSubcmdArg2(s, readCommandString, "Read socket address, IP:", " Port:", "Read"); 00045 endUl(s); 00046 } 00047 00048 00049 void 00050 SocketAddressCommand::getHelp(std::ostream& s) { 00051 s << socketAddressCommandString 00052 << " " << showCommandString << "\n" 00053 << " " << readCommandString << "\n"; 00054 } 00055 00056 #endif 00057 00058