0001 BINIT(3)
0002 ========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Binit - Initialise UBF buffer
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Binit (UBFH *'p_ub', BFLDLEN 'len');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Initialise UBF buffer manually. Normally *tpalloc(3)* does this. But it is
0023 possible to make other buffers than XATMI to function as UBF. 'p_ub'
0024 is pointer to memory block, 'len' is memory size in bytes.
0025
0026 For example:
0027
0028 --------------------------------------------------------------------------------
0029
0030 char buf[1024];
0031 UBFH *p_ub = (UBFH *)buf;
0032
0033 if (0!=Binit(p_ub, sizeof(buf)))
0034 {
0035 fprintf(stderr, "Failed to Binit: %s\n", Bstrerror(Berror));
0036 }
0037
0038 --------------------------------------------------------------------------------
0039
0040 RETURN VALUE
0041 ------------
0042 On success, *Binit()* return zero; on error, -1 is returned,
0043 with *Berror* set to indicate the error.
0044
0045 ERRORS
0046 ------
0047 Note that *Bstrerror()* returns generic error message plus
0048 custom message with debug info from last function call.
0049
0050 *BNOTFLD* 'p_ub' is NULL.
0051
0052 *BNOSPACE* No space in buffer. The *sizeof(UBF_header_t)* is minimum size of buffer.
0053
0054 EXAMPLE
0055 -------
0056 See *ubftest/ubfunit1.c* for sample code.
0057
0058 BUGS
0059 ----
0060 Report bugs to support@mavimax.com
0061
0062 SEE ALSO
0063 --------
0064 *CBinit(3)* *Badd(3)* *CBadd(3)* *Bget(3)* *CBget(3)*
0065
0066 COPYING
0067 -------
0068 (C) Mavimax, Ltd
0069