*** empty log message ***
[mmondor.git] / mmsoftware / mmlib / mmbstring.h
CommitLineData
917e9cbb
MM
1/* $Id: mmbstring.h,v 1.1 2003/01/08 20:57:46 mmondor Exp $ */
2
3/*
4 * Copyright (C) 2001-2003, Matthew Mondor
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:
17 * This product includes software written by Matthew Mondor.
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.
21 *
22 * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34
35
36
37#ifndef MMBSTRING_H
38#define MMBSTRING_H
39
40
41
42
43#include <sys/types.h>
44#include <mmtypes.h>
45
46
47
48
49typedef struct bstring {
50 size_t len, size;
51 char *string;
52} bstring;
53
54
55
56
57bstring *bstrnew(size_t);
58bstring *bstrfree(bstring *);
59
60size_t bstrlen(bstring *);
61size_t bstrnlen(bstring *, size_t);
62
63bstring *bstrdup(char *);
64bstring *bstrdup2(bstring *);
65bstring *bstrndup(char *, size_t);
66bstring *bstrndup2(bstring *, size_t);
67
68size_t bstrcpy(bstring *, char *);
69size_t bstrcpy2(bstring *, bstring *);
70size_t bstrncpy(bstring *, char *, size_t);
71size_t bstrncpy2(bstring *, bstring *, size_t);
72
73size_t bstrcat(bstring *, char *);
74size_t bstrcat2(bstring *, bstring *);
75size_t bstrncat(bstring *, char *, size_t);
76size_t bstrncat2(bstring *, bstring *, size_t);
77
78bool bstrcmp(bstring *, char *);
79bool bstrcmp2(bstring *, bstring *);
80bool bstricmp(bstring *, char *);
81bool bstricmp2(bstring *, bstring *);
82bool bstrncmp(bstring *, char *, size_t);
83bool bstrncmp2(bstring *, bstring *, size_t);
84bool bstrnicmp(bstring *, char *, size_t);
85bool bstrnicmp2(bstring *, bstring *, size_t);
86
87
88
89
90#endif