Deleted Added
full compact
sbuf.9 (75870) sbuf.9 (77989)
1.\"-
2.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Co�dan Sm�rgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
1.\"-
2.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Co�dan Sm�rgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD: head/share/man/man9/sbuf.9 75870 2001-04-23 15:22:50Z ru $
26.\" $FreeBSD: head/share/man/man9/sbuf.9 77989 2001-06-10 15:48:04Z des $
27.\"
28.Dd January 28, 2001
29.Dt SBUF 9
30.Os FreeBSD
31.Sh NAME
32.Nm sbuf_new ,
33.Nm sbuf_clear ,
34.Nm sbuf_setpos ,

--- 5 unchanged lines hidden (view full) ---

40.Nm sbuf_finish ,
41.Nm sbuf_data ,
42.Nm sbuf_len ,
43.Nm sbuf_delete
44.Nd safe string formatting
45.Sh SYNOPSIS
46.Fd #include <sys/types.h>
47.Fd #include <sys/sbuf.h>
27.\"
28.Dd January 28, 2001
29.Dt SBUF 9
30.Os FreeBSD
31.Sh NAME
32.Nm sbuf_new ,
33.Nm sbuf_clear ,
34.Nm sbuf_setpos ,

--- 5 unchanged lines hidden (view full) ---

40.Nm sbuf_finish ,
41.Nm sbuf_data ,
42.Nm sbuf_len ,
43.Nm sbuf_delete
44.Nd safe string formatting
45.Sh SYNOPSIS
46.Fd #include <sys/types.h>
47.Fd #include <sys/sbuf.h>
48.Ft int
48.Ft struct sbuf *s
49.Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags"
50.Ft void
51.Fn sbuf_clear "struct sbuf *s"
52.Ft int
53.Fn sbuf_setpos "struct sbuf *s" "int pos"
54.Ft int
55.Fn sbuf_cat "struct sbuf *s" "const char *str"
56.Ft int

--- 23 unchanged lines hidden (view full) ---

80defined in
81.Aq Pa sys/sbuf.h .
82.Pp
83The
84.Fn sbuf_new
85function initializes the
86.Fa sbuf
87pointed to by its first argument.
49.Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags"
50.Ft void
51.Fn sbuf_clear "struct sbuf *s"
52.Ft int
53.Fn sbuf_setpos "struct sbuf *s" "int pos"
54.Ft int
55.Fn sbuf_cat "struct sbuf *s" "const char *str"
56.Ft int

--- 23 unchanged lines hidden (view full) ---

80defined in
81.Aq Pa sys/sbuf.h .
82.Pp
83The
84.Fn sbuf_new
85function initializes the
86.Fa sbuf
87pointed to by its first argument.
88If that pointer is
89.Dv NULL ,
90.Fn sbuf_new
91allocates a
92.Fa struct sbuf
93using
94.Xr malloc 9 .
88The
89.Fa buf
90argument is a pointer to a buffer in which to store the actual string;
91if it is
92.Dv NULL ,
93.Fn sbuf_new
94will allocate one using
95.Xr malloc 9 .

--- 112 unchanged lines hidden (view full) ---

208.Fn sbuf_clear ,
209or its position is reset to a value between 0 and one less than the
210size of its storage buffer using
211.Fn sbuf_setpos ,
212or it is reinitialized to a sufficiently short string using
213.Fn sbuf_cpy .
214.Sh RETURN VALUES
215.Fn sbuf_new
95The
96.Fa buf
97argument is a pointer to a buffer in which to store the actual string;
98if it is
99.Dv NULL ,
100.Fn sbuf_new
101will allocate one using
102.Xr malloc 9 .

--- 112 unchanged lines hidden (view full) ---

215.Fn sbuf_clear ,
216or its position is reset to a value between 0 and one less than the
217size of its storage buffer using
218.Fn sbuf_setpos ,
219or it is reinitialized to a sufficiently short string using
220.Fn sbuf_cpy .
221.Sh RETURN VALUES
222.Fn sbuf_new
216returns \-1 if it failed to allocate a storage buffer, and zero
223returns
224.Dv NULL
225if it failed to allocate a storage buffer, and a pointer to the new
226.Fa sbuf
217otherwise.
218.Pp
219.Fn sbuf_setpos
220returns \-1 if
221.Fa pos
222was invalid, and zero otherwise.
223.Pp
224.Fn sbuf_cat ,

--- 37 unchanged lines hidden ---
227otherwise.
228.Pp
229.Fn sbuf_setpos
230returns \-1 if
231.Fa pos
232was invalid, and zero otherwise.
233.Pp
234.Fn sbuf_cat ,

--- 37 unchanged lines hidden ---