ksgi

Форк
0
/
khtml_ncr.3 
101 строка · 2.7 Кб
1
.\"	$Id$
2
.\"
3
.\" Copyright (c) 2020 Kristaps Dzonsons <kristaps@bsd.lv>
4
.\"
5
.\" Permission to use, copy, modify, and distribute this software for any
6
.\" purpose with or without fee is hereby granted, provided that the above
7
.\" copyright notice and this permission notice appear in all copies.
8
.\"
9
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
.\"
17
.Dd $Mdocdate$
18
.Dt KHTML_NCR 3
19
.Os
20
.Sh NAME
21
.Nm khtml_ncr
22
.Nd put character entity content for kcgihtml
23
.Sh LIBRARY
24
.Lb libkcgihtml
25
.Sh SYNOPSIS
26
.In sys/types.h
27
.In stdarg.h
28
.In stdint.h
29
.In kcgi.h
30
.In kcgihtml.h
31
.Ft enum kcgi_err
32
.Fo khttp_ncr
33
.Fa "struct kreq *req"
34
.Fa "uint32_t v"
35
.Fc
36
.Sh DESCRIPTION
37
Writes a character entity
38
.Fa v
39
to a context
40
.Fa req
41
initialised with
42
.Xr khtml_open 3 .
43
The value is formatted as
44
.Qq &#xNNNN; .
45
It is not checked for being a valid entity number.
46
.Sh RETURN VALUES
47
Returns an
48
.Ft enum kcgi_err
49
indicating the error state.
50
.Bl -tag -width -Ds
51
.It Dv KCGI_OK
52
Success (not an error).
53
.It Dv KCGI_ENOMEM
54
Internal memory allocation failure.
55
.It Dv KCGI_HUP
56
The output connection has been terminated.
57
For FastCGI connections, the current connection should be released with
58
.Xr khttp_free 3
59
and parse loop reentered.
60
.It Dv KCGI_FORM
61
The connection is still expecting headers with
62
.Xr khttp_head 3 .
63
Indicates that
64
.Xr khttp_body 3
65
did not return with success or was not invoked.
66
For FastCGI connections, the current connection should be released with
67
.Xr khttp_free 3
68
and parse loop reentered.
69
.It Dv KCGI_SYSTEM
70
Internal system error writing to the output stream.
71
.El
72
.Sh EXAMPLES
73
The following outputs a simple HTML page.
74
It assumes
75
.Va r
76
is a
77
.Vt struct kreq
78
pointer.
79
For brevity, it does not do any error checking.
80
.Bd -literal -offset indent
81
khttp_head(r, kresps[KRESP_STATUS],
82
  "%s", khttps[KHTTP_200]);
83
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
84
  "%s", kmimetypes[KMIME_TEXT_HTML]);
85
khttp_body(r);
86
khtml_open(&req, r, 0);
87
khtml_elem(&req, KELEM_DOCTYPE);
88
khtml_elem(&req, KELEM_HTML);
89
khtml_elem(&req, KELEM_BODY);
90
khtml_elem(&req, KELEM_P);
91
khtml_ncr(&req, 0x1F601); /* smiley */
92
khtml_close(&req);
93
.Ed
94
.Sh SEE ALSO
95
.Xr kcgihtml 3
96
.Sh STANDARDS
97
The referenced HTML5 standard is
98
.Lk https://www.w3.org/TR/html52 HTML5.2 .
99
.Sh AUTHORS
100
Written by
101
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
102

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.