47 __attribute__ ((visibility ("default")))
49 __attribute__ ((visibility ("hidden")))
55#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
56#define BSTR_PRINTF(format, argument) \
57 __attribute__ ((__format__ (__printf__, format, argument)))
59 __attribute__ ((__unused__))
60#elif defined(_MSC_VER)
61#define BSTR_PRINTF(format, argument)
63 __pragma(warning(suppress:4100))
65#define BSTR_PRINTF(format, argument)
84#define BSTR_BS_BUFF_LENGTH_GET (0)
95#define cstr2bstr bfromcstr
676#define bstrchr(b, c) \
677 bstrchrp((b), (c), 0)
685#define bstrrchr(b, c) \
686 bstrrchrp((b), (c), blength(b) - 1)
913 unsigned char splitChar,
915 int(*cb)(
void *parm,
int ofs,
int len),
942 int(*cb)(
void *parm,
int ofs,
int len),
969 int(*cb)(
void *parm,
int ofs,
int len),
void *parm);
1148#define bvformata(ret, b, fmt, lastarg) \
1150 bstring bstrtmp_b =(b); \
1151 const char *bstrtmp_fmt = (fmt); \
1152 int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
1154 va_list bstrtmp_arglist; \
1155 va_start(bstrtmp_arglist, lastarg); \
1156 bstrtmp_r = bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, \
1158 va_end(bstrtmp_arglist); \
1159 if(bstrtmp_r >= 0) { \
1161 bstrtmp_r = BSTR_OK; \
1163 } else if(-bstrtmp_r <= bstrtmp_sz) { \
1165 bstrtmp_r = BSTR_ERR; \
1169 bstrtmp_sz = -bstrtmp_r; \
1176typedef size_t (*
bNread)(
void *buff,
size_t elsize,
size_t nelem,
void *parm);
1215#if defined(HAVE_BGETS)
1216bgetstream(
bNgetc getcPtr,
void *parm,
char terminator);
1218bgets(
bNgetc getcPtr,
void *parm,
char terminator);
1475#define blengthe(b, e) \
1476 (((b) == (void *)0 || (b)->slen < 0) \
1493#define bdataofse(b, o, e) \
1494 (((b) == (void *)0 || (b)->data == (void *)0) \
1496 : ((char *)(b)->data) + (o))
1503#define bdataofs(b, o) \
1504 (bdataofse((b),(o),(void *)0))
1511#define bdatae(b, e) \
1512 (bdataofse(b, 0, e))
1528#define bchare(b, p, e) \
1529 ((((unsigned)(p)) < (unsigned)blength(b)) \
1530 ? ((b)->data[(p)]) \
1539#define bchar(b, p) \
1540 bchare((b), (p), '\0')
1546#define bsStaticMlen(q, m) { (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
1548#if defined (_MSC_VER)
1563#define bsStatic(q) bsStaticMlen(q, -32)
1569#define bsStatic(q) bsStaticMlen(q, -__LINE__)
1592#define bsStaticBlkParms(q) \
1593 ((void *)("" q "")), ((int)sizeof(q) -1)
1597#define bcatStatic(b, s) ((bcatblk)((b), bsStaticBlkParms(s)))
1598#define bfromStatic(s) ((blk2bstr)(bsStaticBlkParms(s)))
1599#define bassignStatic(b, s) ((bassignblk)((b), bsStaticBlkParms(s)))
1600#define binsertStatic(b, p, s, f) ((binsertblk)((b), (p), bsStaticBlkParms(s), (f)))
1601#define bjoinStatic(b, s) ((bjoinblk)((b), bsStaticBlkParms(s)))
1602#define biseqStatic(b, s) ((biseqblk)((b), bsStaticBlkParms(s)))
1603#define bisstemeqStatic(b, s) ((bisstemeqblk)((b), bsStaticBlkParms(s)))
1604#define biseqcaselessStatic(b, s) ((biseqcaselessblk)((b), bsStaticBlkParms(s)))
1605#define bisstemeqcaselessStatic(b, s) ((bisstemeqcaselessblk)((b), bsStaticBlkParms(s)))
1611#define cstr2tbstr btfromcstr
1626#define btfromcstr(t, s) \
1628 (t).data = (unsigned char *)(s); \
1629 (t).slen = ((t).data) \
1630 ? ((int)(strlen)((char *)(t).data)) \
1637#define blk2tbstr(t, s, l) \
1639 (t).data = (unsigned char *)(s); \
1658#define btfromblk(t, s, l) blk2tbstr(t, s, l)
1675#define bmid2tbstr(t, b, p, l) \
1677 const bstring bstrtmp_s =(b); \
1678 if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
1679 int bstrtmp_left = (p); \
1680 int bstrtmp_len = (l); \
1681 if (bstrtmp_left < 0) { \
1682 bstrtmp_len += bstrtmp_left; \
1685 if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) { \
1686 bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
1688 if(bstrtmp_len <= 0) { \
1689 (t).data =(unsigned char *)""; \
1692 (t).data = bstrtmp_s->data + bstrtmp_left; \
1693 (t).slen = bstrtmp_len; \
1696 (t).data = (unsigned char *)""; \
1699 (t).mlen = -__LINE__; \
1716#define btfromblkltrimws(t, s, l) \
1718 int bstrtmp_idx = 0, bstrtmp_len =(l); \
1719 unsigned char *bstrtmp_s = (s); \
1720 if (bstrtmp_s && bstrtmp_len >= 0) { \
1721 for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
1722 if (!isspace(bstrtmp_s[bstrtmp_idx])) { \
1727 (t).data = bstrtmp_s + bstrtmp_idx; \
1728 (t).slen = bstrtmp_len - bstrtmp_idx; \
1729 (t).mlen = -__LINE__; \
1746#define btfromblkrtrimws(t, s, l) \
1748 int bstrtmp_len = (l) - 1; \
1749 unsigned char *bstrtmp_s = (s); \
1750 if (bstrtmp_s && bstrtmp_len >= 0) { \
1751 for (; bstrtmp_len >= 0; bstrtmp_len--) { \
1752 if (!isspace(bstrtmp_s[bstrtmp_len])) { \
1757 (t).data = bstrtmp_s; \
1758 (t).slen = bstrtmp_len + 1; \
1759 (t).mlen = -__LINE__; \
1776#define btfromblktrimws(t, s, l) \
1778 int bstrtmp_idx = 0, bstrtmp_len = (l) - 1; \
1779 unsigned char *bstrtmp_s = (s); \
1780 if (bstrtmp_s && bstrtmp_len >= 0) { \
1781 for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
1782 if(!isspace(bstrtmp_s[bstrtmp_idx])) { \
1786 for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
1787 if (!isspace(bstrtmp_s[bstrtmp_len])) { \
1792 (t).data = bstrtmp_s + bstrtmp_idx; \
1793 (t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
1794 (t).mlen = -__LINE__; \
1807#define bwriteprotect(t) \
1809 if ((t).mlen >= 0) { \
1826#define bwriteallow(t) \
1828 if ((t).mlen == -1) { \
1829 (t).mlen = (t).slen + ((t).slen == 0); \
1836#define biswriteprotected(t) \
BSTR_PUBLIC int bassign(bstring a, const bstring b)
Definition bstrlib.c:467
BSTR_PUBLIC int bisstemeqblk(const bstring b0, const void *blk, int len)
Definition bstrlib.c:860
BSTR_PUBLIC int bpattern(bstring b, int len)
Definition bstrlib.c:1881
size_t(* bNread)(void *buff, size_t elsize, size_t nelem, void *parm)
Definition bstrlib.h:1176
BSTR_PUBLIC int binstrrcaseless(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1236
BSTR_PUBLIC int bspeek(bstring r, const struct bStream *s)
Definition bstrlib.c:2353
BSTR_PUBLIC int breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill)
Definition bstrlib.c:1587
BSTR_PUBLIC int bsunread(struct bStream *s, const bstring b)
Definition bstrlib.c:2344
BSTR_PUBLIC int binsertblk(bstring b, int pos, const void *blk, int len, unsigned char fill)
Definition bstrlib.c:1524
BSTR_PUBLIC bstring bjoinblk(const struct bstrList *bl, const void *blk, int len)
Definition bstrlib.c:2362
BSTR_PUBLIC bstring bfromcstr(const char *str)
Definition bstrlib.c:188
#define BSTR_PUBLIC
Definition bstrlib.h:51
BSTR_PUBLIC int bstrcmp(const bstring b0, const bstring b1)
Definition bstrlib.c:911
BSTR_PUBLIC int bstrnicmp(const bstring b0, const bstring b1, int n)
Definition bstrlib.c:656
BSTR_PUBLIC int ballocmin(bstring b, int len)
Definition bstrlib.c:159
BSTR_PUBLIC int bstrchrp(const bstring b, int c, int pos)
Definition bstrlib.c:1288
BSTR_PUBLIC bstring bread(bNread readPtr, void *parm)
Definition bstrlib.c:1932
BSTR_PUBLIC int binstrr(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1135
BSTR_PUBLIC int bstrListAlloc(struct bstrList *sl, int msz)
Definition bstrlib.c:2607
BSTR_PUBLIC int bconcat(bstring b0, const bstring b1)
Definition bstrlib.c:332
BSTR_PUBLIC int bsreada(bstring b, struct bStream *s, int n)
Definition bstrlib.c:2231
BSTR_PUBLIC int bsreadlns(bstring r, struct bStream *s, const bstring term)
Definition bstrlib.c:2312
BSTR_PUBLIC int bcstrfree(char *s)
Definition bstrlib.c:325
BSTR_PUBLIC int bdelete(bstring s1, int pos, int len)
Definition bstrlib.c:998
BSTR_PUBLIC int btolower(bstring b)
Definition bstrlib.c:605
BSTR_PUBLIC void * bsclose(struct bStream *s)
Definition bstrlib.c:2068
BSTR_PUBLIC int bsreadln(bstring b, struct bStream *s, char terminator)
Definition bstrlib.c:2299
BSTR_PUBLIC bstring bmidstr(const bstring b, int left, int len)
Definition bstrlib.c:979
BSTR_PUBLIC struct bstrList * bsplit(const bstring str, unsigned char splitChar)
Definition bstrlib.c:2802
BSTR_PUBLIC int bdestroy(bstring b)
Definition bstrlib.c:1024
BSTR_PUBLIC bstring bfromcstralloc(int mlen, const char *str)
Definition bstrlib.c:266
BSTR_PUBLIC int bformata(bstring b, const char *fmt,...)
Definition bstrlib.c:2897
BSTR_PUBLIC int biseqblk(const bstring b, const void *blk, int len)
Definition bstrlib.c:827
BSTR_PUBLIC int binstrcaseless(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1186
BSTR_PUBLIC int bninchrr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1453
BSTR_PUBLIC int btoupper(bstring b)
Definition bstrlib.c:590
BSTR_PUBLIC int biseqcstr(const bstring b, const char *s)
Definition bstrlib.c:880
BSTR_PUBLIC int bvcformata(bstring b, int count, const char *fmt, va_list arglist)
Definition bstrlib.c:3058
BSTR_PUBLIC int brtrimws(bstring b)
Definition bstrlib.c:775
BSTR_PUBLIC int binchrr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1417
BSTR_PUBLIC struct bstrList * bsplits(const bstring str, const bstring splitStr)
Definition bstrlib.c:2855
BSTR_PUBLIC int bconchar(bstring b0, char c)
Definition bstrlib.c:369
BSTR_PUBLIC int bssplitscb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
Definition bstrlib.c:2450
BSTR_PUBLIC int bassignformat(bstring b, const char *fmt,...)
Definition bstrlib.c:2952
BSTR_PUBLIC bstring blk2bstr(const void *blk, int len)
Definition bstrlib.c:272
BSTR_PUBLIC int bcatblk(bstring b, const void *s, int len)
Definition bstrlib.c:410
BSTR_PUBLIC int bassigncstr(bstring a, const char *str)
Definition bstrlib.c:521
BSTR_PUBLIC char * bstr2cstr(const bstring s, char z)
Definition bstrlib.c:305
BSTR_PUBLIC int bsreadlnsa(bstring r, struct bStream *s, const bstring term)
Definition bstrlib.c:2155
struct tagbstring * bstring
Definition bstrlib.h:86
BSTR_PUBLIC int bstrrchrp(const bstring b, int c, int pos)
Definition bstrlib.c:1303
BSTR_PUBLIC int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:1943
BSTR_PUBLIC struct bstrList * bsplitstr(const bstring str, const bstring splitStr)
Definition bstrlib.c:2829
BSTR_PUBLIC struct bstrList * bstrListCreate(void)
Definition bstrlib.c:2569
BSTR_PUBLIC int bsplitstrcb(const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
Definition bstrlib.c:2729
BSTR_PUBLIC int bstricmp(const bstring b0, const bstring b1)
Definition bstrlib.c:620
BSTR_PUBLIC int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:1973
BSTR_PUBLIC bstring bstrcpy(const bstring b1)
Definition bstrlib.c:432
BSTR_PUBLIC int btrunc(bstring b, int n)
Definition bstrlib.c:566
BSTR_PUBLIC int bfindreplace(bstring b, const bstring find, const bstring repl, int pos)
Definition bstrlib.c:1830
BSTR_PUBLIC int bseof(const struct bStream *s)
Definition bstrlib.c:2059
BSTR_PUBLIC int biseq(const bstring b0, const bstring b1)
Definition bstrlib.c:843
BSTR_PUBLIC bstring bgets(bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:2006
BSTR_PUBLIC int bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill)
Definition bstrlib.c:1471
BSTR_PUBLIC int bsplitscb(const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
Definition bstrlib.c:2693
BSTR_PUBLIC int bcatcstr(bstring b, const char *s)
Definition bstrlib.c:386
BSTR_PUBLIC int bassignmidstr(bstring a, const bstring b, int left, int len)
Definition bstrlib.c:490
BSTR_PUBLIC int biseqcaselessblk(const bstring b, const void *blk, int len)
Definition bstrlib.c:698
BSTR_PUBLIC int biseqcstrcaseless(const bstring b, const char *s)
Definition bstrlib.c:895
BSTR_PUBLIC struct bStream * bsopen(bNread readPtr, void *parm)
Definition bstrlib.c:2027
BSTR_PUBLIC int bfindreplacecaseless(bstring b, const bstring find, const bstring repl, int pos)
Definition bstrlib.c:1836
BSTR_PUBLIC int binsertch(bstring s1, int pos, int len, unsigned char fill)
Definition bstrlib.c:1842
BSTR_PUBLIC int bsplitcb(const bstring str, unsigned char splitChar, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
Definition bstrlib.c:2669
BSTR_PUBLIC int bltrimws(bstring b)
Definition bstrlib.c:756
BSTR_PUBLIC int breada(bstring b, bNread readPtr, void *parm)
Definition bstrlib.c:1904
BSTR_PUBLIC int bstrListAllocMin(struct bstrList *sl, int msz)
Definition bstrlib.c:2640
BSTR_PUBLIC int bstrListDestroy(struct bstrList *sl)
Definition bstrlib.c:2586
BSTR_PUBLIC int btrimws(bstring b)
Definition bstrlib.c:800
BSTR_PUBLIC int biseqcaseless(const bstring b0, const bstring b1)
Definition bstrlib.c:723
BSTR_PUBLIC bstring bjoin(const struct bstrList *bl, const bstring sep)
Definition bstrlib.c:2436
BSTR_PUBLIC int bsbufflength(struct bStream *s, int sz)
Definition bstrlib.c:2045
BSTR_PUBLIC int bisstemeqcaselessblk(const bstring b0, const void *blk, int len)
Definition bstrlib.c:732
BSTR_PUBLIC int binchr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1386
int(* bNgetc)(void *parm)
Definition bstrlib.h:1174
BSTR_PUBLIC int bassignblk(bstring a, const void *s, int len)
Definition bstrlib.c:548
BSTR_PUBLIC int bsreadlna(bstring b, struct bStream *s, char terminator)
Definition bstrlib.c:2087
BSTR_PUBLIC int bninchr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1438
BSTR_PUBLIC int bssplitstrcb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
Definition bstrlib.c:2511
BSTR_PUBLIC int bstrncmp(const bstring b0, const bstring b1, int n)
Definition bstrlib.c:944
BSTR_PUBLIC bstring bformat(const char *fmt,...)
Definition bstrlib.c:3007
BSTR_PUBLIC bstring bfromcstrrangealloc(int minl, int maxl, const char *str)
Definition bstrlib.c:217
BSTR_PUBLIC int binsert(bstring s1, int pos, const bstring s2, unsigned char fill)
Definition bstrlib.c:1578
BSTR_PUBLIC int balloc(bstring s, int len)
Definition bstrlib.c:97
BSTR_PUBLIC int binstr(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1045
BSTR_PUBLIC int bsread(bstring b, struct bStream *s, int n)
Definition bstrlib.c:2331
q_t * b1
Definition dircache.c:246
size_t c
Definition dircache.c:257
q_t * b2
Definition dircache.c:247
int count
Definition server_ipc.c:89
Definition bstrlib.c:2018
void * parm
Definition bstrlib.c:2020
int qty
Definition bstrlib.h:779
int mlen
Definition bstrlib.h:779
bstring * entry
Definition bstrlib.h:780
int mlen
Definition bstrlib.h:89
unsigned char * data
Definition bstrlib.h:91
int slen
Definition bstrlib.h:90