0001 BFPRINTCB(3)
0002 ============
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bfprintcb - Print the buffer output in human/machine readable format to
0009 callback function
0010
0011
0012 SYNOPSIS
0013 --------
0014
0015 #include <ubf.h>
0016
0017 int Bfprintcb (UBFH *'p_ub', int (*'p_writef')(char *'buffer', long 'datalen',
0018 void *'dataptr1'), void *'dataptr1');
0019
0020
0021 Link with '-lubf -lnstd -lm -lpthread'
0022
0023 DESCRIPTION
0024 -----------
0025 Function prints the 'p_ub' buffer content to callback function 'p_writef'.
0026 The format of the output is "<FIELD><TAB><VALUE><NEW_LINE><EOS(0x00)>".
0027 The *BFLD_CARRAY* fields are printed in the way that non readable characters are
0028 printed in hex-decimal format, prefixed with \. If value
0029 contains \ char, then it is printed as \\. Example:
0030
0031 --------------------------------------------------------------------------------
0032 T_SHORT_FLD 1765
0033 T_LONG_FLD 3333111
0034 T_LONG_FLD 2
0035 T_CHAR_FLD A
0036 T_FLOAT_FLD 1.33000
0037 T_DOUBLE_FLD 1111.220000
0038 T_DOUBLE_FLD 333.000000
0039 T_DOUBLE_FLD 444.000000
0040 T_STRING_FLD HELLO WORLD
0041 T_CARRAY_FLD \00\01\02\03HELLO BINARY\04\05\00
0042 --------------------------------------------------------------------------------
0043
0044 The callback receives 'buffer' parameter with ASCII chars to print. The 'datalen'
0045 indicates the data length in the 'buffer', this includes a newline and EOS byte.
0046 'dataptr1' is forwarded from the main *Bfprintcb()* call.
0047
0048
0049 RETURN VALUE
0050 ------------
0051 On success, *Bfprintcb()* return zero; on error, -1 is returned, with
0052 *Berror* set to indicate the error.
0053
0054 ERRORS
0055 ------
0056 Note that *Bstrerror()* returns generic error message plus custom message
0057 with debug info from last function call.
0058
0059 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0060
0061 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0062
0063 *BEINVAL* 'outf' is NULL.
0064
0065 EXAMPLE
0066 -------
0067 See *ubftest/test_print.c* for sample code.
0068
0069 BUGS
0070 ----
0071 Report bugs to support@mavimax.com
0072
0073 SEE ALSO
0074 --------
0075 *Bfprint(3)* *Bextread(3)* *Bprint(3)* *Bread(3)* *Bwrite(3)*
0076
0077 COPYING
0078 -------
0079 (C) Mavimax, Ltd
0080