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