Mercurial > libbuf
annotate libbuf.3 @ 22:d87e84936795
misc: update copyright years
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 24 Feb 2021 11:43:50 +0100 |
parents | 939fe74cd80a |
children | dbdc17e11648 |
rev | line source |
---|---|
0 | 1 .\" |
2 .\" libbuf.3 -- simple string buffer for C | |
3 .\" | |
22
d87e84936795
misc: update copyright years
David Demelier <markand@malikania.fr>
parents:
21
diff
changeset
|
4 .\" Copyright (c) 2019-2021 David Demelier <markand@malikania.fr> |
0 | 5 .\" |
6 .\" Permission to use, copy, modify, and/or distribute this software for any | |
7 .\" purpose with or without fee is hereby granted, provided that the above | |
8 .\" copyright notice and this permission notice appear in all copies. | |
9 .\" | |
10 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 .\" | |
22
d87e84936795
misc: update copyright years
David Demelier <markand@malikania.fr>
parents:
21
diff
changeset
|
18 .Dd October 29, 2019-2021 |
0 | 19 .Dt LIBBUF 3 |
20 .Os | |
21 .\" NAME | |
22 .Sh NAME | |
23 .Nm libbuf | |
24 .Nd minimal dynamic string library | |
25 .\" LIBRARY | |
26 .Sh LIBRARY | |
27 libbuf (libbuf, -lbuf) | |
28 .\" SYNOPSIS | |
29 .Sh SYNOPSIS | |
30 .In buf.h | |
31 .Ft void | |
32 .Fn buf_clear "struct buf *b" | |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
33 .Ft int |
0 | 34 .Fn buf_dup "struct buf *b" "const struct buf *src" |
35 .Ft void | |
36 .Fn buf_erase "struct buf *b" "size_t pos" "size_t count" | |
37 .Ft void | |
38 .Fn buf_finish "struct buf *b" | |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
39 .Ft int |
0 | 40 .Fn buf_init "struct buf *b" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
41 .Ft int |
0 | 42 .Fn buf_printf "struct buf *b" "const char *fmt" "..." |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
43 .Ft int |
0 | 44 .Fn buf_putc "struct buf *b" "char c" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
45 .Ft int |
0 | 46 .Fn buf_puts "struct buf *b" "const char *s" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
47 .Ft int |
0 | 48 .Fn buf_reserve "struct buf *b" "size_t desired" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
49 .Ft int |
0 | 50 .Fn buf_resize "struct buf *b" "size_t desired" "char c" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
51 .Ft int |
0 | 52 .Fn buf_shrink "struct buf *b" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
53 .Ft int |
0 | 54 .Fn buf_sub "struct buf *b" "const struct buf *src" "size_t pos" "size_t count" |
21
939fe74cd80a
buf: switch to int from bool
David Demelier <markand@malikania.fr>
parents:
2
diff
changeset
|
55 .Ft int |
0 | 56 .Fn buf_vprintf "struct buf *b" "const char *fmt" "va_list ap" |
57 .\" DESCRIPTION | |
58 .Sh DESCRIPTION | |
59 The | |
60 .Nm | |
61 library is a general purpose string library for C. | |
62 .Pp | |
63 It automatically expands storage as required. | |
64 It will first try to allocate twice as the current storage space until enough | |
65 room is available or in case it would exceed maximum storage it will grow with | |
66 minimal required storage. | |
67 .Pp | |
68 Every function expects as first argument a buffer to work with which can never | |
69 be NULL. | |
70 .Pp | |
71 The | |
72 .Vt "struct buf" | |
73 is a publicly exposed structure with the following fields: | |
74 .Bl -tag -width "capacity" | |
75 .It Va data | |
2
3665a56a00aa
man: data field isn't const
David Demelier <markand@malikania.fr>
parents:
0
diff
changeset
|
76 .Va (char *) |
0 | 77 The current NUL-terminated C string, maybe NULL if the buffer isn't initialized. |
78 .It Va length | |
79 .Va (size_t) | |
80 The data length. | |
81 .It Va capacity | |
82 .Va (size_t) | |
83 The real capacity available for writing characters (not including NUL). A | |
84 capacity of 5 means you can write 5 characters plus the NUL terminator without | |
85 reallocating. | |
86 .El | |
87 .\" SEE ALSO | |
88 .Sh SEE ALSO | |
89 .Xr buf_clear 3 , | |
90 .Xr buf_dup 3 , | |
91 .Xr buf_erase 3 , | |
92 .Xr buf_finish 3 , | |
93 .Xr buf_init 3 , | |
94 .Xr buf_printf 3 , | |
95 .Xr buf_putc 3 , | |
96 .Xr buf_puts 3 , | |
97 .Xr buf_reserve 3 , | |
98 .Xr buf_resize 3 , | |
99 .Xr buf_shrink 3 , | |
100 .Xr buf_sub 3 , | |
101 .Xr buf_vprintf 3 | |
102 .\" AUTHORS | |
103 .Sh AUTHORS | |
104 The | |
105 .Nm | |
106 library was written by | |
107 .An David Demelier <markand@malikania.fr> |