ksgi

Форк
0
/
kcgi_buf_puts.3 
93 строки · 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 KCGI_BUF_PUTS 3
19
.Os
20
.Sh NAME
21
.Nm kcgi_buf_puts
22
.Nd put string content into a kcgi buffer
23
.Sh LIBRARY
24
.Lb libkcgi
25
.Sh SYNOPSIS
26
.In sys/types.h
27
.In stdarg.h
28
.In stdint.h
29
.In kcgi.h
30
.Ft enum kcgi_err
31
.Fo kcgi_buf_puts
32
.Fa "struct kcgi_buf *buf"
33
.Fa "const char *cp"
34
.Fc
35
.Sh DESCRIPTION
36
Appends a NUL-terminated string
37
.Fa cp
38
to a buffer
39
.Fa buf .
40
Buffers must be initialised to zero with
41
.Xr memset 3
42
prior to first use.
43
Does nothing if
44
.Fa cp
45
is
46
.Dv NULL .
47
It does not append a newline like
48
.Xr puts 3 .
49
.Sh RETURN VALUES
50
Returns an
51
.Ft enum kcgi_err
52
indicating the error state.
53
.Bl -tag -width -Ds
54
.It Dv KCGI_OK
55
Success (not an error).
56
.It Dv KCGI_ENOMEM
57
Internal memory allocation failure.
58
.It Dv KCGI_HUP
59
The output connection has been terminated.
60
For FastCGI connections, the current connection should be released with
61
.Xr khttp_free 3
62
and parse loop reentered.
63
.It Dv KCGI_FORM
64
The connection is still expecting headers with
65
.Xr khttp_head 3 .
66
Indicates that
67
.Xr khttp_body 3
68
did not return with success or was not invoked.
69
For FastCGI connections, the current connection should be released with
70
.Xr khttp_free 3
71
and parse loop reentered.
72
.It Dv KCGI_SYSTEM
73
Internal system error writing to the output stream.
74
.El
75
.Sh EXAMPLES
76
The following creates a simple NUL-terminated buffer and outputs its
77
contents.
78
It does not perform any error checking.
79
.Bd -literal -offset indent
80
struct kcgi_buf buf;
81

82
memset(&buf, 0, sizeof(struct kcgi_buf));
83
kcgi_buf_puts(&buf, "Hello, world!");
84
puts(buf.buf); /* Emits "Hello, world!" */
85
free(buf.buf);
86
.Ed
87
.Sh SEE ALSO
88
.Xr kcgi_buf_printf 3 ,
89
.Xr kcgi_buf_putc 3 ,
90
.Xr kcgi_buf_write 3
91
.Sh AUTHORS
92
Written by
93
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
94

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

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

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

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