netatalk 4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
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
66 extern "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
82 typedef struct tagbstring *bstring;
83
84 struct tagbstring {
85 int mlen;
86 int slen;
87 unsigned char *data;
88};
89
90/* Copy functions */
91#define cstr2bstr bfromcstr
92
108 BSTR_PUBLIC bstring
109 bfromcstr(const char *str);
110
130 BSTR_PUBLIC bstring
131 bfromcstralloc(int mlen, const char *str);
132
141 BSTR_PUBLIC bstring
142 blk2bstr(const void *blk, int len);
143
152 BSTR_PUBLIC char *
153 bstr2cstr(const bstring s, char z);
154
165 BSTR_PUBLIC int
166 bcstrfree(char *s);
167
174 BSTR_PUBLIC bstring
175 bstrcpy(const bstring b1);
176
183 BSTR_PUBLIC int
184 bassign(bstring a, const bstring b);
185
194 BSTR_PUBLIC int
195 bassignmidstr(bstring a, const bstring b, int left, int len);
196
203 BSTR_PUBLIC int
204 bassigncstr(bstring a, const char *str);
205
214 BSTR_PUBLIC int
215 bassignblk(bstring a, const void *s, int len);
216
217/* Destroy function */
218
231 BSTR_PUBLIC int
232 bdestroy(bstring b);
233
234/* Space allocation hinting functions */
235
266 BSTR_PUBLIC int
267 balloc(bstring s, int len);
268
293 BSTR_PUBLIC int
294 ballocmin(bstring b, int len);
295
296/* Substring extraction */
297
305 BSTR_PUBLIC bstring
306 bmidstr(const bstring b, int left, int len);
307
308/*Various standard manipulations */
309
316 BSTR_PUBLIC int
317 bconcat(bstring b0, const bstring b1);
318
325 BSTR_PUBLIC int
326 bconchar(bstring b0, char c);
327
334 BSTR_PUBLIC int
335 bcatcstr(bstring b, const char *s);
336
343 BSTR_PUBLIC int
344 bcatblk(bstring b, const void *s, int len);
345
354 BSTR_PUBLIC int
355 binsert(bstring s1, int pos, const bstring s2, unsigned char fill);
356
366 BSTR_PUBLIC int
367 binsertch(bstring s1, int pos, int len, unsigned char fill);
368
376 BSTR_PUBLIC int
377 breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill);
378
388 BSTR_PUBLIC int
389 bdelete(bstring s1, int pos, int len);
390
399 BSTR_PUBLIC int
400 bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill);
401
408 BSTR_PUBLIC int
409 btrunc(bstring b, int n);
410
411/*Scan/search functions */
412
422 BSTR_PUBLIC int
423 bstricmp(const bstring b0, const bstring b1);
424
435 BSTR_PUBLIC int
436 bstrnicmp(const bstring b0, const bstring b1, int n);
437
446 BSTR_PUBLIC int
447 biseqcaseless(const bstring b0, const bstring b1);
448
457 BSTR_PUBLIC int
458 bisstemeqcaselessblk(const bstring b0, const void *blk, int len);
459
471 BSTR_PUBLIC int
472 biseq(const bstring b0, const bstring b1);
473
482 BSTR_PUBLIC int
483 bisstemeqblk(const bstring b0, const void *blk, int len);
484
496 BSTR_PUBLIC int
497 biseqcstr(const bstring b, const char *s);
498
511 BSTR_PUBLIC int
512 biseqcstrcaseless(const bstring b, const char *s);
513
536 BSTR_PUBLIC int
537 bstrcmp(const bstring b0, const bstring b1);
538
553 BSTR_PUBLIC int
554 bstrncmp(const bstring b0, const bstring b1, int n);
555
564 BSTR_PUBLIC int
565 binstr(const bstring s1, int pos, const bstring s2);
566
577 BSTR_PUBLIC int
578 binstrr(const bstring s1, int pos, const bstring s2);
579
588 BSTR_PUBLIC int
589 binstrcaseless(const bstring s1, int pos, const bstring s2);
590
601 BSTR_PUBLIC int
602 binstrrcaseless(const bstring s1, int pos, const bstring s2);
603
610 BSTR_PUBLIC int
611 bstrchrp(const bstring b, int c, int pos);
612
619 BSTR_PUBLIC int
620 bstrrchrp(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
647 BSTR_PUBLIC int
648 binchr(const bstring b0, int pos, const bstring b1);
649
657 BSTR_PUBLIC int
658 binchrr(const bstring b0, int pos, const bstring b1);
659
667 BSTR_PUBLIC int
668 bninchr(const bstring b0, int pos, const bstring b1);
669
677 BSTR_PUBLIC int
678 bninchrr(const bstring b0, int pos, const bstring b1);
679
701 BSTR_PUBLIC int
702 bfindreplace(bstring b, const bstring find, const bstring repl, int pos);
703
725 BSTR_PUBLIC int
726 bfindreplacecaseless(bstring b, const bstring find, const bstring repl,
727 int pos);
728
729/* List of string container functions */
730 struct bstrList {
731 int qty, mlen;
732 bstring *entry;
733};
734
757 BSTR_PUBLIC struct bstrList *
758 bstrListCreate(void);
759
765 BSTR_PUBLIC int
766 bstrListDestroy(struct bstrList *sl);
767
772 BSTR_PUBLIC int
773 bstrListAlloc(struct bstrList *sl, int msz);
774
779 BSTR_PUBLIC int
780 bstrListAllocMin(struct bstrList *sl, int msz);
781
782/* String split and join functions */
783
793 BSTR_PUBLIC struct bstrList *
794 bsplit(const bstring str, unsigned char splitChar);
795
803 BSTR_PUBLIC struct bstrList *
804 bsplits(const bstring str, const bstring splitStr);
805
813 BSTR_PUBLIC struct bstrList *
814 bsplitstr(const bstring str, const bstring splitStr);
815
830 BSTR_PUBLIC bstring
831 bjoin(const struct bstrList *bl, const bstring sep);
832
853 BSTR_PUBLIC int
854 bsplitcb(const bstring str,
855 unsigned char splitChar,
856 int pos,
857 int(*cb)(void *parm, int ofs, int len),
858 void *parm);
859
880 BSTR_PUBLIC int
881 bsplitscb(const bstring str,
882 const bstring splitStr,
883 int pos,
884 int(*cb)(void *parm, int ofs, int len),
885 void *parm);
886
907 BSTR_PUBLIC int
908 bsplitstrcb(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
922 BSTR_PUBLIC int
923 bpattern(bstring b, int len);
924
931 BSTR_PUBLIC int
932 btoupper(bstring b);
933
940 BSTR_PUBLIC int
941 btolower(bstring b);
942
949 BSTR_PUBLIC int
950 bltrimws(bstring b);
951
958 BSTR_PUBLIC int
959 brtrimws(bstring b);
960
967 BSTR_PUBLIC int
968 btrimws(bstring b);
969
970/* *printf format functions */
990 BSTR_PUBLIC bstring
991 bformat(const char *fmt, ...);
992
1012 BSTR_PUBLIC int
1013 bformata(bstring b, const char *fmt, ...);
1014
1034 BSTR_PUBLIC int
1035 bassignformat(bstring b, const char *fmt, ...);
1036
1062 BSTR_PUBLIC int
1063 bvcformata(bstring b, int count, const char *fmt, va_list arglist);
1064
1090#define bvformata(ret, b, fmt, lastarg) \
1091 do { \
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
1116 typedef int (*bNgetc)(void *parm);
1117
1118 typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
1119
1120/* Input functions */
1121
1156 BSTR_PUBLIC bstring
1157#if defined(HAVE_BGETS)
1158bgetstream(bNgetc getcPtr, void *parm, char terminator);
1159#else
1160 bgets(bNgetc getcPtr, void *parm, char terminator);
1161#endif
1162
1176 BSTR_PUBLIC bstring
1177 bread(bNread readPtr, void *parm);
1178
1187 BSTR_PUBLIC int
1188 bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
1189
1198 BSTR_PUBLIC int
1199 bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
1200
1207 BSTR_PUBLIC int
1208 breada(bstring b, bNread readPtr, void *parm);
1209
1210/* Stream functions */
1211
1217 BSTR_PUBLIC struct bStream *
1218 bsopen(bNread readPtr, void *parm);
1219
1226 BSTR_PUBLIC void *
1227 bsclose(struct bStream *s);
1228
1236 BSTR_PUBLIC int
1237 bsbufflength(struct bStream *s, int sz);
1238
1250 BSTR_PUBLIC int
1251 bsreadln(bstring b, struct bStream *s, char terminator);
1252
1261 BSTR_PUBLIC int
1262 bsreadlns(bstring r, struct bStream *s, const bstring term);
1263
1272 BSTR_PUBLIC int
1273 bsread(bstring b, struct bStream *s, int n);
1274
1286 BSTR_PUBLIC int
1287 bsreadlna(bstring b, struct bStream *s, char terminator);
1288
1299 BSTR_PUBLIC int
1300 bsreadlnsa(bstring r, struct bStream *s, const bstring term);
1301
1310 BSTR_PUBLIC int
1311 bsreada(bstring b, struct bStream *s, int n);
1312
1319 BSTR_PUBLIC int
1320 bsunread(struct bStream *s, const bstring b);
1321
1327 BSTR_PUBLIC int
1328 bspeek(bstring r, const struct bStream *s);
1329
1354 BSTR_PUBLIC int
1355 bssplitscb(struct bStream *s,
1356 const bstring splitStr,
1357 int(*cb)(void *parm, int ofs, const bstring entry),
1358 void *parm);
1359
1384 BSTR_PUBLIC int
1385 bssplitstrcb(struct bStream *s,
1386 const bstring splitStr,
1387 int(*cb)(void *parm, int ofs, const bstring entry),
1388 void *parm);
1389
1407 BSTR_PUBLIC int
1408 bseof(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) \
1557 do { \
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) \
1568 do { \
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) \
1606 do { \
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) \
1647 do { \
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) \
1677 do { \
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) \
1707 do { \
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) \
1738 do { \
1739 if ((t).mlen >= 0) { \
1740 (t).mlen = -1; \
1741 } \
1742} while (0);
1743
1756#define bwriteallow(t) \
1757 do { \
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 */
bassign
BSTR_PUBLIC int bassign(bstring a, const bstring b)
Definition bstrlib.c:444
bisstemeqblk
BSTR_PUBLIC int bisstemeqblk(const bstring b0, const void *blk, int len)
Definition bstrlib.c:812
bpattern
BSTR_PUBLIC int bpattern(bstring b, int len)
Definition bstrlib.c:1827
bNread
size_t(* bNread)(void *buff, size_t elsize, size_t nelem, void *parm)
Definition bstrlib.h:1118
binstrrcaseless
BSTR_PUBLIC int binstrrcaseless(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1189
bspeek
BSTR_PUBLIC int bspeek(bstring r, const struct bStream *s)
Definition bstrlib.c:2299
breplace
BSTR_PUBLIC int breplace(bstring b1, int pos, int len, const bstring b2, unsigned char fill)
Definition bstrlib.c:1533
bsunread
BSTR_PUBLIC int bsunread(struct bStream *s, const bstring b)
Definition bstrlib.c:2290
bfromcstr
BSTR_PUBLIC bstring bfromcstr(const char *str)
Definition bstrlib.c:188
BSTR_PUBLIC
#define BSTR_PUBLIC
Definition bstrlib.h:51
bstrcmp
BSTR_PUBLIC int bstrcmp(const bstring b0, const bstring b1)
Definition bstrlib.c:864
bstrnicmp
BSTR_PUBLIC int bstrnicmp(const bstring b0, const bstring b1, int n)
Definition bstrlib.c:633
ballocmin
BSTR_PUBLIC int ballocmin(bstring b, int len)
Definition bstrlib.c:159
bstrchrp
BSTR_PUBLIC int bstrchrp(const bstring b, int c, int pos)
Definition bstrlib.c:1241
bread
BSTR_PUBLIC bstring bread(bNread readPtr, void *parm)
Definition bstrlib.c:1878
binstrr
BSTR_PUBLIC int binstrr(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1088
bstrListAlloc
BSTR_PUBLIC int bstrListAlloc(struct bstrList *sl, int msz)
Definition bstrlib.c:2515
bconcat
BSTR_PUBLIC int bconcat(bstring b0, const bstring b1)
Definition bstrlib.c:309
bsreada
BSTR_PUBLIC int bsreada(bstring b, struct bStream *s, int n)
Definition bstrlib.c:2177
bsreadlns
BSTR_PUBLIC int bsreadlns(bstring r, struct bStream *s, const bstring term)
Definition bstrlib.c:2258
bcstrfree
BSTR_PUBLIC int bcstrfree(char *s)
Definition bstrlib.c:302
bdelete
BSTR_PUBLIC int bdelete(bstring s1, int pos, int len)
Definition bstrlib.c:951
btolower
BSTR_PUBLIC int btolower(bstring b)
Definition bstrlib.c:582
bsclose
BSTR_PUBLIC void * bsclose(struct bStream *s)
Definition bstrlib.c:2014
bsreadln
BSTR_PUBLIC int bsreadln(bstring b, struct bStream *s, char terminator)
Definition bstrlib.c:2245
bmidstr
BSTR_PUBLIC bstring bmidstr(const bstring b, int left, int len)
Definition bstrlib.c:932
bsplit
BSTR_PUBLIC struct bstrList * bsplit(const bstring str, unsigned char splitChar)
Definition bstrlib.c:2710
bdestroy
BSTR_PUBLIC int bdestroy(bstring b)
Definition bstrlib.c:977
bfromcstralloc
BSTR_PUBLIC bstring bfromcstralloc(int mlen, const char *str)
Definition bstrlib.c:217
bformata
BSTR_PUBLIC int bformata(bstring b, const char *fmt,...)
Definition bstrlib.c:2805
binstrcaseless
BSTR_PUBLIC int binstrcaseless(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:1139
bninchrr
BSTR_PUBLIC int bninchrr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1406
btoupper
BSTR_PUBLIC int btoupper(bstring b)
Definition bstrlib.c:567
biseqcstr
BSTR_PUBLIC int biseqcstr(const bstring b, const char *s)
Definition bstrlib.c:833
bvcformata
BSTR_PUBLIC int bvcformata(bstring b, int count, const char *fmt, va_list arglist)
Definition bstrlib.c:2966
brtrimws
BSTR_PUBLIC int brtrimws(bstring b)
Definition bstrlib.c:743
binchrr
BSTR_PUBLIC int binchrr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1370
bsplits
BSTR_PUBLIC struct bstrList * bsplits(const bstring str, const bstring splitStr)
Definition bstrlib.c:2763
bconchar
BSTR_PUBLIC int bconchar(bstring b0, char c)
Definition bstrlib.c:346
bssplitscb
BSTR_PUBLIC int bssplitscb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
Definition bstrlib.c:2358
bassignformat
BSTR_PUBLIC int bassignformat(bstring b, const char *fmt,...)
Definition bstrlib.c:2860
blk2bstr
BSTR_PUBLIC bstring blk2bstr(const void *blk, int len)
Definition bstrlib.c:249
bcatblk
BSTR_PUBLIC int bcatblk(bstring b, const void *s, int len)
Definition bstrlib.c:387
bassigncstr
BSTR_PUBLIC int bassigncstr(bstring a, const char *str)
Definition bstrlib.c:498
bstr2cstr
BSTR_PUBLIC char * bstr2cstr(const bstring s, char z)
Definition bstrlib.c:282
bsreadlnsa
BSTR_PUBLIC int bsreadlnsa(bstring r, struct bStream *s, const bstring term)
Definition bstrlib.c:2101
bstring
struct tagbstring * bstring
Definition bstrlib.h:82
bstrrchrp
BSTR_PUBLIC int bstrrchrp(const bstring b, int c, int pos)
Definition bstrlib.c:1256
bassigngets
BSTR_PUBLIC int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:1889
bsplitstr
BSTR_PUBLIC struct bstrList * bsplitstr(const bstring str, const bstring splitStr)
Definition bstrlib.c:2737
bstrListCreate
BSTR_PUBLIC struct bstrList * bstrListCreate(void)
Definition bstrlib.c:2477
bsplitstrcb
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:2637
bstricmp
BSTR_PUBLIC int bstricmp(const bstring b0, const bstring b1)
Definition bstrlib.c:597
bgetsa
BSTR_PUBLIC int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:1919
bstrcpy
BSTR_PUBLIC bstring bstrcpy(const bstring b1)
Definition bstrlib.c:409
btrunc
BSTR_PUBLIC int btrunc(bstring b, int n)
Definition bstrlib.c:543
bfindreplace
BSTR_PUBLIC int bfindreplace(bstring b, const bstring find, const bstring repl, int pos)
Definition bstrlib.c:1776
bseof
BSTR_PUBLIC int bseof(const struct bStream *s)
Definition bstrlib.c:2005
biseq
BSTR_PUBLIC int biseq(const bstring b0, const bstring b1)
Definition bstrlib.c:795
bgets
BSTR_PUBLIC bstring bgets(bNgetc getcPtr, void *parm, char terminator)
Definition bstrlib.c:1952
bsetstr
BSTR_PUBLIC int bsetstr(bstring b0, int pos, const bstring b1, unsigned char fill)
Definition bstrlib.c:1424
bsplitscb
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:2601
bcatcstr
BSTR_PUBLIC int bcatcstr(bstring b, const char *s)
Definition bstrlib.c:363
bassignmidstr
BSTR_PUBLIC int bassignmidstr(bstring a, const bstring b, int left, int len)
Definition bstrlib.c:467
biseqcstrcaseless
BSTR_PUBLIC int biseqcstrcaseless(const bstring b, const char *s)
Definition bstrlib.c:848
bsopen
BSTR_PUBLIC struct bStream * bsopen(bNread readPtr, void *parm)
Definition bstrlib.c:1973
bfindreplacecaseless
BSTR_PUBLIC int bfindreplacecaseless(bstring b, const bstring find, const bstring repl, int pos)
Definition bstrlib.c:1782
binsertch
BSTR_PUBLIC int binsertch(bstring s1, int pos, int len, unsigned char fill)
Definition bstrlib.c:1788
bsplitcb
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:2577
bltrimws
BSTR_PUBLIC int bltrimws(bstring b)
Definition bstrlib.c:724
breada
BSTR_PUBLIC int breada(bstring b, bNread readPtr, void *parm)
Definition bstrlib.c:1850
bstrListAllocMin
BSTR_PUBLIC int bstrListAllocMin(struct bstrList *sl, int msz)
Definition bstrlib.c:2548
bstrListDestroy
BSTR_PUBLIC int bstrListDestroy(struct bstrList *sl)
Definition bstrlib.c:2494
btrimws
BSTR_PUBLIC int btrimws(bstring b)
Definition bstrlib.c:768
biseqcaseless
BSTR_PUBLIC int biseqcaseless(const bstring b0, const bstring b1)
Definition bstrlib.c:675
bjoin
BSTR_PUBLIC bstring bjoin(const struct bstrList *bl, const bstring sep)
Definition bstrlib.c:2308
bsbufflength
BSTR_PUBLIC int bsbufflength(struct bStream *s, int sz)
Definition bstrlib.c:1991
bisstemeqcaselessblk
BSTR_PUBLIC int bisstemeqcaselessblk(const bstring b0, const void *blk, int len)
Definition bstrlib.c:700
binchr
BSTR_PUBLIC int binchr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1339
bNgetc
int(* bNgetc)(void *parm)
Definition bstrlib.h:1116
bassignblk
BSTR_PUBLIC int bassignblk(bstring a, const void *s, int len)
Definition bstrlib.c:525
bsreadlna
BSTR_PUBLIC int bsreadlna(bstring b, struct bStream *s, char terminator)
Definition bstrlib.c:2033
bninchr
BSTR_PUBLIC int bninchr(const bstring b0, int pos, const bstring b1)
Definition bstrlib.c:1391
bssplitstrcb
BSTR_PUBLIC int bssplitstrcb(struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm)
Definition bstrlib.c:2419
bstrncmp
BSTR_PUBLIC int bstrncmp(const bstring b0, const bstring b1, int n)
Definition bstrlib.c:897
bformat
BSTR_PUBLIC bstring bformat(const char *fmt,...)
Definition bstrlib.c:2915
binsert
BSTR_PUBLIC int binsert(bstring s1, int pos, const bstring s2, unsigned char fill)
Definition bstrlib.c:1477
balloc
BSTR_PUBLIC int balloc(bstring s, int len)
Definition bstrlib.c:97
binstr
BSTR_PUBLIC int binstr(const bstring s1, int pos, const bstring s2)
Definition bstrlib.c:998
bsread
BSTR_PUBLIC int bsread(bstring b, struct bStream *s, int n)
Definition bstrlib.c:2277
config.h
bStream
Definition bstrlib.c:1964
bStream::parm
void * parm
Definition bstrlib.c:1966
bstrList
Definition bstrlib.h:730
bstrList::qty
int qty
Definition bstrlib.h:731
bstrList::mlen
int mlen
Definition bstrlib.h:731
bstrList::entry
bstring * entry
Definition bstrlib.h:732
entry
Definition ad_open.c:97
tagbstring
Definition bstrlib.h:84
tagbstring::mlen
int mlen
Definition bstrlib.h:85
tagbstring::data
unsigned char * data
Definition bstrlib.h:87
tagbstring::slen
int slen
Definition bstrlib.h:86