ksgi

Форк
0
/
khtml_putc.3 
104 строки · 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_PUTC 3
19
.Os
20
.Sh NAME
21
.Nm khtml_putc
22
.Nd put character 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_putc
33
.Fa "struct kreq *req"
34
.Fa "char c"
35
.Fc
36
.Sh DESCRIPTION
37
Writes a character
38
.Fa c
39
to a context
40
.Fa req
41
initialiswed with
42
.Xr khtml_open 3 .
43
The character is HTML escaped, for example, the left-angle bracket
44
.Qq <
45
is rendered as
46
.Qq &lt; .
47
.Sh RETURN VALUES
48
Returns an
49
.Ft enum kcgi_err
50
indicating the error state.
51
.Bl -tag -width -Ds
52
.It Dv KCGI_OK
53
Success (not an error).
54
.It Dv KCGI_ENOMEM
55
Internal memory allocation failure.
56
.It Dv KCGI_HUP
57
The output connection has been terminated.
58
For FastCGI connections, the current connection should be released with
59
.Xr khttp_free 3
60
and parse loop reentered.
61
.It Dv KCGI_FORM
62
The connection is still expecting headers with
63
.Xr khttp_head 3 .
64
Indicates that
65
.Xr khttp_body 3
66
did not return with success or was not invoked.
67
For FastCGI connections, the current connection should be released with
68
.Xr khttp_free 3
69
and parse loop reentered.
70
.It Dv KCGI_SYSTEM
71
Internal system error writing to the output stream.
72
.El
73
.Sh EXAMPLES
74
The following outputs a simple HTML page.
75
It assumes
76
.Va r
77
is a
78
.Vt struct kreq
79
pointer.
80
For brevity, it does not do any error checking.
81
.Bd -literal -offset indent
82
khttp_head(r, kresps[KRESP_STATUS],
83
  "%s", khttps[KHTTP_200]);
84
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
85
  "%s", kmimetypes[KMIME_TEXT_HTML]);
86
khttp_body(r);
87
khtml_open(&req, r, 0);
88
khtml_elem(&req, KELEM_DOCTYPE);
89
khtml_elem(&req, KELEM_HTML);
90
khtml_elem(&req, KELEM_BODY);
91
khtml_elem(&req, KELEM_P);
92
khtml_putc(&req, 'H');
93
khtml_putc(&req, 'i');
94
khtml_putc(&req, '!');
95
khtml_close(&req);
96
.Ed
97
.Sh SEE ALSO
98
.Xr kcgihtml 3
99
.Sh STANDARDS
100
The referenced HTML5 standard is
101
.Lk https://www.w3.org/TR/html52 HTML5.2 .
102
.Sh AUTHORS
103
Written by
104
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
105

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

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

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

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