ksgi

Форк
0
/
kxml_putc.3 
97 строк · 2.5 Кб
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 KXML_PUTC 3
19
.Os
20
.Sh NAME
21
.Nm kxml_putc
22
.Nd put character content for kcgixml
23
.Sh LIBRARY
24
.Lb libkcgixml
25
.Sh SYNOPSIS
26
.In sys/types.h
27
.In stdarg.h
28
.In stdint.h
29
.In kcgi.h
30
.In kcgixml.h
31
.Ft enum kcgi_err
32
.Fo kxml_putc
33
.Fa "struct kxmlreq *req"
34
.Fa "char c"
35
.Fc
36
.Sh DESCRIPTION
37
Writes a NUL-terminated string
38
.Fa cp
39
to a context
40
.Fa req
41
initialised with
42
.Xr kxml_open 3 .
43
The character is XML escaped.
44
.Sh RETURN VALUES
45
Returns an
46
.Ft enum kcgi_err
47
indicating the error state.
48
.Bl -tag -width -Ds
49
.It Dv KCGI_OK
50
Success (not an error).
51
.It Dv KCGI_ENOMEM
52
Internal memory allocation failure.
53
.It Dv KCGI_HUP
54
The output connection has been terminated.
55
For FastCGI connections, the current connection should be released with
56
.Xr khttp_free 3
57
and parse loop reentered.
58
.It Dv KCGI_FORM
59
The connection is still expecting headers with
60
.Xr khttp_head 3 .
61
Indicates that
62
.Xr khttp_body 3
63
did not return with success or was not invoked.
64
For FastCGI connections, the current connection should be released with
65
.Xr khttp_free 3
66
and parse loop reentered.
67
.It Dv KCGI_SYSTEM
68
Internal system error writing to the output stream.
69
.El
70
.Sh EXAMPLES
71
The following outputs a simple XML page.
72
It assumes
73
.Va r
74
is a
75
.Vt struct kreq
76
pointer.
77
For brevity, it does not do any error checking.
78
.Bd -literal -offset indent
79
const char *const elems[] =
80
  { "foo", "bar", "baz" };
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_XML]);
85
khttp_body(r);
86
kxml_open(&req, r, elems, 3);
87
kxml_push(&req, 0); /* foo */
88
kxml_putc(&req, 'H');
89
kxml_putc(&req, 'i');
90
kxml_putc(&req, '!');
91
kxml_close(&req);
92
.Ed
93
.Sh SEE ALSO
94
.Xr kcgixml 3
95
.Sh AUTHORS
96
Written by
97
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
98

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

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

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

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