bstring 1.1.0
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#elif defined(_MSC_VER)
61#define BSTR_PRINTF(format, argument)
62#define BSTR_UNUSED \
63 __pragma(warning(suppress:4100))
64#else
65#define BSTR_PRINTF(format, argument)
66#define BSTR_UNUSED
67#endif
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
73#ifdef HAVE_CONFIG_H
74#include <config.h>
75#endif
76
77#include <stdarg.h>
78#include <string.h>
79#include <limits.h>
80#include <ctype.h>
81
82#define BSTR_ERR (-1)
83#define BSTR_OK (0)
84#define BSTR_BS_BUFF_LENGTH_GET (0)
85
86typedef struct tagbstring *bstring;
87
88struct tagbstring {
89 int mlen;
90 int slen;
91 unsigned char *data;
92};
93
94/* Copy functions */
95#define cstr2bstr bfromcstr
96
112BSTR_PUBLIC bstring
113bfromcstr(const char *str);
114
134BSTR_PUBLIC bstring
135bfromcstralloc(int mlen, const char *str);
136
143BSTR_PUBLIC bstring
144bfromcstrrangealloc(int minl, int maxl, const char *str);
145
154BSTR_PUBLIC bstring
155blk2bstr(const void *blk, int len);
156
165BSTR_PUBLIC char *
166bstr2cstr(const bstring s, char z);
167
178BSTR_PUBLIC int
179bcstrfree(char *s);
180
187BSTR_PUBLIC bstring
188bstrcpy(const bstring b1);
189
196BSTR_PUBLIC int
197bassign(bstring a, const bstring b);
198
207BSTR_PUBLIC int
208bassignmidstr(bstring a, const bstring b, int left, int len);
209
216BSTR_PUBLIC int
217bassigncstr(bstring a, const char *str);
218
227BSTR_PUBLIC int
228bassignblk(bstring a, const void *s, int len);
229
230/* Destroy function */
231
244BSTR_PUBLIC int
245bdestroy(bstring b);
246
247/* Space allocation hinting functions */
248
279BSTR_PUBLIC int
280balloc(bstring s, int len);
281
306BSTR_PUBLIC int
307ballocmin(bstring b, int len);
308
309/* Substring extraction */
310
318BSTR_PUBLIC bstring
319bmidstr(const bstring b, int left, int len);
320
321/*Various standard manipulations */
322
329BSTR_PUBLIC int
330bconcat(bstring b0, const bstring b1);
331
338BSTR_PUBLIC int
339bconchar(bstring b0, char c);
340
347BSTR_PUBLIC int
348bcatcstr(bstring b, const char *s);
349
356BSTR_PUBLIC int
357bcatblk(bstring b, const void *s, int len);
358
367BSTR_PUBLIC int
368binsert(bstring s1, int pos, const bstring s2, unsigned char fill);
369
378BSTR_PUBLIC int
379binsertblk(bstring b, int pos, const void *blk, int len,
380 unsigned char fill);
381
391BSTR_PUBLIC int
392binsertch(bstring s1, int pos, int len, unsigned char fill);
393
401BSTR_PUBLIC int
402breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill);
403
413BSTR_PUBLIC int
414bdelete(bstring s1, int pos, int len);
415
424BSTR_PUBLIC int
425bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill);
426
433BSTR_PUBLIC int
434btrunc(bstring b, int n);
435
436/*Scan/search functions */
437
447BSTR_PUBLIC int
448bstricmp(const bstring b0, const bstring b1);
449
460BSTR_PUBLIC int
461bstrnicmp(const bstring b0, const bstring b1, int n);
462
471BSTR_PUBLIC int
472biseqcaseless(const bstring b0, const bstring b1);
473
483BSTR_PUBLIC int
484biseqcaselessblk(const bstring b, const void *blk, int len);
485
494BSTR_PUBLIC int
495bisstemeqcaselessblk(const bstring b0, const void *blk, int len);
496
508BSTR_PUBLIC int
509biseq(const bstring b0, const bstring b1);
510
519BSTR_PUBLIC int
520biseqblk(const bstring b, const void *blk, int len);
521
530BSTR_PUBLIC int
531bisstemeqblk(const bstring b0, const void *blk, int len);
532
544BSTR_PUBLIC int
545biseqcstr(const bstring b, const char *s);
546
559BSTR_PUBLIC int
560biseqcstrcaseless(const bstring b, const char *s);
561
584BSTR_PUBLIC int
585bstrcmp(const bstring b0, const bstring b1);
586
601BSTR_PUBLIC int
602bstrncmp(const bstring b0, const bstring b1, int n);
603
612BSTR_PUBLIC int
613binstr(const bstring s1, int pos, const bstring s2);
614
625BSTR_PUBLIC int
626binstrr(const bstring s1, int pos, const bstring s2);
627
636BSTR_PUBLIC int
637binstrcaseless(const bstring s1, int pos, const bstring s2);
638
649BSTR_PUBLIC int
650binstrrcaseless(const bstring s1, int pos, const bstring s2);
651
658BSTR_PUBLIC int
659bstrchrp(const bstring b, int c, int pos);
660
667BSTR_PUBLIC int
668bstrrchrp(const bstring b, int c, int pos);
669
676#define bstrchr(b, c) \
677 bstrchrp((b), (c), 0)
678
685#define bstrrchr(b, c) \
686 bstrrchrp((b), (c), blength(b) - 1)
687
695BSTR_PUBLIC int
696binchr(const bstring b0, int pos, const bstring b1);
697
705BSTR_PUBLIC int
706binchrr(const bstring b0, int pos, const bstring b1);
707
715BSTR_PUBLIC int
716bninchr(const bstring b0, int pos, const bstring b1);
717
725BSTR_PUBLIC int
726bninchrr(const bstring b0, int pos, const bstring b1);
727
749BSTR_PUBLIC int
750bfindreplace(bstring b, const bstring find, const bstring repl, int pos);
751
773BSTR_PUBLIC int
774bfindreplacecaseless(bstring b, const bstring find, const bstring repl,
775 int pos);
776
777/* List of string container functions */
778struct bstrList {
779 int qty, mlen;
780 bstring *entry;
781};
782
805BSTR_PUBLIC struct bstrList *
807
813BSTR_PUBLIC int
815
820BSTR_PUBLIC int
821bstrListAlloc(struct bstrList *sl, int msz);
822
827BSTR_PUBLIC int
828bstrListAllocMin(struct bstrList *sl, int msz);
829
830/* String split and join functions */
831
841BSTR_PUBLIC struct bstrList *
842bsplit(const bstring str, unsigned char splitChar);
843
851BSTR_PUBLIC struct bstrList *
852bsplits(const bstring str, const bstring splitStr);
853
861BSTR_PUBLIC struct bstrList *
862bsplitstr(const bstring str, const bstring splitStr);
863
878BSTR_PUBLIC bstring
879bjoin(const struct bstrList *bl, const bstring sep);
880
888BSTR_PUBLIC bstring
889bjoinblk(const struct bstrList *bl, const void *blk, int len);
890
911BSTR_PUBLIC int
912bsplitcb(const bstring str,
913 unsigned char splitChar,
914 int pos,
915 int(*cb)(void *parm, int ofs, int len),
916 void *parm);
917
938BSTR_PUBLIC int
939bsplitscb(const bstring str,
940 const bstring splitStr,
941 int pos,
942 int(*cb)(void *parm, int ofs, int len),
943 void *parm);
944
965BSTR_PUBLIC int
966bsplitstrcb(const bstring str,
967 const bstring splitStr,
968 int pos,
969 int(*cb)(void *parm, int ofs, int len), void *parm);
970
971/* Miscellaneous functions */
972
980BSTR_PUBLIC int
981bpattern(bstring b, int len);
982
989BSTR_PUBLIC int
990btoupper(bstring b);
991
998BSTR_PUBLIC int
999btolower(bstring b);
1000
1007BSTR_PUBLIC int
1008bltrimws(bstring b);
1009
1016BSTR_PUBLIC int
1017brtrimws(bstring b);
1018
1025BSTR_PUBLIC int
1026btrimws(bstring b);
1027
1028/* *printf format functions */
1048BSTR_PUBLIC bstring
1049bformat(const char *fmt, ...);
1050
1070BSTR_PUBLIC int
1071bformata(bstring b, const char *fmt, ...);
1072
1092BSTR_PUBLIC int
1093bassignformat(bstring b, const char *fmt, ...);
1094
1120BSTR_PUBLIC int
1121bvcformata(bstring b, int count, const char *fmt, va_list arglist);
1122
1148#define bvformata(ret, b, fmt, lastarg) \
1149do { \
1150 bstring bstrtmp_b =(b); \
1151 const char *bstrtmp_fmt = (fmt); \
1152 int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
1153 for (;;) { \
1154 va_list bstrtmp_arglist; \
1155 va_start(bstrtmp_arglist, lastarg); \
1156 bstrtmp_r = bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, \
1157 bstrtmp_arglist); \
1158 va_end(bstrtmp_arglist); \
1159 if(bstrtmp_r >= 0) { \
1160 /* Everything went ok */ \
1161 bstrtmp_r = BSTR_OK; \
1162 break; \
1163 } else if(-bstrtmp_r <= bstrtmp_sz) { \
1164 /* A real error? */ \
1165 bstrtmp_r = BSTR_ERR; \
1166 break; \
1167 } \
1168 /* Doubled or target size */ \
1169 bstrtmp_sz = -bstrtmp_r; \
1170 } \
1171 ret = bstrtmp_r; \
1172} while (0);
1173
1174typedef int (*bNgetc)(void *parm);
1175
1176typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
1177
1178/* Input functions */
1179
1214BSTR_PUBLIC bstring
1215#if defined(HAVE_BGETS)
1216bgetstream(bNgetc getcPtr, void *parm, char terminator);
1217#else
1218bgets(bNgetc getcPtr, void *parm, char terminator);
1219#endif
1220
1234BSTR_PUBLIC bstring
1235bread(bNread readPtr, void *parm);
1236
1245BSTR_PUBLIC int
1246bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
1247
1256BSTR_PUBLIC int
1257bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
1258
1265BSTR_PUBLIC int
1266breada(bstring b, bNread readPtr, void *parm);
1267
1268/* Stream functions */
1269
1275BSTR_PUBLIC struct bStream *
1276bsopen(bNread readPtr, void *parm);
1277
1284BSTR_PUBLIC void *
1285bsclose(struct bStream *s);
1286
1294BSTR_PUBLIC int
1295bsbufflength(struct bStream *s, int sz);
1296
1308BSTR_PUBLIC int
1309bsreadln(bstring b, struct bStream *s, char terminator);
1310
1319BSTR_PUBLIC int
1320bsreadlns(bstring r, struct bStream *s, const bstring term);
1321
1330BSTR_PUBLIC int
1331bsread(bstring b, struct bStream *s, int n);
1332
1344BSTR_PUBLIC int
1345bsreadlna(bstring b, struct bStream *s, char terminator);
1346
1357BSTR_PUBLIC int
1358bsreadlnsa(bstring r, struct bStream *s, const bstring term);
1359
1368BSTR_PUBLIC int
1369bsreada(bstring b, struct bStream *s, int n);
1370
1377BSTR_PUBLIC int
1378bsunread(struct bStream *s, const bstring b);
1379
1385BSTR_PUBLIC int
1386bspeek(bstring r, const struct bStream *s);
1387
1412BSTR_PUBLIC int
1413bssplitscb(struct bStream *s,
1414 const bstring splitStr,
1415 int(*cb)(void *parm, int ofs, const bstring entry),
1416 void *parm);
1417
1442BSTR_PUBLIC int
1443bssplitstrcb(struct bStream *s,
1444 const bstring splitStr,
1445 int(*cb)(void *parm, int ofs, const bstring entry),
1446 void *parm);
1447
1465BSTR_PUBLIC int
1466bseof(const struct bStream *s);
1467
1468/* Accessor macros */
1469
1475#define blengthe(b, e) \
1476 (((b) == (void *)0 || (b)->slen < 0) \
1477 ? (int)(e) \
1478 : ((b)->slen))
1479
1485#define blength(b) \
1486 (blengthe((b), 0))
1487
1493#define bdataofse(b, o, e) \
1494 (((b) == (void *)0 || (b)->data == (void *)0) \
1495 ? (char *)(e) \
1496 : ((char *)(b)->data) + (o))
1497
1503#define bdataofs(b, o) \
1504 (bdataofse((b),(o),(void *)0))
1505
1511#define bdatae(b, e) \
1512 (bdataofse(b, 0, e))
1513
1519#define bdata(b) \
1520 (bdataofs(b, 0))
1521
1528#define bchare(b, p, e) \
1529 ((((unsigned)(p)) < (unsigned)blength(b)) \
1530 ? ((b)->data[(p)]) \
1531 : (e))
1532
1539#define bchar(b, p) \
1540 bchare((b), (p), '\0')
1541
1542/* Static constant string initialization macro */
1543
1546#define bsStaticMlen(q, m) { (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
1547
1548#if defined (_MSC_VER)
1549/* There are many versions of MSVC which emit __LINE__ as a non-constant. */
1563#define bsStatic(q) bsStaticMlen(q, -32)
1564#endif /* defined (_MSC_VER) */
1565
1566#ifndef bsStatic
1569#define bsStatic(q) bsStaticMlen(q, -__LINE__)
1570#endif /* bsStatic */
1571
1572/* Static constant block parameter pair */
1573
1592#define bsStaticBlkParms(q) \
1593 ((void *)("" q "")), ((int)sizeof(q) -1)
1594
1595/* Static convenience macros for blk functions with string literals */
1596
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)))
1606
1607/* Reference building macros */
1608
1611#define cstr2tbstr btfromcstr
1612
1626#define btfromcstr(t, s) \
1627do { \
1628 (t).data = (unsigned char *)(s); \
1629 (t).slen = ((t).data) \
1630 ? ((int)(strlen)((char *)(t).data)) \
1631 : 0; \
1632 (t).mlen = -1; \
1633} while (0)
1634
1637#define blk2tbstr(t, s, l) \
1638do { \
1639 (t).data = (unsigned char *)(s); \
1640 (t).slen = l; \
1641 (t).mlen = -1; \
1642} while (0)
1643
1658#define btfromblk(t, s, l) blk2tbstr(t, s, l)
1659
1675#define bmid2tbstr(t, b, p, l) \
1676do { \
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; \
1683 bstrtmp_left = 0; \
1684 } \
1685 if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) { \
1686 bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
1687 } \
1688 if(bstrtmp_len <= 0) { \
1689 (t).data =(unsigned char *)""; \
1690 (t).slen = 0; \
1691 } else { \
1692 (t).data = bstrtmp_s->data + bstrtmp_left; \
1693 (t).slen = bstrtmp_len; \
1694 } \
1695 } else { \
1696 (t).data = (unsigned char *)""; \
1697 (t).slen = 0; \
1698 } \
1699 (t).mlen = -__LINE__; \
1700} while (0)
1701
1716#define btfromblkltrimws(t, s, l) \
1717do { \
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])) { \
1723 break; \
1724 } \
1725 } \
1726 } \
1727 (t).data = bstrtmp_s + bstrtmp_idx; \
1728 (t).slen = bstrtmp_len - bstrtmp_idx; \
1729 (t).mlen = -__LINE__; \
1730} while (0)
1731
1746#define btfromblkrtrimws(t, s, l) \
1747do { \
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])) { \
1753 break; \
1754 } \
1755 } \
1756 } \
1757 (t).data = bstrtmp_s; \
1758 (t).slen = bstrtmp_len + 1; \
1759 (t).mlen = -__LINE__; \
1760} while (0)
1761
1776#define btfromblktrimws(t, s, l) \
1777do { \
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])) { \
1783 break; \
1784 } \
1785 } \
1786 for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
1787 if (!isspace(bstrtmp_s[bstrtmp_len])) { \
1788 break; \
1789 } \
1790 } \
1791 } \
1792 (t).data = bstrtmp_s + bstrtmp_idx; \
1793 (t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
1794 (t).mlen = -__LINE__; \
1795} while (0)
1796
1797/* Write protection macros */
1798
1807#define bwriteprotect(t) \
1808do { \
1809 if ((t).mlen >= 0) { \
1810 (t).mlen = -1; \
1811 } \
1812} while (0)
1813
1826#define bwriteallow(t) \
1827do { \
1828 if ((t).mlen == -1) { \
1829 (t).mlen = (t).slen + ((t).slen == 0); \
1830 } \
1831} while (0)
1832
1836#define biswriteprotected(t) \
1837 ((t).mlen <= 0)
1838
1839#ifdef __cplusplus
1840}
1841#endif
1842
1843#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 int binsertblk(bstring b, int pos, const void *blk, int len, unsigned char fill)
BSTR_PUBLIC bstring bjoinblk(const struct bstrList *bl, const void *blk, int len)
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 biseqblk(const bstring b, const void *blk, int len)
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 biseqcaselessblk(const bstring b, const void *blk, 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 bstring bfromcstrrangealloc(int minl, int maxl, const char *str)
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:778
Definition bstrlib.h:88