GRASS GIS 8 Programmer's Manual
8.3.2(2024)-exported
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
9
void
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
}
G_free
void G_free(void *buf)
Free allocated memory.
Definition
alloc.c:150
driverlib.h
html
struct html_state html
Definition
htmldriver/graph_set.c:24
HTML_Text
void HTML_Text(const char *text)
Definition
htmldriver/text.c:9
htmlmap.h
html_state::last_text
char * last_text
Definition
htmlmap.h:26
html_state::last_text_len
int last_text_len
Definition
htmlmap.h:27
htmldriver
text.c
Generated on Fri May 24 2024 09:06:59 for GRASS GIS 8 Programmer's Manual by
1.9.8