Jeff, is the attached patch what you want? Lines should be small enough
on most machines now.
Brice
diff --git a/utils/lstopo-draw.c b/utils/lstopo-draw.c
index 8ecde34..10282b7 100644
--- a/utils/lstopo-draw.c
+++ b/utils/lstopo-draw.c
@@ -659,11 +659,11 @@ misc_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
static void
fig(hwloc_topology_t topology, struct draw_methods *methods, int logical, int legend, hwloc_obj_t level, void *output, unsigned depth, unsigned x, unsigned y)
{
- unsigned totwidth, totheight;
+ unsigned totwidth, totheight, offset;
time_t t;
char text[64];
char *date;
- char hostname[64];
+ char hostname[64] = "";
int n;
unsigned long hostname_size = sizeof(hostname);
@@ -676,18 +676,23 @@ fig(hwloc_topology_t topology, struct draw_methods *methods, int logical, int le
date[n-1] = 0;
if (legend) {
- if (hwloc_topology_is_thissystem(topology) &&
+ if (hwloc_topology_is_thissystem(topology))
#ifdef HWLOC_WIN_SYS
- GetComputerName(hostname, &hostname_size)
+ GetComputerName(hostname, &hostname_size);
#else
- !gethostname(hostname, hostname_size)
+ gethostname(hostname, hostname_size);
#endif
- )
- snprintf(text, sizeof(text), "%s IDs for %s on %s", logical ? "logical" : "physical", hostname, date);
- else
- snprintf(text, sizeof(text), "%s IDs on %s", logical ? "logical" : "physical", date);
- methods->box(output, 0xff, 0xff, 0xff, depth, 0, totwidth, totheight, gridsize + fontsize + gridsize);
- methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize, text);
+ snprintf(text, sizeof(text), "%s IDs", logical ? "logical" : "physical");
+ if (*hostname) {
+ methods->box(output, 0xff, 0xff, 0xff, depth, 0, totwidth, totheight, gridsize*4 + fontsize*3);
+ methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize, hostname);
+ offset = gridsize + fontsize;
+ } else {
+ methods->box(output, 0xff, 0xff, 0xff, depth, 0, totwidth, totheight, gridsize*3 + fontsize*2);
+ offset = 0;
+ }
+ methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize + offset, text);
+ methods->text(output, 0, 0, 0, fontsize, depth, gridsize, totheight + gridsize + offset + fontsize + gridsize, date);
}
}