@@ -80,7 +80,7 @@ struct ReportData: map<string,ReportLine> {
string ascii() const {
int widths[3] = {0,0,0}; // max column widths: 0: DNS, 1: ports, 3: counts
int x;
char l[256]; l[255 ]=0;
char l[1024]; l[1023 ]=0;
string s, r, bk;
ReportData::const_iterator it;
@@ -90,7 +90,7 @@ struct ReportData: map<string,ReportLine> {
if(s.size()>widths[1]) widths[1]=s.size();
if(it->second.count>widths[2]) widths[2] = it->second.count;
}
// Now conver count max to cols
// Now convert count max to cols
for(x=0; widths[2]; x++) widths[2] /= 10;
widths[2] = x ? x : 1;
// min col widths for titles
@@ -103,6 +103,8 @@ struct ReportData: map<string,ReportLine> {
"+"+string(widths[1]+2, '-')+
"+"+string(widths[2]+2, '-')+
"+\n";
if(bk.size()>=sizeof(l)-1) throw std::runtime_error(
"ReportData::ascii: report row width is too long.");
s = "| %-"+str(widths[0])+"s | %-"+str(widths[1])+"s | %"+str(widths[2])+"d |\n";
r = bk;
snprintf(l, sizeof(l)-1,
@@ -227,6 +229,5 @@ namespace cppdb {
if(rec.name=="") rec.name=rec.them;
rpt.add(rec.name, str(rec.them_port), ct);
}
else cerr << "ignored" << endl;
}
}