jcs ratpoison hax
1/* Function prototypes for handling string buffers.
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004 Shawn Betts <sabetts@vcn.bc.ca>
3 *
4 * This file is part of ratpoison.
5 *
6 * ratpoison is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * ratpoison is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this software; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 * Boston, MA 02111-1307 USA
20 */
21
22#ifndef _RATPOISON_SBUF_H
23#define _RATPOISON_SBUF_H 1
24
25#include <stdlib.h>
26
27struct sbuf
28{
29 char *data;
30 size_t len;
31 size_t maxsz;
32
33 /* sbuf can exist in a list. */
34 struct list_head node;
35};
36
37struct sbuf *sbuf_new (size_t initsz);
38void sbuf_free (struct sbuf *b);
39char *sbuf_free_struct (struct sbuf *b);
40char *sbuf_concat (struct sbuf *b, const char *str);
41char *sbuf_nconcat (struct sbuf *b, const char *str, int len);
42char *sbuf_utf8_nconcat (struct sbuf *b, const char *s, int width);
43char *sbuf_copy (struct sbuf *b, const char *str);
44char *sbuf_clear (struct sbuf *b);
45char *sbuf_get (struct sbuf *b);
46char *sbuf_printf (struct sbuf *b, char *fmt, ...);
47char *sbuf_printf_concat (struct sbuf *b, char *fmt, ...);
48void sbuf_chop (struct sbuf *b);
49
50#endif /* ! _RATPOISON_SBUF_H */