Changeset 44 for trunk/lib/Stats.cc
- Timestamp:
- Jan 13, 2006, 7:38:16 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Stats.cc
r42 r44 5 5 #include "utility.h" 6 6 7 #include <cstdio>8 #include <fstream>9 10 7 #include <algorithm> 11 8 #include <map> … … 13 10 #include <sstream> 14 11 #include <string> 12 #include <unistd.h> 15 13 #include <utility> 16 14 #include <vector> 17 18 #include <iostream>19 15 20 16 namespace theplu{ … … 69 65 std::string Stats::plot(void) const 70 66 { 71 char name[]="svnstatXXXXXX"; 72 if (!strlen(mktemp(name))) { 73 std::cerr << "Failed to get unique filename: " << name << std::endl; 74 exit(-1); 75 } 76 std::string cmd=std::string("set term png; set output '")+name+".png'"; 67 char name[]="svnstat_XXXXXX.png"; 68 if (mkstemps(name,4)==-1) 69 throw std::runtime_error(std::string("Failed to get unique filename: ") + 70 name); 71 std::string cmd=std::string("set term png; set output '")+name+"'"; 77 72 gnuplot_pipe_.command(cmd); 78 73 gnuplot_pipe_.command("set key left Left reverse"); … … 95 90 gnuplot_pipe_.command(cmd); 96 91 gnuplot_pipe_.command("replot"); 97 return std::string(name)+".png"; 98 } 99 100 void Stats::print(std::ostream& os) const 101 { 102 os << "<p><img src='" << plot() << "' alt='[svnstat plot]' border=0></p>\n"; 92 return name; 103 93 } 104 94
Note: See TracChangeset
for help on using the changeset viewer.