mmlib/mmat: replace some variables by literal constants
[mmondor.git] / mmsoftware / mmlib / mmbstring.h
CommitLineData
b232bd02 1/* $Id: mmbstring.h,v 1.5 2007/12/05 23:47:56 mmondor Exp $ */
917e9cbb
MM
2
3/*
d4aaa170 4 * Copyright (C) 2001-2004, Matthew Mondor
917e9cbb
MM
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
d4aaa170 17 * This product includes software developed by Matthew Mondor.
917e9cbb
MM
18 * 4. The name of Matthew Mondor may not be used to endorse or promote
19 * products derived from this software without specific prior written
20 * permission.
d4aaa170
MM
21 * 5. Redistribution of source code may not be released under the terms of
22 * any GNU Public License derivate.
917e9cbb
MM
23 *
24 * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36
37
38
39#ifndef MMBSTRING_H
40#define MMBSTRING_H
41
42
43
44
45#include <sys/types.h>
b232bd02
MM
46#include <stdbool.h>
47
917e9cbb
MM
48#include <mmtypes.h>
49
50
51
52
53typedef struct bstring {
54 size_t len, size;
55 char *string;
56} bstring;
57
58
59
60
c0d58fca
MM
61extern bstring * bstrnew(size_t);
62extern bstring * bstrfree(bstring *);
917e9cbb 63
c0d58fca
MM
64extern size_t bstrlen(bstring *);
65extern size_t bstrnlen(bstring *, size_t);
917e9cbb 66
c0d58fca
MM
67extern bstring * bstrdup(char *);
68extern bstring * bstrdup2(bstring *);
69extern bstring * bstrndup(char *, size_t);
70extern bstring * bstrndup2(bstring *, size_t);
917e9cbb 71
c0d58fca
MM
72extern size_t bstrcpy(bstring *, char *);
73extern size_t bstrcpy2(bstring *, bstring *);
74extern size_t bstrncpy(bstring *, char *, size_t);
75extern size_t bstrncpy2(bstring *, bstring *, size_t);
917e9cbb 76
c0d58fca
MM
77extern size_t bstrcat(bstring *, char *);
78extern size_t bstrcat2(bstring *, bstring *);
79extern size_t bstrncat(bstring *, char *, size_t);
80extern size_t bstrncat2(bstring *, bstring *, size_t);
917e9cbb 81
c0d58fca
MM
82extern bool bstrcmp(bstring *, char *);
83extern bool bstrcmp2(bstring *, bstring *);
84extern bool bstrcasecmp(bstring *, char *);
85extern bool bstrcasecmp2(bstring *, bstring *);
86extern bool bstrncmp(bstring *, char *, size_t);
87extern bool bstrncmp2(bstring *, bstring *, size_t);
88extern bool bstrncasecmp(bstring *, char *, size_t);
89extern bool bstrncasecmp2(bstring *, bstring *, size_t);
917e9cbb
MM
90
91
92
93
94#endif