FWIW, here's how I "solved" the problem when I found it. It's ugly, but
running in production and works.
char *htmlquoted(char *s)
{
/*
* This routine converts a plain string into an html-quoted string
*/
// Ulric was here: use several result buffers to overcome overwriting
problem
#if 0
static strbuffer_t *result = NULL;
#else
static strbuffer_t *result[] = {NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL};
static int rn = 0;
static int rn_max = sizeof(result)/sizeof(*result);
#endif
char *inp, *endp;
char c;
rn++;
if (rn >= rn_max) rn = 0;
if (!result[rn]) result[rn] = newstrbuffer(4096);
clearstrbuffer(result[rn]);
inp = s;
do {
endp = inp + strcspn(inp, "\"&<> ");
c = *endp;
if (endp > inp) addtobufferraw(result[rn], inp, endp-inp);
switch (c) {
case '"': addtobuffer(result[rn], """); break;
case '&': addtobuffer(result[rn], "&"); break;
case '<': addtobuffer(result[rn], "<"); break;
case '>': addtobuffer(result[rn], ">"); break;
case ' ': addtobuffer(result[rn], " "); break;
default: break;
}
inp = (c == '\0') ? NULL : endp+1;
} while (inp);
return STRBUF(result[rn]);
}
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1103428
Title:
Xymon history page does not work
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xymon/+bug/1103428/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs