Loading...
Searching...
No Matches
bstrlib.h
Go to the documentation of this file.
/* Copyright 2002-2015 Paul Hsieh
* This file is part of Bstrlib.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of bstrlib nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* GNU General Public License Version 2 (the "GPL").
*/
#ifndef BSTRLIB_H
#define BSTRLIB_H
#if __GNUC__ >= 4
#define BSTR_PUBLIC \
__attribute__ ((visibility ("default")))
#define BSTR_PRIVATE \
__attribute__ ((visibility ("hidden")))
#else
#define BSTR_PUBLIC
#define BSTR_PRIVATE
#endif
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
#define BSTR_PRINTF(format, argument) \
__attribute__ ((__format__ (__printf__, format, argument)))
#define BSTR_UNUSED \
__attribute__ ((__unused__))
#elif defined(_MSC_VER)
#define BSTR_PRINTF(format, argument)
#define BSTR_UNUSED \
__pragma(warning(suppress:4100))
#else
#define BSTR_PRINTF(format, argument)
#define BSTR_UNUSED
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <ctype.h>
#define BSTR_ERR (-1)
#define BSTR_OK (0)
#define BSTR_BS_BUFF_LENGTH_GET (0)
typedef struct tagbstring *bstring;
struct tagbstring {
int mlen;
int slen;
unsigned char *data;
};
/* Copy functions */
#define cstr2bstr bfromcstr
BSTR_PUBLIC bstring
bfromcstr(const char *str);
BSTR_PUBLIC bstring
bfromcstralloc(int mlen, const char *str);
BSTR_PUBLIC bstring
bfromcstrrangealloc(int minl, int maxl, const char *str);
BSTR_PUBLIC bstring
blk2bstr(const void *blk, int len);
BSTR_PUBLIC char *
bstr2cstr(const bstring s, char z);
BSTR_PUBLIC int
bcstrfree(char *s);
BSTR_PUBLIC bstring
bstrcpy(const bstring b1);
BSTR_PUBLIC int
bassign(bstring a, const bstring b);
BSTR_PUBLIC int
bassignmidstr(bstring a, const bstring b, int left, int len);
BSTR_PUBLIC int
bassigncstr(bstring a, const char *str);
BSTR_PUBLIC int
bassignblk(bstring a, const void *s, int len);
/* Destroy function */
BSTR_PUBLIC int
bdestroy(bstring b);
/* Space allocation hinting functions */
BSTR_PUBLIC int
balloc(bstring s, int len);
BSTR_PUBLIC int
ballocmin(bstring b, int len);
/* Substring extraction */
BSTR_PUBLIC bstring
bmidstr(const bstring b, int left, int len);
/*Various standard manipulations */
BSTR_PUBLIC int
bconcat(bstring b0, const bstring b1);
BSTR_PUBLIC int
bconchar(bstring b0, char c);
BSTR_PUBLIC int
bcatcstr(bstring b, const char *s);
BSTR_PUBLIC int
bcatblk(bstring b, const void *s, int len);
BSTR_PUBLIC int
binsert(bstring s1, int pos, const bstring s2, unsigned char fill);
BSTR_PUBLIC int
binsertblk(bstring b, int pos, const void *blk, int len,
unsigned char fill);
BSTR_PUBLIC int
binsertch(bstring s1, int pos, int len, unsigned char fill);
BSTR_PUBLIC int
breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill);
BSTR_PUBLIC int
bdelete(bstring s1, int pos, int len);
BSTR_PUBLIC int
bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill);
BSTR_PUBLIC int
btrunc(bstring b, int n);
/*Scan/search functions */
BSTR_PUBLIC int
bstricmp(const bstring b0, const bstring b1);
BSTR_PUBLIC int
bstrnicmp(const bstring b0, const bstring b1, int n);
BSTR_PUBLIC int
biseqcaseless(const bstring b0, const bstring b1);
BSTR_PUBLIC int
biseqcaselessblk(const bstring b, const void *blk, int len);
BSTR_PUBLIC int
bisstemeqcaselessblk(const bstring b0, const void *blk, int len);
BSTR_PUBLIC int
biseq(const bstring b0, const bstring b1);
BSTR_PUBLIC int
biseqblk(const bstring b, const void *blk, int len);
BSTR_PUBLIC int
bisstemeqblk(const bstring b0, const void *blk, int len);
BSTR_PUBLIC int
biseqcstr(const bstring b, const char *s);
BSTR_PUBLIC int
biseqcstrcaseless(const bstring b, const char *s);
BSTR_PUBLIC int
bstrcmp(const bstring b0, const bstring b1);
BSTR_PUBLIC int
bstrncmp(const bstring b0, const bstring b1, int n);
BSTR_PUBLIC int
binstr(const bstring s1, int pos, const bstring s2);
BSTR_PUBLIC int
binstrr(const bstring s1, int pos, const bstring s2);
BSTR_PUBLIC int
binstrcaseless(const bstring s1, int pos, const bstring s2);
BSTR_PUBLIC int
binstrrcaseless(const bstring s1, int pos, const bstring s2);
BSTR_PUBLIC int
bstrchrp(const bstring b, int c, int pos);
BSTR_PUBLIC int
bstrrchrp(const bstring b, int c, int pos);
#define bstrchr(b, c) \
bstrchrp((b), (c), 0)
#define bstrrchr(b, c) \
bstrrchrp((b), (c), blength(b) - 1)
BSTR_PUBLIC int
binchr(const bstring b0, int pos, const bstring b1);
BSTR_PUBLIC int
binchrr(const bstring b0, int pos, const bstring b1);
BSTR_PUBLIC int
bninchr(const bstring b0, int pos, const bstring b1);
BSTR_PUBLIC int
bninchrr(const bstring b0, int pos, const bstring b1);
BSTR_PUBLIC int
bfindreplace(bstring b, const bstring find, const bstring repl, int pos);
BSTR_PUBLIC int
bfindreplacecaseless(bstring b, const bstring find, const bstring repl,
int pos);
/* List of string container functions */
struct bstrList {
int qty, mlen;
bstring *entry;
};
BSTR_PUBLIC struct bstrList *
bstrListCreate(void);
BSTR_PUBLIC int
bstrListDestroy(struct bstrList *sl);
BSTR_PUBLIC int
bstrListAlloc(struct bstrList *sl, int msz);
BSTR_PUBLIC int
bstrListAllocMin(struct bstrList *sl, int msz);
/* String split and join functions */
BSTR_PUBLIC struct bstrList *
bsplit(const bstring str, unsigned char splitChar);
BSTR_PUBLIC struct bstrList *
bsplits(const bstring str, const bstring splitStr);
BSTR_PUBLIC struct bstrList *
bsplitstr(const bstring str, const bstring splitStr);
BSTR_PUBLIC bstring
bjoin(const struct bstrList *bl, const bstring sep);
BSTR_PUBLIC bstring
bjoinblk(const struct bstrList *bl, const void *blk, int len);
BSTR_PUBLIC int
bsplitcb(const bstring str,
unsigned char splitChar,
int pos,
int(*cb)(void *parm, int ofs, int len),
void *parm);
BSTR_PUBLIC int
bsplitscb(const bstring str,
const bstring splitStr,
int pos,
int(*cb)(void *parm, int ofs, int len),
void *parm);
BSTR_PUBLIC int
bsplitstrcb(const bstring str,
const bstring splitStr,
int pos,
int(*cb)(void *parm, int ofs, int len), void *parm);
/* Miscellaneous functions */
BSTR_PUBLIC int
bpattern(bstring b, int len);
BSTR_PUBLIC int
btoupper(bstring b);
BSTR_PUBLIC int
btolower(bstring b);
BSTR_PUBLIC int
bltrimws(bstring b);
BSTR_PUBLIC int
brtrimws(bstring b);
BSTR_PUBLIC int
btrimws(bstring b);
/* *printf format functions */
BSTR_PUBLIC bstring
bformat(const char *fmt, ...);
BSTR_PUBLIC int
bformata(bstring b, const char *fmt, ...);
BSTR_PUBLIC int
bassignformat(bstring b, const char *fmt, ...);
BSTR_PUBLIC int
bvcformata(bstring b, int count, const char *fmt, va_list arglist);
#define bvformata(ret, b, fmt, lastarg) \
do { \
bstring bstrtmp_b =(b); \
const char *bstrtmp_fmt = (fmt); \
int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
for (;;) { \
va_list bstrtmp_arglist; \
va_start(bstrtmp_arglist, lastarg); \
bstrtmp_r = bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, \
bstrtmp_arglist); \
va_end(bstrtmp_arglist); \
if(bstrtmp_r >= 0) { \
/* Everything went ok */ \
bstrtmp_r = BSTR_OK; \
break; \
} else if(-bstrtmp_r <= bstrtmp_sz) { \
/* A real error? */ \
bstrtmp_r = BSTR_ERR; \
break; \
} \
/* Doubled or target size */ \
bstrtmp_sz = -bstrtmp_r; \
} \
ret = bstrtmp_r; \
} while (0);
typedef int (*bNgetc)(void *parm);
typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
/* Input functions */
BSTR_PUBLIC bstring
#if defined(HAVE_BGETS)
bgetstream(bNgetc getcPtr, void *parm, char terminator);
#else
bgets(bNgetc getcPtr, void *parm, char terminator);
#endif
BSTR_PUBLIC bstring
bread(bNread readPtr, void *parm);
BSTR_PUBLIC int
bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
BSTR_PUBLIC int
bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
BSTR_PUBLIC int
breada(bstring b, bNread readPtr, void *parm);
/* Stream functions */
BSTR_PUBLIC struct bStream *
bsopen(bNread readPtr, void *parm);
BSTR_PUBLIC void *
bsclose(struct bStream *s);
BSTR_PUBLIC int
bsbufflength(struct bStream *s, int sz);
BSTR_PUBLIC int
bsreadln(bstring b, struct bStream *s, char terminator);
BSTR_PUBLIC int
bsreadlns(bstring r, struct bStream *s, const bstring term);
BSTR_PUBLIC int
bsread(bstring b, struct bStream *s, int n);
BSTR_PUBLIC int
bsreadlna(bstring b, struct bStream *s, char terminator);
BSTR_PUBLIC int
bsreadlnsa(bstring r, struct bStream *s, const bstring term);
BSTR_PUBLIC int
bsreada(bstring b, struct bStream *s, int n);
BSTR_PUBLIC int
bsunread(struct bStream *s, const bstring b);
BSTR_PUBLIC int
bspeek(bstring r, const struct bStream *s);
BSTR_PUBLIC int
bssplitscb(struct bStream *s,
const bstring splitStr,
int(*cb)(void *parm, int ofs, const bstring entry),
void *parm);
BSTR_PUBLIC int
bssplitstrcb(struct bStream *s,
const bstring splitStr,
int(*cb)(void *parm, int ofs, const bstring entry),
void *parm);
BSTR_PUBLIC int
bseof(const struct bStream *s);
/* Accessor macros */
#define blengthe(b, e) \
(((b) == (void *)0 || (b)->slen < 0) \
? (int)(e) \
: ((b)->slen))
#define blength(b) \
(blengthe((b), 0))
#define bdataofse(b, o, e) \
(((b) == (void *)0 || (b)->data == (void *)0) \
? (char *)(e) \
: ((char *)(b)->data) + (o))
#define bdataofs(b, o) \
(bdataofse((b),(o),(void *)0))
#define bdatae(b, e) \
(bdataofse(b, 0, e))
#define bdata(b) \
(bdataofs(b, 0))
#define bchare(b, p, e) \
((((unsigned)(p)) < (unsigned)blength(b)) \
? ((b)->data[(p)]) \
: (e))
#define bchar(b, p) \
bchare((b), (p), '\0')
/* Static constant string initialization macro */
#define bsStaticMlen(q, m) { (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
#if defined (_MSC_VER)
/* There are many versions of MSVC which emit __LINE__ as a non-constant. */
#define bsStatic(q) bsStaticMlen(q, -32)
#endif /* defined (_MSC_VER) */
#ifndef bsStatic
#define bsStatic(q) bsStaticMlen(q, -__LINE__)
#endif /* bsStatic */
/* Static constant block parameter pair */
#define bsStaticBlkParms(q) \
((void *)("" q "")), ((int)sizeof(q) -1)
/* Static convenience macros for blk functions with string literals */
#define bcatStatic(b, s) ((bcatblk)((b), bsStaticBlkParms(s)))
#define bfromStatic(s) ((blk2bstr)(bsStaticBlkParms(s)))
#define bassignStatic(b, s) ((bassignblk)((b), bsStaticBlkParms(s)))
#define binsertStatic(b, p, s, f) ((binsertblk)((b), (p), bsStaticBlkParms(s), (f)))
#define bjoinStatic(b, s) ((bjoinblk)((b), bsStaticBlkParms(s)))
#define biseqStatic(b, s) ((biseqblk)((b), bsStaticBlkParms(s)))
#define bisstemeqStatic(b, s) ((bisstemeqblk)((b), bsStaticBlkParms(s)))
#define biseqcaselessStatic(b, s) ((biseqcaselessblk)((b), bsStaticBlkParms(s)))
#define bisstemeqcaselessStatic(b, s) ((bisstemeqcaselessblk)((b), bsStaticBlkParms(s)))
/* Reference building macros */
#define cstr2tbstr btfromcstr
#define btfromcstr(t, s) \
do { \
(t).data = (unsigned char *)(s); \
(t).slen = ((t).data) \
? ((int)(strlen)((char *)(t).data)) \
: 0; \
(t).mlen = -1; \
} while (0)
#define blk2tbstr(t, s, l) \
do { \
(t).data = (unsigned char *)(s); \
(t).slen = l; \
(t).mlen = -1; \
} while (0)
#define btfromblk(t, s, l) blk2tbstr(t, s, l)
#define bmid2tbstr(t, b, p, l) \
do { \
const bstring bstrtmp_s =(b); \
if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
int bstrtmp_left = (p); \
int bstrtmp_len = (l); \
if (bstrtmp_left < 0) { \
bstrtmp_len += bstrtmp_left; \
bstrtmp_left = 0; \
} \
if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) { \
bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
} \
if(bstrtmp_len <= 0) { \
(t).data =(unsigned char *)""; \
(t).slen = 0; \
} else { \
(t).data = bstrtmp_s->data + bstrtmp_left; \
(t).slen = bstrtmp_len; \
} \
} else { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} \
(t).mlen = -__LINE__; \
} while (0)
#define btfromblkltrimws(t, s, l) \
do { \
int bstrtmp_idx = 0, bstrtmp_len =(l); \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
if (!isspace(bstrtmp_s[bstrtmp_idx])) { \
break; \
} \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len - bstrtmp_idx; \
(t).mlen = -__LINE__; \
} while (0)
#define btfromblkrtrimws(t, s, l) \
do { \
int bstrtmp_len = (l) - 1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_len >= 0; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) { \
break; \
} \
} \
} \
(t).data = bstrtmp_s; \
(t).slen = bstrtmp_len + 1; \
(t).mlen = -__LINE__; \
} while (0)
#define btfromblktrimws(t, s, l) \
do { \
int bstrtmp_idx = 0, bstrtmp_len = (l) - 1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
if(!isspace(bstrtmp_s[bstrtmp_idx])) { \
break; \
} \
} \
for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) { \
break; \
} \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
(t).mlen = -__LINE__; \
} while (0)
/* Write protection macros */
#define bwriteprotect(t) \
do { \
if ((t).mlen >= 0) { \
(t).mlen = -1; \
} \
} while (0)
#define bwriteallow(t) \
do { \
if ((t).mlen == -1) { \
(t).mlen = (t).slen + ((t).slen == 0); \
} \
} while (0)
#define biswriteprotected(t) \
((t).mlen <= 0)
#ifdef __cplusplus
}
#endif
#endif /* BSTRLIB_H */
bassign
BSTR_PUBLIC int bassign(bstring a, const bstring b)
bisstemeqblk
BSTR_PUBLIC int bisstemeqblk(const bstring b0, const void *blk, int len)
bpattern
BSTR_PUBLIC int bpattern(bstring b, int len)
binstrrcaseless
BSTR_PUBLIC int binstrrcaseless(const bstring s1, int pos, const bstring s2)
bspeek
BSTR_PUBLIC int bspeek(bstring r, const struct bStream *s)
breplace
BSTR_PUBLIC int breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill)
bsunread
BSTR_PUBLIC int bsunread(struct bStream *s, const bstring b)
binsertblk
BSTR_PUBLIC int binsertblk(bstring b, int pos, const void *blk, int len, unsigned char fill)
bjoinblk
BSTR_PUBLIC bstring bjoinblk(const struct bstrList *bl, const void *blk, int len)
bfromcstr
BSTR_PUBLIC bstring bfromcstr(const char *str)
bstrcmp
BSTR_PUBLIC int bstrcmp(const bstring b0, const bstring b1)
bstrnicmp
BSTR_PUBLIC int bstrnicmp(const bstring b0, const bstring b1, int n)
ballocmin
BSTR_PUBLIC int ballocmin(bstring b, int len)
bstrchrp
BSTR_PUBLIC int bstrchrp(const bstring b, int c, int pos)
bread
BSTR_PUBLIC bstring bread(bNread readPtr, void *parm)
binstrr
BSTR_PUBLIC int binstrr(const bstring s1, int pos, const bstring s2)
bstrListAlloc
BSTR_PUBLIC int bstrListAlloc(struct bstrList *sl, int msz)
bconcat
BSTR_PUBLIC int bconcat(bstring b0, const bstring b1)
bsreada
BSTR_PUBLIC int bsreada(bstring b, struct bStream *s, int n)
bsreadlns
BSTR_PUBLIC int bsreadlns(bstring r, struct bStream *s, const bstring term)
bcstrfree
BSTR_PUBLIC int bcstrfree(char *s)
bdelete
BSTR_PUBLIC int bdelete(bstring s1, int pos, int len)
btolower
BSTR_PUBLIC int btolower(bstring b)
bsclose
BSTR_PUBLIC void * bsclose(struct bStream *s)
bsreadln
BSTR_PUBLIC int bsreadln(bstring b, struct bStream *s, char terminator)
bmidstr
BSTR_PUBLIC bstring bmidstr(const bstring b, int left, int len)
bsplit
BSTR_PUBLIC struct bstrList * bsplit(const bstring str, unsigned char splitChar)
bdestroy
BSTR_PUBLIC int bdestroy(bstring b)
bfromcstralloc
BSTR_PUBLIC bstring bfromcstralloc(int mlen, const char *str)
bformata
BSTR_PUBLIC int bformata(bstring b, const char *fmt,...)
biseqblk
BSTR_PUBLIC int biseqblk(const bstring b, const void *blk, int len)
binstrcaseless
BSTR_PUBLIC int binstrcaseless(const bstring s1, int pos, const bstring s2)
bninchrr
BSTR_PUBLIC int bninchrr(const bstring b0, int pos, const bstring b1)
btoupper
BSTR_PUBLIC int btoupper(bstring b)
biseqcstr
BSTR_PUBLIC int biseqcstr(const bstring b, const char *s)
bvcformata
BSTR_PUBLIC int bvcformata(bstring b, int count, const char *fmt, va_list arglist)
brtrimws
BSTR_PUBLIC int brtrimws(bstring b)
binchrr
BSTR_PUBLIC int binchrr(const bstring b0, int pos, const bstring b1)
bsplits
BSTR_PUBLIC struct bstrList * bsplits(const bstring str, const bstring splitStr)
bconchar
BSTR_PUBLIC int bconchar(bstring b0, char c)
bssplitscb
BSTR_PUBLIC int bssplitscb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
bassignformat
BSTR_PUBLIC int bassignformat(bstring b, const char *fmt,...)
blk2bstr
BSTR_PUBLIC bstring blk2bstr(const void *blk, int len)
bcatblk
BSTR_PUBLIC int bcatblk(bstring b, const void *s, int len)
bassigncstr
BSTR_PUBLIC int bassigncstr(bstring a, const char *str)
bstr2cstr
BSTR_PUBLIC char * bstr2cstr(const bstring s, char z)
bsreadlnsa
BSTR_PUBLIC int bsreadlnsa(bstring r, struct bStream *s, const bstring term)
bstrrchrp
BSTR_PUBLIC int bstrrchrp(const bstring b, int c, int pos)
bassigngets
BSTR_PUBLIC int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator)
bsplitstr
BSTR_PUBLIC struct bstrList * bsplitstr(const bstring str, const bstring splitStr)
bstrListCreate
BSTR_PUBLIC struct bstrList * bstrListCreate(void)
bsplitstrcb
BSTR_PUBLIC int bsplitstrcb(const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
bstricmp
BSTR_PUBLIC int bstricmp(const bstring b0, const bstring b1)
bgetsa
BSTR_PUBLIC int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator)
bstrcpy
BSTR_PUBLIC bstring bstrcpy(const bstring b1)
btrunc
BSTR_PUBLIC int btrunc(bstring b, int n)
bfindreplace
BSTR_PUBLIC int bfindreplace(bstring b, const bstring find, const bstring repl, int pos)
bseof
BSTR_PUBLIC int bseof(const struct bStream *s)
biseq
BSTR_PUBLIC int biseq(const bstring b0, const bstring b1)
bgets
BSTR_PUBLIC bstring bgets(bNgetc getcPtr, void *parm, char terminator)
bsetstr
BSTR_PUBLIC int bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill)
bsplitscb
BSTR_PUBLIC int bsplitscb(const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
bcatcstr
BSTR_PUBLIC int bcatcstr(bstring b, const char *s)
bassignmidstr
BSTR_PUBLIC int bassignmidstr(bstring a, const bstring b, int left, int len)
biseqcaselessblk
BSTR_PUBLIC int biseqcaselessblk(const bstring b, const void *blk, int len)
biseqcstrcaseless
BSTR_PUBLIC int biseqcstrcaseless(const bstring b, const char *s)
bsopen
BSTR_PUBLIC struct bStream * bsopen(bNread readPtr, void *parm)
bfindreplacecaseless
BSTR_PUBLIC int bfindreplacecaseless(bstring b, const bstring find, const bstring repl, int pos)
binsertch
BSTR_PUBLIC int binsertch(bstring s1, int pos, int len, unsigned char fill)
bsplitcb
BSTR_PUBLIC int bsplitcb(const bstring str, unsigned char splitChar, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
bltrimws
BSTR_PUBLIC int bltrimws(bstring b)
breada
BSTR_PUBLIC int breada(bstring b, bNread readPtr, void *parm)
bstrListAllocMin
BSTR_PUBLIC int bstrListAllocMin(struct bstrList *sl, int msz)
bstrListDestroy
BSTR_PUBLIC int bstrListDestroy(struct bstrList *sl)
btrimws
BSTR_PUBLIC int btrimws(bstring b)
biseqcaseless
BSTR_PUBLIC int biseqcaseless(const bstring b0, const bstring b1)
bjoin
BSTR_PUBLIC bstring bjoin(const struct bstrList *bl, const bstring sep)
bsbufflength
BSTR_PUBLIC int bsbufflength(struct bStream *s, int sz)
bisstemeqcaselessblk
BSTR_PUBLIC int bisstemeqcaselessblk(const bstring b0, const void *blk, int len)
binchr
BSTR_PUBLIC int binchr(const bstring b0, int pos, const bstring b1)
bassignblk
BSTR_PUBLIC int bassignblk(bstring a, const void *s, int len)
bsreadlna
BSTR_PUBLIC int bsreadlna(bstring b, struct bStream *s, char terminator)
bninchr
BSTR_PUBLIC int bninchr(const bstring b0, int pos, const bstring b1)
bssplitstrcb
BSTR_PUBLIC int bssplitstrcb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
bstrncmp
BSTR_PUBLIC int bstrncmp(const bstring b0, const bstring b1, int n)
bformat
BSTR_PUBLIC bstring bformat(const char *fmt,...)
bfromcstrrangealloc
BSTR_PUBLIC bstring bfromcstrrangealloc(int minl, int maxl, const char *str)
binsert
BSTR_PUBLIC int binsert(bstring s1, int pos, const bstring s2, unsigned char fill)
balloc
BSTR_PUBLIC int balloc(bstring s, int len)
binstr
BSTR_PUBLIC int binstr(const bstring s1, int pos, const bstring s2)
bsread
BSTR_PUBLIC int bsread(bstring b, struct bStream *s, int n)
bstrList
Definition bstrlib.h:778
tagbstring
Definition bstrlib.h:88