53 #define bstrDeclare(b) \ 58 if ((b) != NULL && (b)->slen >= 0 && (b)->mlen >= (b)->slen) { \ 65 #define bAssign(a, b) \ 68 #define bSubs(b, pos, len, a, c) \ 69 ((breplace)((b),(pos),(len),(a),(unsigned char)(c))) 71 #define bStrchr(b, c) \ 74 #define bStrchrFast(b, c) \ 77 #define bCatCstr(b, s) \ 78 ((bcatcstr)((b), (s))) 80 #define bCatBlk(b, s, len) \ 81 ((bcatblk)((b), (s), (len))) 83 #define bCatStatic(b, s) \ 84 bCatBlk((b), ("" s ""), sizeof (s) - 1) 86 #define bTrunc(b, n) \ 89 #define bReplaceAll(b, find, repl, pos) \ 90 ((bfindreplace)((b),(find),(repl),(pos))) 92 #define bUppercase(b) \ 95 #define bLowercase(b) \ 98 #define bCaselessCmp(a, b) \ 99 ((bstricmp)((a), (b))) 101 #define bCaselessNCmp(a, b, n) \ 102 ((bstrnicmp)((a), (b), (n))) 104 #define bBase64Decode(b) \ 105 (bBase64DecodeEx((b), NULL)) 107 #define bUuDecode(b) \ 108 (bUuDecodeEx((b), NULL)) 187 bStrfTime(
const char * fmt,
const struct tm * timeptr);
189 #define bAscTime(t) (bStrfTime ("%c\n", (t))) 191 #define bCTime(t) ((t) ? bAscTime (localtime (t)) : NULL) 321 (*bNwrite)(
const void *buf,
size_t elsize,
size_t nelem,
void *parm);
329 bwsOpen(bNwrite writeFn,
void *parm);
382 #define bSecureDestroy(b) \ 384 if ((b) && (b)->mlen > 0 && (b)->data) { \ 385 (void)memset((b)->data, 0, (size_t)(b)->mlen); \ 386 (void)bdestroy((b)); \ 390 #define bSecureWriteProtect(t) \ 392 if ((t).mlen >= 0) { \ 393 if ((t).mlen > (t).slen)) { \ 394 (void)memset((t).data + (t).slen, 0, \ 395 (size_t)(t).mlen - (t).slen); \ 411 bSecureInput(
int maxlen,
int termchar, bNgetc vgetchar,
void *vgcCtx);
BSTR_PUBLIC int bFill(bstring a, char c, int len)
Fill a given bstring with the character in parameter c, for a length n.
Definition: bstraux.c:74
BSTR_PUBLIC bstring bSecureInput(int maxlen, int termchar, bNgetc vgetchar, void *vgcCtx)
Read input from an abstracted input interface, for a length of at most maxlen characters.
Definition: bstraux.c:973
C implementaion of bstring functions.
BSTR_PUBLIC bstring bBase64Encode(const bstring b)
Generate a base64 encoding.
Definition: bstraux.c:343
BSTR_PUBLIC bstring bYDecode(const bstring src)
Performs a YDecode of a block of data.
Definition: bstraux.c:846
BSTR_PUBLIC bstring bYEncode(const bstring src)
Performs a YEncode of a block of data.
Definition: bstraux.c:815
BSTR_PUBLIC int bReverse(bstring b)
Reverse the contents of b in place.
Definition: bstraux.c:90
BSTR_PUBLIC int bSetChar(bstring b, int pos, char c)
Sets the character at position pos to the character c in the bstring a.
Definition: bstraux.c:955
BSTR_PUBLIC char * bStr2NetStr(const bstring b)
Convert a bstring to a netstring.
Definition: bstraux.c:285
BSTR_PUBLIC int bwsWriteBstr(struct bwriteStream *stream, const bstring b)
Send a bstring to a bwriteStream.
Definition: bstraux.c:1079
BSTR_PUBLIC bstring bNetStr2Bstr(const char *buf)
Convert a netstring to a bstring.
Definition: bstraux.c:306
BSTR_PUBLIC int bReplicate(bstring b, int n)
Replicate the contents of b end to end n times and replace it in b.
Definition: bstraux.c:84
BSTR_PUBLIC bstring bStrfTime(const char *fmt, const struct tm *timeptr)
Takes a format string that is compatible with strftime and a struct tm pointer, formats the time acco...
Definition: bstraux.c:896
BSTR_PUBLIC bstring bHead(bstring b, int n)
Return with a string of the first n characters of b.
Definition: bstraux.c:62
BSTR_PUBLIC int bwsBuffLength(struct bwriteStream *stream, int sz)
Set the length of the buffer used by the bwsStream.
Definition: bstraux.c:1144
BSTR_PUBLIC int bSetCstrChar(bstring a, int pos, char c)
Sets the character at position pos to the character c in the bstring a.
Definition: bstraux.c:935
Definition: bstraux.c:1024
BSTR_PUBLIC int bwsIsEOF(const struct bwriteStream *stream)
Returns 0 if the stream is currently writable, 1 if the core stream has responded by not accepting th...
Definition: bstraux.c:1132
BSTR_PUBLIC int bwsWriteBlk(struct bwriteStream *stream, void *blk, int len)
Send a block of data a bwriteStream.
Definition: bstraux.c:1121
BSTR_PUBLIC struct bStream * bsUuDecode(struct bStream *sInp, int *badlines)
Creates a bStream which performs the UUDecode of an an input stream.
Definition: bstraux.c:740
BSTR_PUBLIC void * bwsClose(struct bwriteStream *stream)
Close the bwriteStream, and return the handle to the stream that was originally used to open the give...
Definition: bstraux.c:1158
BSTR_PUBLIC bstring bUuEncode(const bstring src)
Performs a UUEncode of a block of data.
Definition: bstraux.c:773
BSTR_PUBLIC struct bwriteStream * bwsOpen(bNwrite writeFn, void *parm)
Wrap a given open stream (described by a fwrite work-a-like function pointer and stream handle) into ...
Definition: bstraux.c:1033
BSTR_PUBLIC int bwsWriteFlush(struct bwriteStream *stream)
Force any pending data to be written to the core stream.
Definition: bstraux.c:1064
BSTR_PUBLIC struct bStream * bsFromBstr(const bstring b)
Create a bStream whose contents are a copy of the bstring passed in.
Definition: bstraux.c:243
Definition: bstrlib.c:1925
BSTR_PUBLIC int bJustifyLeft(bstring b, int space)
Left justify a string.
Definition: bstraux.c:137
BSTR_PUBLIC int bJustifyMargin(bstring b, int width, int space)
Stretch a string to flush against left and right margins by evenly distributing additional white spac...
Definition: bstraux.c:194
BSTR_PUBLIC int bInsertChrs(bstring b, int pos, int len, unsigned char c, unsigned char fill)
Insert a repeated sequence of a given character into the string at position pos for a length len...
Definition: bstraux.c:111
BSTR_PUBLIC int bJustifyRight(bstring b, int width, int space)
Right justify a string to within a given width.
Definition: bstraux.c:161
BSTR_PUBLIC bstring bTail(bstring b, int n)
Return with a string of the last n characters of b.
Definition: bstraux.c:50
BSTR_PUBLIC bstring bBase64DecodeEx(const bstring b, int *boolTruncError)
Decode a base64 block of data.
Definition: bstraux.c:430
BSTR_PUBLIC bstring bUuDecodeEx(const bstring src, int *badlines)
Performs a UUDecode of a block of data.
Definition: bstraux.c:635
BSTR_PUBLIC int bJustifyCenter(bstring b, int width, int space)
Center a string's non-white space characters to within a given width by inserting whitespaces at the ...
Definition: bstraux.c:177