[Icescan-cvs] IceScan iceoutput.h,1.20,1.21 icescan.cc,1.55,1.56
Status: Alpha
Brought to you by:
darkkey
From: yu l. <mc...@us...> - 2009-04-13 12:56:50
|
Update of /cvsroot/icescan/IceScan In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17000 Modified Files: iceoutput.h icescan.cc Log Message: Add xml output ,but just has header and footer Index: icescan.cc =================================================================== RCS file: /cvsroot/icescan/IceScan/icescan.cc,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** icescan.cc 10 Apr 2009 14:34:07 -0000 1.55 --- icescan.cc 13 Apr 2009 12:56:34 -0000 1.56 *************** *** 789,794 **** par->output_filenames[GREP].assign(argv[i+1]); i++; ! break; ! default: invalid_command(argv[0], "Invalid output type.",""); --- 789,797 ---- par->output_filenames[GREP].assign(argv[i+1]); i++; ! break; ! case 'X': ! par->output_filenames[XML].assign(argv[i+1]); ! i++; ! break; default: invalid_command(argv[0], "Invalid output type.",""); Index: iceoutput.h =================================================================== RCS file: /cvsroot/icescan/IceScan/iceoutput.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** iceoutput.h 15 Mar 2009 18:59:18 -0000 1.20 --- iceoutput.h 13 Apr 2009 12:56:34 -0000 1.21 *************** *** 8,11 **** --- 8,12 ---- #define MAX_SHOWED 7 + #define XML_INCIDENT " " class out_type{ *************** *** 119,123 **** std::ostringstream os; ! if(outs[TEXT].exists || outs[GREP].exists){ os.str().clear(); --- 120,124 ---- std::ostringstream os; ! if(outs[TEXT].exists || outs[GREP].exists || outs[XML].exists){ os.str().clear(); *************** *** 125,129 **** trim_last(tm, '\n'); ! os << "# " << ICENAME << " " << ICEVERSION << " started at " << tm << " as "; --- 126,130 ---- trim_last(tm, '\n'); ! os << "# " << ICENAME << " " << ICEVERSION << " started at " << tm << " as "; *************** *** 139,142 **** --- 140,155 ---- if(outs[GREP].exists) outs[GREP].out << os.str(); + //Ugly:) ,but the temp way to show the header + if(outs[XML].exists){ + std::ostringstream xml_os; + xml_os.str().clear(); + xml_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; + xml_os << "<IceScan>" << endl; + xml_os << XML_INCIDENT <<"<header>" <<endl; + xml_os << XML_INCIDENT << XML_INCIDENT << "<version>" << ICEVERSION << "</version>" << endl; + xml_os << XML_INCIDENT << XML_INCIDENT << "<start-time>" << tm << "</start-time>" << endl; + xml_os << XML_INCIDENT << "</header> " << endl; + outs[XML].out << xml_os.str(); + } } } *************** *** 154,158 **** std::ostringstream os; ! if(outs[TEXT].exists || outs[GREP].exists){ os.str().clear(); --- 167,171 ---- std::ostringstream os; ! if(outs[TEXT].exists || outs[GREP].exists || outs[XML].exists){ os.str().clear(); *************** *** 169,173 **** if(outs[GREP].exists) ! outs[GREP].out << os.str(); } --- 182,198 ---- if(outs[GREP].exists) ! outs[GREP].out << os.str(); ! ! if(outs[XML].exists){ ! std::ostringstream xml_os; ! xml_os.str().clear(); ! xml_os << XML_INCIDENT << "<footer>" <<endl; ! xml_os << XML_INCIDENT << XML_INCIDENT <<"<ips>" << up_targets << "</ips>" << endl; ! xml_os << XML_INCIDENT << XML_INCIDENT <<"<lapse-seconds>" << seconds << "</lapse-seconds>" << endl; ! xml_os << XML_INCIDENT << "</footer> " << endl; ! xml_os << "</IceScan>" << endl; ! outs[XML].out << xml_os.str(); ! } ! } *************** *** 507,514 **** outs[TEXT].out.open(fname.c_str()); ! //fname.assign(filename); ! //fname.append(".xml"); ! //outs[XML].exists = true; ! //outs[XML].out.open(fname.c_str()); fname.assign(filename); --- 532,539 ---- outs[TEXT].out.open(fname.c_str()); ! fname.assign(filename); ! fname.append(".xml"); ! outs[XML].exists = true; ! outs[XML].out.open(fname.c_str()); fname.assign(filename); |