Back to home page

Enduro/X

 
 

    


0001 CBCHG(3)
0002 ========
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 CBchg - Convert and change (add/update) field occurrance in UBF buffer
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 
0014 #include <ubf.h>
0015 
0016 int CBchg (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC 'occ', char *'buf', BFLDLEN 'len', int 'usrtype');
0017 
0018 Link with '-lubf -lnstd -lm -lpthread'
0019 
0020 DESCRIPTION
0021 -----------
0022 Change (add or update) field in UBF buffer by converting given user type 'usrtype' 
0023 to buffer field's type (see BFLD_* types). The UBF buffer pointer is passed 
0024 by 'p_ub', field id in 'bfldid'. 'occ' is occurrence to change. The user field 
0025 value is passed in 'buf'. The 'len' is used only if 'usrtype' is *BFLD_CARRAY*, 
0026 for which length cannot be detected from passed data.
0027 
0028 If 'occ' is bigger than last existing index+1 in buffer then non existing 
0029 occurrences (which are not being set by this function) are initialized with 
0030 defaults. For numeric it is 0, for *BFLD_CHAR* it is 0x00, 
0031 for *BFLD_STRING* it is empty string, for *BFLD_CARRAY* 
0032 it is empty byte array (with length 0).
0033 
0034 Function operations on field types *BFLD_UBF* and *BFLD_VIEW* 
0035 are not supported. This includes type of 'bfldid' or 'usrtype' having any 
0036 unsupported field types for this function.
0037 
0038 RETURN VALUE
0039 ------------
0040 On success, *CBchg()* return zero; on error, -1 is returned, 
0041 with *Berror* set to indicate the error.
0042 
0043 ERRORS
0044 ------
0045 Note that *Bstrerror()* returns generic error message plus custom message 
0046 with debug info from last function call.
0047 
0048 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0049 
0050 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0051 
0052 *BNOSPACE* No space in buffer for string data.
0053 
0054 *BMALLOC* Failed to allocate type conversion buffer.
0055 
0056 *BBADFLD* Invalid field id passed.
0057 
0058 *BEBADOP* Operation not supported (e.g. work with *BFLD_UBF* 
0059 or *BFLD_VIEW* type fields).
0060 
0061 EXAMPLE
0062 -------
0063 See *ubftest/test_cbchg.c* for sample code.
0064 
0065 BUGS
0066 ----
0067 Report bugs to support@mavimax.com
0068 
0069 SEE ALSO
0070 --------
0071 *Bchg(3)* *Badd(3)* *CBadd(3)* *Bget(3)* *CBget(3)*
0072 
0073 COPYING
0074 -------
0075 (C) Mavimax, Ltd
0076