Moved architecture-dependent parameters and code to mmarch
[mmondor.git] / mmsoftware / mmlib / mmbstring.h
CommitLineData
d4aaa170 1/* $Id: mmbstring.h,v 1.3 2004/03/22 06:59:34 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>
46#include <mmtypes.h>
47
48
49
50
51typedef struct bstring {
52 size_t len, size;
53 char *string;
54} bstring;
55
56
57
58
59bstring *bstrnew(size_t);
60bstring *bstrfree(bstring *);
61
62size_t bstrlen(bstring *);
63size_t bstrnlen(bstring *, size_t);
64
65bstring *bstrdup(char *);
66bstring *bstrdup2(bstring *);
67bstring *bstrndup(char *, size_t);
68bstring *bstrndup2(bstring *, size_t);
69
70size_t bstrcpy(bstring *, char *);
71size_t bstrcpy2(bstring *, bstring *);
72size_t bstrncpy(bstring *, char *, size_t);
73size_t bstrncpy2(bstring *, bstring *, size_t);
74
75size_t bstrcat(bstring *, char *);
76size_t bstrcat2(bstring *, bstring *);
77size_t bstrncat(bstring *, char *, size_t);
78size_t bstrncat2(bstring *, bstring *, size_t);
79
80bool bstrcmp(bstring *, char *);
81bool bstrcmp2(bstring *, bstring *);
4f87c15b
MM
82bool bstrcasecmp(bstring *, char *);
83bool bstrcasecmp2(bstring *, bstring *);
917e9cbb
MM
84bool bstrncmp(bstring *, char *, size_t);
85bool bstrncmp2(bstring *, bstring *, size_t);
4f87c15b
MM
86bool bstrncasecmp(bstring *, char *, size_t);
87bool bstrncasecmp2(bstring *, bstring *, size_t);
917e9cbb
MM
88
89
90
91
92#endif