--- lib/htmllog.c 2007/07/18 21:20:15 1.57 +++ lib/htmllog.c 2007/07/20 11:26:04 @@ -435,7 +435,7 @@ } -static char *nameandcomment(namelist_t *host, char *hostname) +static char *nameandcomment(namelist_t *host, char *hostname, int usetooltip) { static char *result = NULL; char *cmt, *disp, *hname; @@ -447,12 +447,19 @@ hname = bbh_item(host, BBH_HOSTNAME); disp = bbh_item(host, BBH_DISPLAYNAME); - cmt = bbh_item(host, BBH_COMMENT); + cmt = bbh_item(host, BBH_COMMENT); if (!cmt) cmt = bbh_item(host, BBH_DESCRIPTION); + if (disp == NULL) disp = hname; if (cmt) { - result = (char *)malloc(strlen(disp) + strlen(cmt) + 4); - sprintf(result, "%s (%s)", disp, cmt); + if (usetooltip) { + result = (char *)malloc(strlen(disp) + strlen(cmt) + 30); + sprintf(result, "%s", cmt, disp); + } + else { + result = (char *)malloc(strlen(disp) + strlen(cmt) + 4); + sprintf(result, "%s (%s)", disp, cmt); + } return result; } else @@ -492,7 +499,7 @@ doctarget = strdup(target); } -char *hostnamehtml(char *hostname, char *defaultlink) +char *hostnamehtml(char *hostname, char *defaultlink, int usetooltip) { static char result[4096]; void *hinfo = hostinfo(hostname); @@ -515,21 +522,21 @@ if (documentationurl) { snprintf(result, sizeof(result), "%s", urldoclink(documentationurl, hostname), - doctarget, xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname)); + doctarget, xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname, usetooltip)); } else if ((hostlinkurl = hostlink(hostname)) != NULL) { snprintf(result, sizeof(result), "%s", - hostlinkurl, doctarget, xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname)); + hostlinkurl, doctarget, xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname, usetooltip)); } else if (defaultlink) { /* Provide a link to the page where this host lives */ snprintf(result, sizeof(result), "%s", xgetenv("BBWEB"), defaultlink, doctarget, - xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname)); + xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname, usetooltip)); } else { snprintf(result, sizeof(result), "%s", - xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname)); + xgetenv("MKBBROWFONT"), nameandcomment(hinfo, hostname, usetooltip)); } return result; --- lib/htmllog.h 2007/07/12 12:27:47 1.17 +++ lib/htmllog.h 2007/07/20 11:00:51 @@ -33,6 +33,6 @@ extern void setdocurl(char *url); extern void setdoctarget(char *target); -extern char *hostnamehtml(char *hostname, char *defaultlink); +extern char *hostnamehtml(char *hostname, char *defaultlink, int usetooltip); #endif --- bbdisplay/pagegen.c 2007/07/18 10:44:14 1.183 +++ bbdisplay/pagegen.c 2007/07/20 11:20:02 @@ -397,7 +397,9 @@ else rowcount++; fprintf(output, "%s", - hostnamehtml(h->hostname, ((pagetype != PAGE_BB) ? hostpage_link(h) : NULL)) ); + hostnamehtml(h->hostname, + ((pagetype != PAGE_BB) ? hostpage_link(h) : NULL), + (pagetype == PAGE_BB) ) ); /* Then the columns. */ for (gc = groupcols; (gc); gc = gc->next) { --- web/hobbit-nkview.c 2007/07/18 21:20:15 1.22 +++ web/hobbit-nkview.c 2007/07/20 11:03:23 @@ -195,7 +195,7 @@ fprintf(output, "\n"); /* Print the hostname with a link to the NK info page */ - fprintf(output, "%s\n", hostnamehtml(itm->hostname, NULL)); + fprintf(output, "%s\n", hostnamehtml(itm->hostname, NULL, 0)); key = (char *)malloc(strlen(itm->hostname) + 1024); for (colhandle = rbtBegin(columns); (colhandle != rbtEnd(columns)); colhandle = rbtNext(columns, colhandle)) {