57#define bstrDeclare(b) \
62 if ((b) != NULL && (b)->slen >= 0 && (b)->mlen >= (b)->slen) { \
69#define bAssign(a, b) \
72#define bSubs(b, pos, len, a, c) \
73 ((breplace)((b),(pos),(len),(a),(unsigned char)(c)))
75#define bStrchr(b, c) \
78#define bStrchrFast(b, c) \
81#define bCatCstr(b, s) \
82 ((bcatcstr)((b), (s)))
84#define bCatBlk(b, s, len) \
85 ((bcatblk)((b), (s), (len)))
87#define bCatStatic(b, s) \
88 bCatBlk((b), ("" s ""), sizeof (s) - 1)
93#define bReplaceAll(b, find, repl, pos) \
94 ((bfindreplace)((b),(find),(repl),(pos)))
96#define bUppercase(b) \
99#define bLowercase(b) \
102#define bCaselessCmp(a, b) \
103 ((bstricmp)((a), (b)))
105#define bCaselessNCmp(a, b, n) \
106 ((bstrnicmp)((a), (b), (n)))
108#define bBase64Decode(b) \
109 (bBase64DecodeEx((b), NULL))
111#define bUuDecode(b) \
112 (bUuDecodeEx((b), NULL))
121BSTR_PUBLIC
struct bStream *
180bInsertChrs(bstring b,
int pos,
int len,
unsigned char c,
unsigned char fill);
193#define bAscTime(t) (bStrfTime ("%c\n", (t)))
195#define bCTime(t) ((t) ? bAscTime (localtime (t)) : NULL)
281BSTR_PUBLIC
struct bStream *
325(*bNwrite)(
const void *buf,
size_t elsize,
size_t nelem,
void *parm);
332BSTR_PUBLIC
struct bwriteStream *
386#define bSecureDestroy(b) \
388 if ((b) && (b)->mlen > 0 && (b)->data) { \
389 (void)memset((b)->data, 0, (size_t)(b)->mlen); \
391 (void)bdestroy((b)); \
394#define bSecureWriteProtect(t) \
396 if ((t).mlen >= 0) { \
397 if ((t).mlen > (t).slen)) { \
398 (void)memset((t).data + (t).slen, 0, \
399 (size_t)(t).mlen - (t).slen); \
BSTR_PUBLIC void * bwsClose(struct bwriteStream *stream)
BSTR_PUBLIC int bwsWriteFlush(struct bwriteStream *stream)
BSTR_PUBLIC int bReplicate(bstring b, int n)
BSTR_PUBLIC bstring bYEncode(const bstring src)
BSTR_PUBLIC bstring bBase64DecodeEx(const bstring b, int *boolTruncError)
BSTR_PUBLIC bstring bHead(bstring b, int n)
BSTR_PUBLIC int bReverse(bstring b)
BSTR_PUBLIC struct bwriteStream * bwsOpen(bNwrite writeFn, void *parm)
BSTR_PUBLIC bstring bYDecode(const bstring src)
BSTR_PUBLIC int bSetChar(bstring b, int pos, char c)
BSTR_PUBLIC int bSetCstrChar(bstring a, int pos, char c)
BSTR_PUBLIC char * bStr2NetStr(const bstring b)
BSTR_PUBLIC int bwsWriteBstr(struct bwriteStream *stream, const bstring b)
BSTR_PUBLIC bstring bStrfTime(const char *fmt, const struct tm *timeptr)
BSTR_PUBLIC int bFill(bstring a, char c, int len)
BSTR_PUBLIC int bJustifyRight(bstring b, int width, int space)
BSTR_PUBLIC bstring bUuDecodeEx(const bstring src, int *badlines)
BSTR_PUBLIC int bJustifyCenter(bstring b, int width, int space)
BSTR_PUBLIC struct bStream * bsUuDecode(struct bStream *sInp, int *badlines)
BSTR_PUBLIC int bJustifyMargin(bstring b, int width, int space)
BSTR_PUBLIC int bwsWriteBlk(struct bwriteStream *stream, void *blk, int len)
BSTR_PUBLIC int bwsBuffLength(struct bwriteStream *stream, int sz)
BSTR_PUBLIC struct bStream * bsFromBstr(const bstring b)
BSTR_PUBLIC bstring bBase64Encode(const bstring b)
BSTR_PUBLIC int bInsertChrs(bstring b, int pos, int len, unsigned char c, unsigned char fill)
BSTR_PUBLIC bstring bSecureInput(int maxlen, int termchar, bNgetc vgetchar, void *vgcCtx)
BSTR_PUBLIC bstring bTail(bstring b, int n)
BSTR_PUBLIC int bwsIsEOF(const struct bwriteStream *stream)
BSTR_PUBLIC bstring bNetStr2Bstr(const char *buf)
BSTR_PUBLIC int bJustifyLeft(bstring b, int space)
BSTR_PUBLIC bstring bUuEncode(const bstring src)
C implementaion of bstring functions.