ksgi

Форк
0
/
kxml_close.3 
99 строк · 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_CLOSE 3
19
.Os
20
.Sh NAME
21
.Nm kxml_close
22
.Nd close kcgixml context
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_close
33
.Fa "struct kxmlreq *req"
34
.Fc
35
.Sh DESCRIPTION
36
Closes
37
.Fa req ,
38
initialised with
39
.Xr kxml_open 3 .
40
All scopes opened with
41
.Xr kxml_push 3
42
and
43
.Xr kxml_pushattrs 3
44
are automatically closed.
45
After this,
46
.Fa req
47
may no longer be used.
48
.Sh RETURN VALUES
49
Returns an
50
.Ft enum kcgi_err
51
indicating the error state.
52
.Bl -tag -width -Ds
53
.It Dv KCGI_OK
54
Success (not an error).
55
.It Dv KCGI_ENOMEM
56
Internal memory allocation failure.
57
.It Dv KCGI_HUP
58
The output connection has been terminated.
59
For FastCGI connections, the current connection should be released with
60
.Xr khttp_free 3
61
and parse loop reentered.
62
.It Dv KCGI_FORM
63
The connection is still expecting headers with
64
.Xr khttp_head 3 .
65
Indicates that
66
.Xr khttp_body 3
67
did not return with success or was not invoked.
68
For FastCGI connections, the current connection should be released with
69
.Xr khttp_free 3
70
and parse loop reentered.
71
.It Dv KCGI_SYSTEM
72
Internal system error writing to the output stream.
73
.El
74
.Sh EXAMPLES
75
The following outputs a simple XML page.
76
It assumes
77
.Va r
78
is a
79
.Vt struct kreq
80
pointer.
81
For brevity, it does not do any error checking.
82
.Bd -literal -offset indent
83
const char *const elems[] =
84
  { "foo", "bar", "baz" };
85
khttp_head(r, kresps[KRESP_STATUS],
86
  "%s", khttps[KHTTP_200]);
87
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
88
  "%s", kmimetypes[KMIME_TEXT_XML]);
89
khttp_body(r);
90
kxml_open(&req, r, elems, 3);
91
kxml_push(&req, 0); /* foo */
92
kxml_puts(&req, "Hello, world");
93
kxml_close(&req);
94
.Ed
95
.Sh SEE ALSO
96
.Xr kcgixml 3
97
.Sh AUTHORS
98
Written by
99
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
100

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

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

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

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