GRASS GIS 8 Programmer's Manual 8.2.0(2022)-exported
htmldriver/text.c
Go to the documentation of this file.
1
2/* Text.c - save text string into last_text buffer */
3
4#include <stdlib.h>
5#include <string.h>
6#include <grass/gis.h>
7#include "driverlib.h"
8#include "htmlmap.h"
9
10void HTML_Text(const char *text)
11{
12 int len = strlen(text);
13 const char *s;
14 char *d;
15
16 if (len > html.last_text_len) {
18 html.last_text = (char *)G_malloc(len + 1);
19 html.last_text_len = len;
20 }
21
22 /* copy string to last_text area, make sure we don't copy \n */
23 for (d = html.last_text, s = text; *s != '\0'; s++) {
24 if (*s != '\n') {
25 *d = *s;
26 d++;
27 }
28 }
29 *d = '\0';
30}
void G_free(void *buf)
Free allocated memory.
Definition: alloc.c:149
struct html_state html
void HTML_Text(const char *text)
char * last_text
Definition: htmlmap.h:29
int last_text_len
Definition: htmlmap.h:30