Author: aschnell
Date: Mon Apr 20 11:13:51 2009
New Revision: 56841
URL: http://svn.opensuse.org/viewcvs/yast?rev=56841&view=rev
Log:
- include hostname and datetime in storage graph
Modified:
trunk/storage/libstorage/src/AppUtil.cc
trunk/storage/libstorage/src/AppUtil.h
trunk/storage/libstorage/src/Graph.cc
Modified: trunk/storage/libstorage/src/AppUtil.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.cc?rev=56841&r1=56840&r2=56841&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AppUtil.cc (original)
+++ trunk/storage/libstorage/src/AppUtil.cc Mon Apr 20 11:13:51 2009
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include
#include <string>
#include
@@ -457,6 +458,29 @@
}
+ string
+ hostname()
+ {
+ struct utsname buf;
+ if (uname(&buf) != 0)
+ return string("unknown");
+ return string(buf.nodename) + "." + string(buf.domainname);
+ }
+
+
+ string
+ datetime()
+ {
+ time_t t1 = time(NULL);
+ struct tm t2;
+ gmtime_r(&t1, &t2);
+ char buf[64 + 1];
+ if (strftime(buf, sizeof(buf), "%F %T %Z", &t2) == 0)
+ return string("unknown");
+ return string(buf);
+ }
+
+
const string app_ws = " \t\n";
}
Modified: trunk/storage/libstorage/src/AppUtil.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/AppUtil.h?rev=56841&r1=56840&r2=56841&view=diff
==============================================================================
--- trunk/storage/libstorage/src/AppUtil.h (original)
+++ trunk/storage/libstorage/src/AppUtil.h Mon Apr 20 11:13:51 2009
@@ -78,6 +78,9 @@
string sformat(const char* format, ...);
+ string hostname();
+ string datetime();
+
inline const char* _(const char* msgid)
{
Modified: trunk/storage/libstorage/src/Graph.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Graph.cc?rev=56841&r1=56840&r2=56841&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Graph.cc (original)
+++ trunk/storage/libstorage/src/Graph.cc Mon Apr 20 11:13:51 2009
@@ -30,8 +30,7 @@
struct Node
{
Node(NodeType type, const string& id, const string& label, unsigned long long sizeK)
- : type(type), id(id), label(label), sizeK(sizeK)
- {}
+ : type(type), id(id), label(label), sizeK(sizeK) {}
NodeType type;
string id;
@@ -45,8 +44,7 @@
struct Edge
{
Edge(EdgeType type, const string& id1, const string& id2)
- : type(type), id1(id1), id2(id2)
- {}
+ : type(type), id1(id1), id2(id2) {}
EdgeType type;
string id1;
@@ -57,8 +55,7 @@
struct Rank
{
Rank(NodeType type, const char* name)
- : type(type), name(name)
- {}
+ : type(type), name(name) {}
NodeType type;
string name;
@@ -377,8 +374,11 @@
ofstream out(filename.c_str());
+ classic(out);
out << "// generated by YaST (" << PACKAGE_STRING << ")" << endl;
+ out << "// " << hostname() << ", " << datetime() << endl;
+ out << endl;
out << "digraph storage" << endl;
out << "{" << endl;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org