4 * Functions which handle "sticky notes"
14 #include <sys/types.h>
16 #include <sys/socket.h>
24 #include "webserver.h"
26 void display_note(long msgnum) {
29 char display_notetext[SIZ];
33 wprintf("<IMG ALIGN=MIDDLE SRC=\"/static/note.gif\">\n");
35 serv_printf("MSG0 %ld", msgnum);
36 serv_getln(buf, sizeof buf);
38 wprintf("%s<br />\n", &buf[4]);
43 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
45 /* Fill the buffer to at least 256 characters */
46 if ( (in_text) && (strlen(notetext) < 256) ) {
47 strcat(notetext, buf);
50 if ( (!in_text) && (!strcasecmp(buf, "text")) ) {
55 /* Now sanitize the buffer, and shorten it to just a small snippet */
56 for (i=0; i<strlen(notetext); ++i) {
57 if (isspace(notetext[i])) notetext[i] = ' ';
59 strcpy(¬etext[72], "...");
61 /* Make it HTML-happy and print it. */
62 stresc(display_notetext, notetext, 1, 1);
63 wprintf("%s<br />\n", display_notetext);