bstring 1.0.2
Loading...
Searching...
No Matches
bstrlib.h
Go to the documentation of this file.
1/* Copyright 2002-2015 Paul Hsieh
2 * This file is part of Bstrlib.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 3. Neither the name of bstrlib nor the names of its contributors may be
15 * used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 *
30 * Alternatively, the contents of this file may be used under the terms of
31 * GNU General Public License Version 2 (the "GPL").
32 */
33
41
42#ifndef BSTRLIB_H
43#define BSTRLIB_H
44
45#if __GNUC__ >= 4
46#define BSTR_PUBLIC \
47 __attribute__ ((visibility ("default")))
48#define BSTR_PRIVATE \
49 __attribute__ ((visibility ("hidden")))
50#else
51#define BSTR_PUBLIC
52#define BSTR_PRIVATE
53#endif
54
55#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
56#define BSTR_PRINTF(format, argument) \
57 __attribute__ ((__format__ (__printf__, format, argument)))
58#define BSTR_UNUSED \
59 __attribute__ ((__unused__))
60#else
61#define BSTR_PRINTF(format, argument)
62#define BSTR_UNUSED
63#endif
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#ifdef HAVE_CONFIG_H
70#include <config.h>
71#endif
72
73#include <stdarg.h>
74#include <string.h>
75#include <limits.h>
76#include <ctype.h>
77
78#define BSTR_ERR (-1)
79#define BSTR_OK (0)
80#define BSTR_BS_BUFF_LENGTH_GET (0)
81
82typedef struct tagbstring *bstring;
83
84struct tagbstring {
85 int mlen;
86 int slen;
87 unsigned char *data;
88};
89
90/* Copy functions */
91#define cstr2bstr bfromcstr
92
108BSTR_PUBLIC bstring
109bfromcstr(const char *str);
110
130BSTR_PUBLIC bstring
131bfromcstralloc(int mlen, const char *str);
132
141BSTR_PUBLIC bstring
142blk2bstr(const void *blk, int len);
143
152BSTR_PUBLIC char *
153bstr2cstr(const bstring s, char z);
154
165BSTR_PUBLIC int
166bcstrfree(char *s);
167
174BSTR_PUBLIC bstring
175bstrcpy(const bstring b1);
176
183BSTR_PUBLIC int
184bassign(bstring a, const bstring b);
185
194BSTR_PUBLIC int
195bassignmidstr(bstring a, const bstring b, int left, int len);
196
203BSTR_PUBLIC int
204bassigncstr(bstring a, const char *str);
205
214BSTR_PUBLIC int
215bassignblk(bstring a, const void *s, int len);
216
217/* Destroy function */
218
231BSTR_PUBLIC int
232bdestroy(bstring b);
233
234/* Space allocation hinting functions */
235
266BSTR_PUBLIC int
267balloc(bstring s, int len);
268
293BSTR_PUBLIC int
294ballocmin(bstring b, int len);
295
296/* Substring extraction */
297
305BSTR_PUBLIC bstring
306bmidstr(const bstring b, int left, int len);
307
308/*Various standard manipulations */
309
316BSTR_PUBLIC int
317bconcat(bstring b0, const bstring b1);
318
325BSTR_PUBLIC int
326bconchar(bstring b0, char c);
327
334BSTR_PUBLIC int
335bcatcstr(bstring b, const char *s);
336
343BSTR_PUBLIC int
344bcatblk(bstring b, const void *s, int len);
345
354BSTR_PUBLIC int
355binsert(bstring s1, int pos, const bstring s2, unsigned char fill);
356
366BSTR_PUBLIC int
367binsertch(bstring s1, int pos, int len, unsigned char fill);
368
376BSTR_PUBLIC int
377breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill);
378
388BSTR_PUBLIC int
389bdelete(bstring s1, int pos, int len);
390
399BSTR_PUBLIC int
400bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill);
401
408BSTR_PUBLIC int
409btrunc(bstring b, int n);
410
411/*Scan/search functions */
412
422BSTR_PUBLIC int
423bstricmp(const bstring b0, const bstring b1);
424
435BSTR_PUBLIC int
436bstrnicmp(const bstring b0, const bstring b1, int n);
437
446BSTR_PUBLIC int
447biseqcaseless(const bstring b0, const bstring b1);
448
457BSTR_PUBLIC int
458bisstemeqcaselessblk(const bstring b0, const void *blk, int len);
459
471BSTR_PUBLIC int
472biseq(const bstring b0, const bstring b1);
473
482BSTR_PUBLIC int
483bisstemeqblk(const bstring b0, const void *blk, int len);
484
496BSTR_PUBLIC int
497biseqcstr(const bstring b, const char *s);
498
511BSTR_PUBLIC int
512biseqcstrcaseless(const bstring b, const char *s);
513
536BSTR_PUBLIC int
537bstrcmp(const bstring b0, const bstring b1);
538
553BSTR_PUBLIC int
554bstrncmp(const bstring b0, const bstring b1, int n);
555
564BSTR_PUBLIC int
565binstr(const bstring s1, int pos, const bstring s2);
566
577BSTR_PUBLIC int
578binstrr(const bstring s1, int pos, const bstring s2);
579
588BSTR_PUBLIC int
589binstrcaseless(const bstring s1, int pos, const bstring s2);
590
601BSTR_PUBLIC int
602binstrrcaseless(const bstring s1, int pos, const bstring s2);
603
610BSTR_PUBLIC int
611bstrchrp(const bstring b, int c, int pos);
612
619BSTR_PUBLIC int
620bstrrchrp(const bstring b, int c, int pos);
621
628#define bstrchr(b, c) \
629 bstrchrp((b), (c), 0)
630
637#define bstrrchr(b, c) \
638 bstrrchrp((b), (c), blength(b) - 1)
639
647BSTR_PUBLIC int
648binchr(const bstring b0, int pos, const bstring b1);
649
657BSTR_PUBLIC int
658binchrr(const bstring b0, int pos, const bstring b1);
659
667BSTR_PUBLIC int
668bninchr(const bstring b0, int pos, const bstring b1);
669
677BSTR_PUBLIC int
678bninchrr(const bstring b0, int pos, const bstring b1);
679
701BSTR_PUBLIC int
702bfindreplace(bstring b, const bstring find, const bstring repl, int pos);
703
725BSTR_PUBLIC int
726bfindreplacecaseless(bstring b, const bstring find, const bstring repl,
727 int pos);
728
729/* List of string container functions */
730struct bstrList {
731 int qty, mlen;
732 bstring *entry;
733};
734
757BSTR_PUBLIC struct bstrList *
759
765BSTR_PUBLIC int
767
772BSTR_PUBLIC int
773bstrListAlloc(struct bstrList *sl, int msz);
774
779BSTR_PUBLIC int
780bstrListAllocMin(struct bstrList *sl, int msz);
781
782/* String split and join functions */
783
793BSTR_PUBLIC struct bstrList *
794bsplit(const bstring str, unsigned char splitChar);
795
803BSTR_PUBLIC struct bstrList *
804bsplits(const bstring str, const bstring splitStr);
805
813BSTR_PUBLIC struct bstrList *
814bsplitstr(const bstring str, const bstring splitStr);
815
830BSTR_PUBLIC bstring
831bjoin(const struct bstrList *bl, const bstring sep);
832
853BSTR_PUBLIC int
854bsplitcb(const bstring str,
855 unsigned char splitChar,
856 int pos,
857 int(*cb)(void *parm, int ofs, int len),
858 void *parm);
859
880BSTR_PUBLIC int
881bsplitscb(const bstring str,
882 const bstring splitStr,
883 int pos,
884 int(*cb)(void *parm, int ofs, int len),
885 void *parm);
886
907BSTR_PUBLIC int
908bsplitstrcb(const bstring str,
909 const bstring splitStr,
910 int pos,
911 int(*cb)(void *parm, int ofs, int len), void *parm);
912
913/* Miscellaneous functions */
914
922BSTR_PUBLIC int
923bpattern(bstring b, int len);
924
931BSTR_PUBLIC int
932btoupper(bstring b);
933
940BSTR_PUBLIC int
941btolower(bstring b);
942
949BSTR_PUBLIC int
950bltrimws(bstring b);
951
958BSTR_PUBLIC int
959brtrimws(bstring b);
960
967BSTR_PUBLIC int
968btrimws(bstring b);
969
970/* *printf format functions */
990BSTR_PUBLIC bstring
991bformat(const char *fmt, ...);
992
1012BSTR_PUBLIC int
1013bformata(bstring b, const char *fmt, ...);
1014
1034BSTR_PUBLIC int
1035bassignformat(bstring b, const char *fmt, ...);
1036
1062BSTR_PUBLIC int
1063bvcformata(bstring b, int count, const char *fmt, va_list arglist);
1064
1090#define bvformata(ret, b, fmt, lastarg) \
1091do { \
1092 bstring bstrtmp_b =(b); \
1093 const char *bstrtmp_fmt = (fmt); \
1094 int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
1095 for (;;) { \
1096 va_list bstrtmp_arglist; \
1097 va_start(bstrtmp_arglist, lastarg); \
1098 bstrtmp_r = bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, \
1099 bstrtmp_arglist); \
1100 va_end(bstrtmp_arglist); \
1101 if(bstrtmp_r >= 0) { \
1102 /* Everything went ok */ \
1103 bstrtmp_r = BSTR_OK; \
1104 break; \
1105 } else if(-bstrtmp_r <= bstrtmp_sz) { \
1106 /* A real error? */ \
1107 bstrtmp_r = BSTR_ERR; \
1108 break; \
1109 } \
1110 /* Doubled or target size */ \
1111 bstrtmp_sz = -bstrtmp_r; \
1112 } \
1113 ret = bstrtmp_r; \
1114} while (0);
1115
1116typedef int (*bNgetc)(void *parm);
1117
1118typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
1119
1120/* Input functions */
1121
1156BSTR_PUBLIC bstring
1157#if defined(HAVE_BGETS)
1158bgetstream(bNgetc getcPtr, void *parm, char terminator);
1159#else
1160bgets(bNgetc getcPtr, void *parm, char terminator);
1161#endif
1162
1176BSTR_PUBLIC bstring
1177bread(bNread readPtr, void *parm);
1178
1187BSTR_PUBLIC int
1188bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
1189
1198BSTR_PUBLIC int
1199bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
1200
1207BSTR_PUBLIC int
1208breada(bstring b, bNread readPtr, void *parm);
1209
1210/* Stream functions */
1211
1217BSTR_PUBLIC struct bStream *
1218bsopen(bNread readPtr, void *parm);
1219
1226BSTR_PUBLIC void *
1227bsclose(struct bStream *s);
1228
1236BSTR_PUBLIC int
1237bsbufflength(struct bStream *s, int sz);
1238
1250BSTR_PUBLIC int
1251bsreadln(bstring b, struct bStream *s, char terminator);
1252
1261BSTR_PUBLIC int
1262bsreadlns(bstring r, struct bStream *s, const bstring term);
1263
1272BSTR_PUBLIC int
1273bsread(bstring b, struct bStream *s, int n);
1274
1286BSTR_PUBLIC int
1287bsreadlna(bstring b, struct bStream *s, char terminator);
1288
1299BSTR_PUBLIC int
1300bsreadlnsa(bstring r, struct bStream *s, const bstring term);
1301
1310BSTR_PUBLIC int
1311bsreada(bstring b, struct bStream *s, int n);
1312
1319BSTR_PUBLIC int
1320bsunread(struct bStream *s, const bstring b);
1321
1327BSTR_PUBLIC int
1328bspeek(bstring r, const struct bStream *s);
1329
1354BSTR_PUBLIC int
1355bssplitscb(struct bStream *s,
1356 const bstring splitStr,
1357 int(*cb)(void *parm, int ofs, const bstring entry),
1358 void *parm);
1359
1384BSTR_PUBLIC int
1385bssplitstrcb(struct bStream *s,
1386 const bstring splitStr,
1387 int(*cb)(void *parm, int ofs, const bstring entry),
1388 void *parm);
1389
1407BSTR_PUBLIC int
1408bseof(const struct bStream *s);
1409
1410/* Accessor macros */
1411
1417#define blengthe(b, e) \
1418 (((b) == (void *)0 || (b)->slen < 0) \
1419 ? (int)(e) \
1420 : ((b)->slen))
1421
1427#define blength(b) \
1428 (blengthe((b), 0))
1429
1435#define bdataofse(b, o, e) \
1436 (((b) == (void *)0 || (b)->data == (void *)0) \
1437 ? (char *)(e) \
1438 : ((char *)(b)->data) + (o))
1439
1445#define bdataofs(b, o) \
1446 (bdataofse((b),(o),(void *)0))
1447
1453#define bdatae(b, e) \
1454 (bdataofse(b, 0, e))
1455
1461#define bdata(b) \
1462 (bdataofs(b, 0))
1463
1470#define bchare(b, p, e) \
1471 ((((unsigned)(p)) < (unsigned)blength(b)) \
1472 ? ((b)->data[(p)]) \
1473 : (e))
1474
1481#define bchar(b, p) \
1482 bchare((b), (p), '\0')
1483
1484/* Static constant string initialization macro */
1485
1488#define bsStaticMlen(q, m) { (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
1489
1490#if defined (_MSC_VER)
1491/* There are many versions of MSVC which emit __LINE__ as a non-constant. */
1505#define bsStatic(q) bsStaticMlen(q, -32)
1506#endif /* defined (_MSC_VER) */
1507
1508#ifndef bsStatic
1511#define bsStatic(q) bsStaticMlen(q, -__LINE__)
1512#endif /* bsStatic */
1513
1514/* Static constant block parameter pair */
1515
1534#define bsStaticBlkParms(q) \
1535 ((void *)("" q "")), ((int)sizeof(q) -1)
1536
1537/* Reference building macros */
1538
1541#define cstr2tbstr btfromcstr
1542
1556#define btfromcstr(t, s) \
1557do { \
1558 (t).data = (unsigned char *)(s); \
1559 (t).slen = ((t).data) \
1560 ? ((int)(strlen)((char *)(t).data)) \
1561 : 0; \
1562 (t).mlen = -1; \
1563} while (0)
1564
1567#define blk2tbstr(t, s, l) \
1568do { \
1569 (t).data = (unsigned char *)(s); \
1570 (t).slen = l; \
1571 (t).mlen = -1; \
1572} while (0)
1573
1588#define btfromblk(t, s, l) blk2tbstr(t, s, l)
1589
1605#define bmid2tbstr(t, b, p, l) \
1606do { \
1607 const bstring bstrtmp_s =(b); \
1608 if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
1609 int bstrtmp_left = (p); \
1610 int bstrtmp_len = (l); \
1611 if (bstrtmp_left < 0) { \
1612 bstrtmp_len += bstrtmp_left; \
1613 bstrtmp_left = 0; \
1614 } \
1615 if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) { \
1616 bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
1617 } \
1618 if(bstrtmp_len <= 0) { \
1619 (t).data =(unsigned char *)""; \
1620 (t).slen = 0; \
1621 } else { \
1622 (t).data = bstrtmp_s->data + bstrtmp_left; \
1623 (t).slen = bstrtmp_len; \
1624 } \
1625 } else { \
1626 (t).data = (unsigned char *)""; \
1627 (t).slen = 0; \
1628 } \
1629 (t).mlen = -__LINE__; \
1630} while (0);
1631
1646#define btfromblkltrimws(t, s, l) \
1647do { \
1648 int bstrtmp_idx = 0, bstrtmp_len =(l); \
1649 unsigned char *bstrtmp_s = (s); \
1650 if (bstrtmp_s && bstrtmp_len >= 0) { \
1651 for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
1652 if (!isspace(bstrtmp_s[bstrtmp_idx])) { \
1653 break; \
1654 } \
1655 } \
1656 } \
1657 (t).data = bstrtmp_s + bstrtmp_idx; \
1658 (t).slen = bstrtmp_len - bstrtmp_idx; \
1659 (t).mlen = -__LINE__; \
1660} while (0);
1661
1676#define btfromblkrtrimws(t, s, l) \
1677do { \
1678 int bstrtmp_len = (l) - 1; \
1679 unsigned char *bstrtmp_s = (s); \
1680 if (bstrtmp_s && bstrtmp_len >= 0) { \
1681 for (; bstrtmp_len >= 0; bstrtmp_len--) { \
1682 if (!isspace(bstrtmp_s[bstrtmp_len])) { \
1683 break; \
1684 } \
1685 } \
1686 } \
1687 (t).data = bstrtmp_s; \
1688 (t).slen = bstrtmp_len + 1; \
1689 (t).mlen = -__LINE__; \
1690} while (0);
1691
1706#define btfromblktrimws(t, s, l) \
1707do { \
1708 int bstrtmp_idx = 0, bstrtmp_len = (l) - 1; \
1709 unsigned char *bstrtmp_s = (s); \
1710 if (bstrtmp_s && bstrtmp_len >= 0) { \
1711 for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
1712 if(!isspace(bstrtmp_s[bstrtmp_idx])) { \
1713 break; \
1714 } \
1715 } \
1716 for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
1717 if (!isspace(bstrtmp_s[bstrtmp_len])) { \
1718 break; \
1719 } \
1720 } \
1721 } \
1722 (t).data = bstrtmp_s + bstrtmp_idx; \
1723 (t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
1724 (t).mlen = -__LINE__; \
1725} while (0);
1726
1727/* Write protection macros */
1728
1737#define bwriteprotect(t) \
1738do { \
1739 if ((t).mlen >= 0) { \
1740 (t).mlen = -1; \
1741 } \
1742} while (0);
1743
1756#define bwriteallow(t) \
1757do { \
1758 if ((t).mlen == -1) { \
1759 (t).mlen = (t).slen + ((t).slen == 0); \
1760 } \
1761} while (0);
1762
1766#define biswriteprotected(t) \
1767 ((t).mlen <= 0)
1768
1769#ifdef __cplusplus
1770}
1771#endif
1772
1773#endif /* BSTRLIB_H */
BSTR_PUBLIC int bassign(bstring a, const bstring b)
BSTR_PUBLIC int bisstemeqblk(const bstring b0, const void *blk, int len)
BSTR_PUBLIC int bpattern(bstring b, int len)
BSTR_PUBLIC int binstrrcaseless(const bstring s1, int pos, const bstring s2)
BSTR_PUBLIC int bspeek(bstring r, const struct bStream *s)
BSTR_PUBLIC int breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill)
BSTR_PUBLIC int bsunread(struct bStream *s, const bstring b)
BSTR_PUBLIC bstring bfromcstr(const char *str)
BSTR_PUBLIC int bstrcmp(const bstring b0, const bstring b1)
BSTR_PUBLIC int bstrnicmp(const bstring b0, const bstring b1, int n)
BSTR_PUBLIC int ballocmin(bstring b, int len)
BSTR_PUBLIC int bstrchrp(const bstring b, int c, int pos)
BSTR_PUBLIC bstring bread(bNread readPtr, void *parm)
BSTR_PUBLIC int binstrr(const bstring s1, int pos, const bstring s2)
BSTR_PUBLIC int bstrListAlloc(struct bstrList *sl, int msz)
BSTR_PUBLIC int bconcat(bstring b0, const bstring b1)
BSTR_PUBLIC int bsreada(bstring b, struct bStream *s, int n)
BSTR_PUBLIC int bsreadlns(bstring r, struct bStream *s, const bstring term)
BSTR_PUBLIC int bcstrfree(char *s)
BSTR_PUBLIC int bdelete(bstring s1, int pos, int len)
BSTR_PUBLIC int btolower(bstring b)
BSTR_PUBLIC void * bsclose(struct bStream *s)
BSTR_PUBLIC int bsreadln(bstring b, struct bStream *s, char terminator)
BSTR_PUBLIC bstring bmidstr(const bstring b, int left, int len)
BSTR_PUBLIC struct bstrList * bsplit(const bstring str, unsigned char splitChar)
BSTR_PUBLIC int bdestroy(bstring b)
BSTR_PUBLIC bstring bfromcstralloc(int mlen, const char *str)
BSTR_PUBLIC int bformata(bstring b, const char *fmt,...)
BSTR_PUBLIC int binstrcaseless(const bstring s1, int pos, const bstring s2)
BSTR_PUBLIC int bninchrr(const bstring b0, int pos, const bstring b1)
BSTR_PUBLIC int btoupper(bstring b)
BSTR_PUBLIC int biseqcstr(const bstring b, const char *s)
BSTR_PUBLIC int bvcformata(bstring b, int count, const char *fmt, va_list arglist)
BSTR_PUBLIC int brtrimws(bstring b)
BSTR_PUBLIC int binchrr(const bstring b0, int pos, const bstring b1)
BSTR_PUBLIC struct bstrList * bsplits(const bstring str, const bstring splitStr)
BSTR_PUBLIC int bconchar(bstring b0, char c)
BSTR_PUBLIC int bssplitscb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
BSTR_PUBLIC int bassignformat(bstring b, const char *fmt,...)
BSTR_PUBLIC bstring blk2bstr(const void *blk, int len)
BSTR_PUBLIC int bcatblk(bstring b, const void *s, int len)
BSTR_PUBLIC int bassigncstr(bstring a, const char *str)
BSTR_PUBLIC char * bstr2cstr(const bstring s, char z)
BSTR_PUBLIC int bsreadlnsa(bstring r, struct bStream *s, const bstring term)
BSTR_PUBLIC int bstrrchrp(const bstring b, int c, int pos)
BSTR_PUBLIC int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator)
BSTR_PUBLIC struct bstrList * bsplitstr(const bstring str, const bstring splitStr)
BSTR_PUBLIC struct bstrList * bstrListCreate(void)
BSTR_PUBLIC int bsplitstrcb(const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm)
BSTR_PUBLIC int bstricmp(const bstring b0, const bstring b1)
BSTR_PUBLIC int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator)
BSTR_PUBLIC bstring bstrcpy(const bstring b1)
BSTR_PUBLIC int btrunc(bstring b, int n)
BSTR_PUBLIC int bfindreplace(bstring b, const bstring find, const bstring repl, int pos)
BSTR_PUBLIC int bseof(const struct bStream *s)
BSTR_PUBLIC int biseq(const bstring b0, const bstring b1)
BSTR_PUBLIC bstring bgets(bNgetc getcPtr, void *parm, char terminator)
BSTR_PUBLIC int bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill)
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 bcatcstr(bstring b, const char *s)
BSTR_PUBLIC int bassignmidstr(bstring a, const bstring b, int left, int len)
BSTR_PUBLIC int biseqcstrcaseless(const bstring b, const char *s)
BSTR_PUBLIC struct bStream * bsopen(bNread readPtr, void *parm)
BSTR_PUBLIC int bfindreplacecaseless(bstring b, const bstring find, const bstring repl, int pos)
BSTR_PUBLIC int binsertch(bstring s1, int pos, int len, unsigned char fill)
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 bltrimws(bstring b)
BSTR_PUBLIC int breada(bstring b, bNread readPtr, void *parm)
BSTR_PUBLIC int bstrListAllocMin(struct bstrList *sl, int msz)
BSTR_PUBLIC int bstrListDestroy(struct bstrList *sl)
BSTR_PUBLIC int btrimws(bstring b)
BSTR_PUBLIC int biseqcaseless(const bstring b0, const bstring b1)
BSTR_PUBLIC bstring bjoin(const struct bstrList *bl, const bstring sep)
BSTR_PUBLIC int bsbufflength(struct bStream *s, int sz)
BSTR_PUBLIC int bisstemeqcaselessblk(const bstring b0, const void *blk, int len)
BSTR_PUBLIC int binchr(const bstring b0, int pos, const bstring b1)
BSTR_PUBLIC int bassignblk(bstring a, const void *s, int len)
BSTR_PUBLIC int bsreadlna(bstring b, struct bStream *s, char terminator)
BSTR_PUBLIC int bninchr(const bstring b0, int pos, const bstring b1)
BSTR_PUBLIC int bssplitstrcb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
BSTR_PUBLIC int bstrncmp(const bstring b0, const bstring b1, int n)
BSTR_PUBLIC bstring bformat(const char *fmt,...)
BSTR_PUBLIC int binsert(bstring s1, int pos, const bstring s2, unsigned char fill)
BSTR_PUBLIC int balloc(bstring s, int len)
BSTR_PUBLIC int binstr(const bstring s1, int pos, const bstring s2)
BSTR_PUBLIC int bsread(bstring b, struct bStream *s, int n)
Definition bstrlib.h:730
Definition bstrlib.h:84