diff --git a/lib/str_util.cpp b/lib/str_util.cpp
index b13ceac8f9..1d9bfee816 100644
--- a/lib/str_util.cpp
+++ b/lib/str_util.cpp
@@ -717,3 +717,26 @@ char* lf_terminate(char* p) {
p[n+1] = 0;
return p;
}
+
+void parse_serialnum(char* in, char* boinc, char* vbox, char* coprocs) {
+ strcpy(boinc, "");
+ strcpy(vbox, "");
+ strcpy(coprocs, "");
+ while (*in) {
+ if (*in != '[') break; // format error
+ char* p = strchr(in, ']');
+ if (!p) break; // format error
+ p++;
+ char c = *p;
+ *p = 0;
+ if (strstr(in, "BOINC")) {
+ strcpy(boinc, in);
+ } else if (strstr(in, "vbox")) {
+ strcpy(vbox, in);
+ } else {
+ strcat(coprocs, in);
+ }
+ *p = c;
+ in = p;
+ }
+}
diff --git a/lib/str_util.h b/lib/str_util.h
index a1adaf9a6f..263c604268 100644
--- a/lib/str_util.h
+++ b/lib/str_util.h
@@ -75,6 +75,13 @@ extern int string_substitute(
//
extern void mysql_timestamp(double, char*);
+// parse host.serialnum into component parts.
+// Given a string of the form
+// [BOINC|7.2.42][CUDA|GeForce GTX 860M|1|2048MB|34052|101][INTEL|Intel(R) HD Graphics 4600|1|1752MB||102][vbox|4.2.16]
+// split it into the BOINC, vbox, and other (coproc) parts
+//
+extern void parse_serialnum(char* in, char* boinc, char* vbox, char* coprocs);
+
// take a malloced string.
// if \n is not last char, add it.
//
diff --git a/sched/db_dump.cpp b/sched/db_dump.cpp
index c56ce0f8d8..97c8dd8328 100644
--- a/sched/db_dump.cpp
+++ b/sched/db_dump.cpp
@@ -345,14 +345,30 @@ void write_host(HOST& host, FILE* f, bool detail) {
);
// host.serialnum stores coprocessor description
+ // and client and vbox versions.
//
- if (strlen(host.serialnum)) {
- char serialnum[1024];
- xml_escape(host.serialnum, serialnum, sizeof(serialnum));
+ char boinc[256], vbox[256], coprocs[256];
+ char buf[1024];
+ parse_serialnum(host.serialnum, boinc, vbox, coprocs);
+ if (strlen(boinc)) {
+ xml_escape(boinc, buf, sizeof(buf));
fprintf(f,
- " %s\n", serialnum
+ " %s\n", buf
);
}
+ if (strlen(vbox)) {
+ xml_escape(vbox, buf, sizeof(buf));
+ fprintf(f,
+ " %s\n", buf
+ );
+ }
+ if (strlen(coprocs)) {
+ xml_escape(coprocs, buf, sizeof(buf));
+ fprintf(f,
+ " %s\n", buf
+ );
+ }
+
if (detail) {
fprintf(f,
" %d\n"